code stringlengths 2.5k 150k | kind stringclasses 1
value |
|---|---|
# Building Simple Neural Networks
In this section you will:
* Import the MNIST dataset from Keras.
* Format the data so it can be used by a Sequential model with Dense layers.
* Split the dataset into training and test sections data.
* Build a simple neural network using Keras Sequential model and Dense layers.
* Tra... | github_jupyter |
```
# default_exp ratio
```
> The email portion of this campaign was actually run as an A/B test. Half the emails sent out were generic upsells to your product while the other half contained personalized messaging around the users’ usage of the site.
这是 AB Test 的实验内容。
```
import pandas as pd
import matplotlib.pyplot... | github_jupyter |
```
import os
import glob
import zipfile
import pathlib
import cv2
import math
import random
import shutil
import skimage as sk
import pandas as pd
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from sklearn.model_selection import train_test_split
from skle... | github_jupyter |
```
from google.colab import drive
drive.mount('/content/gdrive')
import pandas as pd
import numpy as np
import csv
#DATA_FOLDER = '/content/gdrive/My Drive/101/results/logreg/'
subfolders = []
for a in range(1,7):
for b in range(6,0,-1):
subfolders.append('+1e-0'+str(a)+'_+1e-0'+str(b))
classifiers = ['... | github_jupyter |
By now basically everyone ([here](http://datacolada.org/2014/06/04/23-ceiling-effects-and-replications/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+DataColada+%28Data+Colada+Feed%29), [here](http://yorl.tumblr.com/post/87428392426/ceiling-effects), [here](http://www.talyarkoni.org/blog/2014/06/01/there-i... | github_jupyter |
<a href="https://colab.research.google.com/github/chiranjeet14/ML_Journey/blob/master/Hackerearth-Predict_condition_and_insurance_amount/train_models.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
```
!pip3 install xgboost > /dev/null
import pandas... | github_jupyter |
# Build a Traffic Sign Recognition Classifier Deep Learning
Some improvements are taken :
- [x] Adding of convolution networks at the same size of previous layer, to get 1x1 layer
- [x] Activation function use 'ReLU' instead of 'tanh'
- [x] Adaptative learning rate, so learning rate is decayed along to training phase
... | github_jupyter |
```
import escher
import escher.urls
import cobra
import cobra.test
import json
import os
from IPython.display import HTML
from copy import deepcopy
d = escher.urls.root_directory
print('Escher directory: %s' % d)
```
### Embed an Escher map in an IPython notebook
```
escher.list_available_maps()
b = escher.Builder(m... | github_jupyter |
```
x =2
r = lambda x:x**2
r(x)
r1 = lambda x:x**2 if x>3 else None
r1(x)
r1(5)
#object
#using class keyword
#creating the attributes
#creating the methods in class
#learning about inheritence in python
#learning about polymorphism
lt = [1,2,3,4]
lt.count(4)
print(type(1))
print(type([]))
print(type(()))
print(type({}... | github_jupyter |
# Simulating Grover's Search Algorithm with 2 Qubits
```
import numpy as np
from matplotlib import pyplot as plt
%matplotlib inline
```
Define the zero and one vectors
Define the initial state $\psi$
```
zero = np.matrix([[1],[0]]);
one = np.matrix([[0],[1]]);
psi = np.kron(zero,zero);
print(psi)
```
Define the ga... | github_jupyter |
<table class="ee-notebook-buttons" align="left">
<td><a target="_blank" href="https://github.com/giswqs/earthengine-py-notebooks/tree/master/Visualization/image_color_ramp.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td>
<td><a target="_blank... | github_jupyter |
# Ingeniería de Características
En las clases previas vimos las ideas fundamentales de machine learning, pero todos los ejemplos asumían que ya teníamos los datos numéricos en un formato ordenado de tamaño ``[n_samples, n_features]``.
En la realidad son raras las ocasiones en que los datos vienen así, _llegar y llevar... | github_jupyter |
# Pre-training VGG16 for Distillation
```
import torch
import torch.nn as nn
from src.data.dataset import get_dataloader
import torchvision.transforms as transforms
import numpy as np
import matplotlib.pyplot as plt
DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu")
print(DEVICE)
SEED = 0
BATCH... | github_jupyter |
# _Mini Program - Working with SQLLite DB using Python_
### <font color=green>Objective -</font>
<font color=blue>1. This program gives an idea how to connect with SQLLite DB using Python and perform data manipulation </font><br>
<font color=blue>2. There are 2 ways in which tables are create below to help you unders... | github_jupyter |
<a href="https://colab.research.google.com/github/AngieCat26/MujeresDigitales/blob/main/TALLER1.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
**PUNTO 2 **
```
premio1 = "Viaje todo incluído para dos personas a San Andrés"
premio2 = "una pasadía a... | github_jupyter |
# Tutorial
#### This tutorial will introduce you to the *fifa_preprocessing*'s functionality!
In general, the following functions will alow you to preprocess your data to be able to perform machine learning or statistical data analysis by reformatting, casting or deleting certain values.
The data used in these example... | github_jupyter |
# Bias
### Goals
In this notebook, you're going to explore a way to identify some biases of a GAN using a classifier, in a way that's well-suited for attempting to make a model independent of an input. Note that not all biases are as obvious as the ones you will see here.
### Learning Objectives
1. Be able to distin... | github_jupyter |
# Neural network hybrid recommendation system on Google Analytics data model and training
This notebook demonstrates how to implement a hybrid recommendation system using a neural network to combine content-based and collaborative filtering recommendation models using Google Analytics data. We are going to use the lea... | github_jupyter |
```
from fastai import *
from fastai.vision import *
from fastai.metrics import error_rate
import matplotlib.pyplot as plt
from fastai.utils.mem import *
%matplotlib inline
```
###### Setting the path
```
path = Path("C:/Users/shahi/.fastai/data/lgg-mri-segmentation/kaggle_3m")
path
getMask = lambda x: x.parents[0] /... | github_jupyter |
# Supervised Learning: Finding Donors for *CharityML*
> Udacity Machine Learning Engineer Nanodegree: _Project 2_
>
> Author: _Ke Zhang_
>
> Submission Date: _2017-04-30_ (Revision 3)
## Content
- [Getting Started](#Getting-Started)
- [Exploring the Data](#Exploring-the-Data)
- [Preparing the Data](#Preparing-the-Da... | github_jupyter |
# Structural Transformation Notes
Below some brief notes on general equilibrium modeling of structural transformation. Some of the presentation illustrates and expands upon this short useful survey:
> Matsuyama, K., 2008. Structural change. in Durlauf and Blume eds. *The new Palgrave dictionary of economics* 2, pp.
... | github_jupyter |
# Feature Extraction
In machine learning, feature extraction aims to compute values (features) from images, intended to be informative and non-redundant, facilitating the subsequent learning and generalization steps, and in some cases leading to better human interpretations. These features may be handcrafted (manually ... | github_jupyter |
# Imports
```
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn import ensemble
from sklearn import metrics
from io import StringIO
from csv import writer
```
# Read in csv files
```
matches = pd.read_csv('../csv/matches.csv')
players = pd.read_csv('../csv/players.csv')
hero_names =... | github_jupyter |
```
data = pd.read_csv("/Users/kimjeongseob/Desktop/Study/0.Project/3. Machine Learning Practice/2. Football/dataset_football.csv")
data = data.drop(columns = 'Unnamed: 0')
data_origin = data.copy()
data
data.follower = data.follower + 10
data.follower = np.log(data.follower)
# data = data.drop(columns='player_name')
c... | github_jupyter |
<a href="https://colab.research.google.com/github/Skantastico/DS-Unit-2-Applied-Modeling/blob/master/LS_DSPT3_231_Updated_assignment_applied_modeling_1.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
Lambda School Data Science
*Unit 2, Sprint 3, Mo... | github_jupyter |
## Day 5: Optimal Mind Control
Welcome to Day 6! Now that we can simulate a model network of conductance-based neurons, we discuss the limitations of our approach and attempts to work around these issues.
### Memory Management
Using Python and TensorFlow allowed us to write code that is readable, parallizable and sc... | github_jupyter |
```
%matplotlib inline
```
Using $L_0$ regularization in predicting genetic risk
====================================
The main aim of this document is to outline the code and theory of using the $L_0$ norm in a regularized regression with the objective to predict disease risk from genetic data.
This document contain... | github_jupyter |
### Regular Expressions
Regular expressions are `text matching patterns` described with a formal syntax. You'll often hear regular expressions referred to as 'regex' or 'regexp' in conversation. Regular expressions can include a variety of rules, for finding repetition, to text-matching, and much more. As you advance ... | github_jupyter |
You will scrape this <a href="https://sandeepmj.github.io/scrape-example-page/homework-site.html">mockup site</a> that lists a few data points for addiction centers.
```
pip install icecream
## import library(ies)
import requests
from bs4 import BeautifulSoup
import pandas as pd
from icecream import ic
## capture the ... | github_jupyter |
---
_You are currently looking at **version 1.1** of this notebook. To download notebooks and datafiles, as well as get help on Jupyter notebooks in the Coursera platform, visit the [Jupyter Notebook FAQ](https://www.coursera.org/learn/python-data-analysis/resources/0dhYG) course resource._
---
# Assignment 2 - Pand... | github_jupyter |
```
car="car1.jpeg"
import cv2
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
car1=mpimg.imread('car1.jpeg')
car1.shape
type(car1)
plt.imshow(car1)
#plt.imshow(car)
car1_cv2=cv2.imread('car1.jpeg')
color_car_cv2=cv2.cvtColor(car1_cv2, cv2.COLOR_BGR2RGB)
plt.imshow(color_car_cv2)
car... | github_jupyter |
```
pip install nltk
import nltk
import string
import re
texto_original = """Algoritmos inteligentes de aprendizados correndo supervisionados utilizam dados coletados. A partir dos dados coletados, um conjunto de característica é extraído. As características podem ser estruturais ou estatísticas. Correr correste corrid... | github_jupyter |
# Was Air Quality Affected in Countries or Regions Where COVID-19 was Most Prevalent?
**By: Arpit Jain, Maria Stella Vardanega, Tingting Cao, Christopher Chang, Mona Ma, Fusu Luo**
---
## Outline
#### I. Problem Definition & Data Source Description
1. Project Objectives
2. Data Source
3. Datase... | github_jupyter |
```
import numpy as np
import pandas as pd
import seaborn as sns
```
## Basics
- All values of a categorical valiable are either in `categories` or `np.nan`.
- Order is defined by the order of `categories`, not the lexical order of the values.
- Internally, the data structure consists of a `categories` array and an... | github_jupyter |
# Tensorflow Timeline Analysis on Model Zoo Benchmark between Intel optimized and stock Tensorflow
This jupyter notebook will help you evaluate performance benefits from Intel-optimized Tensorflow on the level of Tensorflow operations via several pre-trained models from Intel Model Zoo. The notebook will show users a... | github_jupyter |
The data is from a number of patients. The 12 first columns (age, an, ..., time) are features that should be used to predict the outcome in the last column (DEATH_EVENT).
```
# Loading some functionality you might find useful. You might want other than this...
import pandas as pd
import numpy as np
import matplotlib.p... | github_jupyter |
<img src="../../img/logo_amds.png" alt="Logo" style="width: 128px;"/>
# AmsterdamUMCdb - Freely Accessible ICU Database
version 1.0.2 March 2020
Copyright © 2003-2020 Amsterdam UMC - Amsterdam Medical Data Science
# Vasopressors and inotropes
Shows medication for artificially increasing blood pressure (vasopr... | github_jupyter |
<a href="https://colab.research.google.com/github/EvenSol/NeqSim-Colab/blob/master/notebooks/process/masstransferMeOH.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
```
#@title Calculation of mass transfer and hydrate inhibition of a wet gas by inj... | github_jupyter |
# Amazon Forecast: predicting time-series at scale
Forecasting is used in a variety of applications and business use cases: For example, retailers need to forecast the sales of their products to decide how much stock they need by location, Manufacturers need to estimate the number of parts required at their factories ... | github_jupyter |
# Census aggregation scratchpad
By [Ben Welsh](https://palewi.re/who-is-ben-welsh/)
```
import math
```
### Approximation


```
males_und... | github_jupyter |
```
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | github_jupyter |
# Project: Linear Regression
Reggie is a mad scientist who has been hired by the local fast food joint to build their newest ball pit in the play area. As such, he is working on researching the bounciness of different balls so as to optimize the pit. He is running an experiment to bounce different sizes of bouncy ball... | github_jupyter |
# Practical Examples of Interactive Visualizations in JupyterLab with Pixi.js and Jupyter Widgets
# PyData Berlin 2018 - 2018-07-08
# Jeremy Tuloup
# [@jtpio](https://twitter.com/jtpio)
# [github.com/jtpio](https://github.com/jtpio)
# [jtp.io](https://jtp.io)

# The Python Visualization Lan... | github_jupyter |
# Regressão linear
## **TOC:**
Na aula de hoje, vamos explorar os seguintes tópicos em Python:
- 1) [Introdução](#intro)
- 2) [Regressão linear simples](#reglinear)
- 3) [Regressão linear múltipla](#multireglinear)
- 4) [Tradeoff viés-variância](#tradeoff)
```
# importe as principais bibliotecas de análise de dado... | github_jupyter |
```
from oda_api.api import DispatcherAPI
from oda_api.plot_tools import OdaImage,OdaLightCurve
from oda_api.data_products import BinaryData
import os
from astropy.io import fits
import numpy as np
from numpy import sqrt
import matplotlib.pyplot as plt
%matplotlib inline
source_name='3C 279'
ra=194.046527
dec=-5.789314... | github_jupyter |
# Table of Contents
<p><div class="lev1 toc-item"><a href="#Lambda-calcul-implémenté-en-OCaml" data-toc-modified-id="Lambda-calcul-implémenté-en-OCaml-1"><span class="toc-item-num">1 </span>Lambda-calcul implémenté en OCaml</a></div><div class="lev2 toc-item"><a href="#Expressions" data-toc-modified-id="Exp... | github_jupyter |
<h1>Table of Contents<span class="tocSkip"></span></h1>
<div class="toc"><ul class="toc-item"><li><span><a href="#Dimensionality-Reduction" data-toc-modified-id="Dimensionality-Reduction-1"><span class="toc-item-num">1 </span>Dimensionality Reduction</a></span><ul class="toc-item"><li><span><a href="#The-Pro... | github_jupyter |
## 용어 정의
```
#가설설정
# A hypothesis test is a statistical method that uses sample data to evaluate a hypothesis about a population.
1. First, we state a hypothesis about a population. Usually the hypothesis concerns the value of a population parameter.
2. Before we select a sample, we use the hypothesis to predict the... | github_jupyter |
Source: https://qiskit.org/documentation/tutorials/circuits/01_circuit_basics.html
## Circuit Basics
```
import numpy as np
from qiskit import QuantumCircuit
%matplotlib inline
```
Create a Quantum Circuit acting on a quantum register of three qubits
```
circ = QuantumCircuit(3)
```
After you create the circuit w... | github_jupyter |
# Linear algebra
```
import numpy as np
np.__version__
```
## Matrix and vector products
Q1. Predict the results of the following code.
```
import numpy as np
x = [1,2]
y = [[4, 1], [2, 2]]
print np.dot(x, y)
print np.dot(y, x)
print np.matmul(x, y)
print np.inner(x, y)
print np.inner(y, x)
```
Q2. Predict the res... | github_jupyter |
# 自然语言处理实战——命名实体识别
### 进入ModelArts
点击如下链接:https://www.huaweicloud.com/product/modelarts.html , 进入ModelArts主页。点击“立即使用”按钮,输入用户名和密码登录,进入ModelArts使用页面。
### 创建ModelArts notebook
下面,我们在ModelArts中创建一个notebook开发环境,ModelArts notebook提供网页版的Python开发环境,可以方便的编写、运行代码,并查看运行结果。
第一步:在ModelArts服务主界面依次点击“开发环境”、“创建”
, here are 100* short puzzles for testing your knowledge of [pandas'](http://pandas.pydata.org/) power.
Since pandas is a large library with many different specialist features and functions, these excercises focus mainly on the... | github_jupyter |
```
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from sklearn import linear_model
import statsmodels.api as sm
from sqlalchemy import create_engine
# Display preferences.
%matplotlib inline
pd.options.display.float_format = '{:.3f}'.format
import warnings
warnings.filterwarnings(action="igno... | github_jupyter |
```
import matplotlib.pyplot as plt
import numpy as np
from mvmm.single_view.gaussian_mixture import GaussianMixture
from mvmm.single_view.MMGridSearch import MMGridSearch
from mvmm.single_view.toy_data import sample_1d_gmm
from mvmm.single_view.sim_1d_utils import plot_est_params
from mvmm.viz_utils import plot_scat... | github_jupyter |
```
%matplotlib inline
import seaborn as sns
sns.set()
tips = sns.load_dataset("tips")
sns.relplot(x="total_bill", y="tip", col="time",
hue="smoker", style="smoker", size="size",
data=tips);
```
```
import seaborn as sns
```
```
sns.set()
```
```
tips = sns.load_dataset("tips")
```
```
sns.r... | github_jupyter |
# <img style="float: left; padding-right: 10px; width: 45px" src="https://raw.githubusercontent.com/Harvard-IACS/2018-CS109A/master/content/styles/iacs.png"> CS-109B Introduction to Data Science
## Lab 5: Convolutional Neural Networks
**Harvard University**<br>
**Spring 2019**<br>
**Lab instructor:** Eleni Kaxiras<br>... | github_jupyter |
# Pragmatic color describers
```
__author__ = "Christopher Potts"
__version__ = "CS224u, Stanford, Spring 2020"
```
## Contents
1. [Overview](#Overview)
1. [Set-up](#Set-up)
1. [The corpus](#The-corpus)
1. [Corpus reader](#Corpus-reader)
1. [ColorsCorpusExample instances](#ColorsCorpusExample-instances)
1. [... | github_jupyter |
```
# Simple Optimal Growth Model for Disrete DP
# making a class which prepares the instances for DiscreteDP
import numpy as np
class SimpleOG(object):
def __init__(self, B = 10, M = 5 , alpha = 0.5, beta = 0.9):
self.B ,self.M ,self.alpha, self.beta = B,M,alpha,beta
self.n = B+M+1... | github_jupyter |
```
# Ipython magic
%pylab inline
```
## Introduction
In the `numpy` package the terminology used for vectors, matrices and higher-dimensional data sets is *array*.
## Creating `numpy` arrays
There are a number of ways to initialize new numpy arrays, for example from
* a Python list or tuples
* using functions tha... | github_jupyter |
Uploading an image with graphical annotations stored in a CSV file
======================
We'll be using standard python tools to parse CSV and create an XML document describing cell nuclei for BisQue
Make sure you have bisque api installed:
> pip install bisque-api
```
import os
import csv
from datetime import date... | github_jupyter |
```
import pandas as pd
import json
import numpy as np
from cleaner import *
# df_train = read_json('./processed_data/preprocess_train.json')
# df_dev = read_json('./processed_data/preprocess_my_dev.json')
# df_test = read_json('./processed_data/preprocess_eval.json')
df_train = read_json('./original_data/train.json')
... | github_jupyter |
Copyright © 2017-2021 ABBYY Production LLC
```
#@title
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | github_jupyter |
```
import sys
sys.path.append('../src')
import common.config as cfg
from common.nb_utils import estimate_optimal_ncomponents, pca_transform
from common.utils import get_device, Struct
from data.loader import get_testloader, get_trainloader
import matplotlib.pyplot as plt
from models.fcn import FCN
from models.resnet i... | github_jupyter |
```
lat = 40.229730557967
lon = -74.002934930983
profile = [
{
"key": "natural",
"value": "beach",
"distance_within": 15,
"type": "bicycle",
"weight": 20
},
{
"key": "name",
"value": "Newark Penn Station",
"distance_within": 60,
"type"... | github_jupyter |
## Dependencies
```
import os
import sys
import cv2
import shutil
import random
import warnings
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from tensorflow import set_random_seed
from sklearn.utils import class_weight
from sklearn.model_selection import train_test_split... | github_jupyter |
# Exp 43 analysis
See `./informercial/Makefile` for experimental
details.
```
import os
import numpy as np
from IPython.display import Image
import matplotlib
import matplotlib.pyplot as plt`
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
import seaborn as sns
sns.set_style('ticks')
matplotlib.... | github_jupyter |
```
!pip install wandb
!wandb login
from collections import deque
import random
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision.transforms as transforms
import gym
import wandb
class Actor(nn.Module):
def __init__(self, num_actions):
super().__ini... | github_jupyter |
Lambda School Data Science
*Unit 2, Sprint 2, Module 1*
---
# Decision Trees
## Assignment
- [ ] [Sign up for a Kaggle account](https://www.kaggle.com/), if you don’t already have one. Go to our Kaggle InClass competition website. You will be given the URL in Slack. Go to the Rules page. Accept the rules of the com... | github_jupyter |
```
import pandas as pd
import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
from os import listdir
from keras.preprocessing import sequence
import tensorflow as tf
from keras.models import Sequential, Model
from keras.layers import Dense, Conv1D, Input, Concatenate, GlobalMaxPooling1D, ConvLSTM2D
from... | github_jupyter |
```
# Importing some python libraries.
import numpy as np
from numpy.random import randn,rand
import matplotlib.pyplot as pl
from matplotlib.pyplot import plot
import seaborn as sns
%matplotlib inline
# Fixing figure sizes
from pylab import rcParams
rcParams['figure.figsize'] = 10,5
sns.set_palette('Reds_r')
```
... | github_jupyter |
##### Copyright 2018 The TensorFlow Authors.
```
#@title Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | github_jupyter |
## Gambling 101
You are participating in a lottery game. A deck of cards numbered from 1-50 is shuffled and 5 cards are drawn out and laid out. You are given a coin. For each card, you toss the coin and pick it up if it says heads, otherwise you don't pick it up. The sum of the cards is what you win.
The lottery ticke... | github_jupyter |
# Ensemble Learning
## Initial Imports
```
import warnings
warnings.filterwarnings('ignore')
import numpy as np
import pandas as pd
from pathlib import Path
from collections import Counter
from sklearn.metrics import balanced_accuracy_score
from sklearn.metrics import confusion_matrix
from imblearn.metrics import cla... | github_jupyter |
# Codenation - Data Science
<pre>Autor: Leonardo Simões</pre>
## Desafio 7 - Descubra as melhores notas de matemática do ENEM 2016
Você deverá criar um modelo para prever a nota da prova de matemática de quem participou do ENEM 2016. Para isso, usará Python, Pandas, Sklearn e Regression.
### Detalhes
O contexto do ... | github_jupyter |
## Introduction
If you've had any experience with the python scientific stack, you've probably come into contact with, or at least heard of, the [pandas][1] data analysis library. Before the introduction of pandas, if you were to ask anyone what language to learn as a budding data scientist, most would've likely said ... | github_jupyter |
# Interpreting Tree Models
You'll need to install the `treeinterpreter` library.
```
# !pip install treeinterpreter
import sklearn
import tensorflow as tf
import numpy as np
import pandas as pd
from sklearn.datasets import fetch_california_housing
from sklearn.model_selection import train_test_split
from sklearn.tre... | github_jupyter |
```
# Load WSC dataset
import xml.etree.ElementTree as etree
import json
import numpy as np
import logging
import numpy
import os
def softmax(x):
return np.exp(x)/sum(np.exp(x))
tree = etree.parse('WSCollection.xml')
root = tree.getroot()
original_problems = root.getchildren()
problems = list()
for original_pr... | github_jupyter |
## Analyze A/B Test Results
You may either submit your notebook through the workspace here, or you may work from your local machine and submit through the next page. Either way assure that your code passes the project [RUBRIC](https://review.udacity.com/#!/projects/37e27304-ad47-4eb0-a1ab-8c12f60e43d0/rubric). **Ple... | github_jupyter |
# Standalone Convergence Checker for the numerical vKdV solver
Copied from Standalone Convergence Checker for the numerical KdV solver - just add bathy
Does not save or require any input data
```
import xarray as xr
from iwaves.kdv.kdvimex import KdVImEx#from_netcdf
from iwaves.kdv.vkdv import vKdV
from iwaves.kdv.... | github_jupyter |
## Random Forest Classification
### Random Forest
#### The fundamental idea behind a random forest is to combine many decision trees into a single model. Individually, predictions made by decision trees (or humans) may not be accurate, but combined together, the predictions will be closer to the mark on average.
###... | github_jupyter |
<a href="https://colab.research.google.com/github/thingumajig/colab-experiments/blob/master/RetinaNet_Video_Object_Detection.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# .init
## setup keras-retinanet
```
!git clone https://github.com/fizyr/k... | github_jupyter |
# Project: Part of Speech Tagging with Hidden Markov Models
---
### Introduction
Part of speech tagging is the process of determining the syntactic category of a word from the words in its surrounding context. It is often used to help disambiguate natural language phrases because it can be done quickly with high accu... | github_jupyter |
# Pos-Tagging & Feature Extraction
Following normalisation, we can now proceed to the process of pos-tagging and feature extraction. Let's start with pos-tagging.
## POS-tagging
Part-of-speech tagging is one of the most important text analysis tasks used to classify words into their part-of-speech and label them accor... | github_jupyter |
```
from IPython.display import Image
```
# CNTK 201B: Hands On Labs Image Recognition
This hands-on lab shows how to implement image recognition task using [convolution network][] with CNTK v2 Python API. You will start with a basic feedforward CNN architecture in order to classify Cifar dataset, then you will keep ... | github_jupyter |
# Objective
* 20190815:
* Given stock returns for the last N days, we do prediction for the next N+H days, where H is the forecast horizon
* We use double exponential smoothing to predict
```
%matplotlib inline
import math
import matplotlib
import numpy as np
import pandas as pd
import seaborn as sns
import t... | github_jupyter |
# Developing an AI application
Going forward, AI algorithms will be incorporated into more and more everyday applications. For example, you might want to include an image classifier in a smart phone app. To do this, you'd use a deep learning model trained on hundreds of thousands of images as part of the overall appli... | github_jupyter |
# 스파크를 이용한 기본 지표 생성 예제
> 기본 지표를 생성하는 데에 있어, 정해진 틀을 그대로 따라하기 보다, 가장 직관적인 방법을 지속적으로 개선하는 과정을 설명하기 위한 예제입니다.
첫 번째 예제인 만큼 지표의 복잡도를 줄이기 위해 해당 서비스를 오픈 일자는 2020/10/25 이며, 지표를 집계하는 시점은 2020/10/26 일 입니다
* 원본 데이터를 그대로 읽는 방법
* dataframe api 를 이용하는 방법
* spark.sql 을 이용하는 방법
* 기본 지표 (DAU, PU)를 추출하는 예제 실습
* 날짜에 대한 필터를 넣는 방법
* 날짜에 대... | github_jupyter |
## AI for Medicine Course 1 Week 1 lecture exercises
<a name="counting-labels"></a>
# Counting labels
As you saw in the lecture videos, one way to avoid having class imbalance impact the loss function is to weight the losses differently. To choose the weights, you first need to calculate the class frequencies.
For ... | github_jupyter |
```
import psycopg2
import pandas as pd
import pandas.io.sql as pd_sql
import numpy as np
import matplotlib.pyplot as plt
def connectDB(DB):
# connect to the PostgreSQL server
return psycopg2.connect(
database=DB,
user="postgres",
password="Georgetown16",
host="database-1.c5vispb... | github_jupyter |
```
# Import the modules
import numpy as np
import pandas as pd
from pathlib import Path
from sklearn.metrics import balanced_accuracy_score
from sklearn.metrics import confusion_matrix
from imblearn.metrics import classification_report_imbalanced
import warnings
warnings.filterwarnings('ignore')
```
---
```
# Read ... | github_jupyter |
# Introduction à Python
> présentée par Loïc Messal
## Introduction aux flux de contrôles
### Les tests
Ils permettent d'exécuter des déclarations sous certaines conditions.
```
age = 17
if age < 18:
print("Mineur") # executé si et seulement si la condition est vraie
age = 19
if age < 18:
print("Mineur") ... | github_jupyter |
## Logistic Regression
```
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split,KFold
from sklearn.utils import shuffle
from sklearn.metrics import confusion_matrix,accuracy_score,precision_score,\
recall_score,roc_curve,auc
import expectation_reflection as ER
from sklearn.line... | github_jupyter |
```
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split
%matplotlib inline
pd.set_option('display.max_columns', None)
pd.set_option('display.max_rows', 1000)
```
# Importaçã... | github_jupyter |
```
# Note: restart runtime after this import before running the augmentations
!pip install -U augly
!sudo apt-get install python3-magic
import os
import augly.image as imaugs
import augly.utils as utils
from IPython.display import display
# Get input image, scale it down to avoid taking up the whole screen
input_img_... | github_jupyter |
# Introduction
Linear Regression is one of the most famous and widely used machine learning algorithms out there. It assumes that the target variable can be explained as a linear combination of the input features. What does this mean? It means that the target can be viewed as a weighted sum of each feature. Let’s use ... | github_jupyter |
######The Iris flower data set is a multivariate data set introduced by the British statistician and biologist Ronald Fisher in his 1936 paper The use of multiple measurements in taxonomic problems. The dataset consists of 50 samples from each of three species of Iris (Iris Setosa, Iris virginica, and Iris versicolor).... | github_jupyter |
```
import pandas as pd
from pathlib import Path
import yfinance as yf
import numpy as np
import csv
import matplotlib.pyplot as plt
import warnings
warnings.filterwarnings('ignore')
df_50 = pd.read_csv(
Path("./Data/QM_50.csv")
)
tickers = list(df_50["Tickers"])
historical = yf.Ticker("PWR").history(period="2y")
p... | github_jupyter |
```
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from time import strftime
import os
%matplotlib inline
"""
Función que genera los mapas de temperatura mínima
"""
#%% fecha del pronostico
fechaPronostico = strftime("%Y-%m-%d")
variables = ["Rain","Tmax","Tmin","Tpro","Hr","Hrmin","Hrmax"]
LAT... | github_jupyter |
```
%load_ext autoreload
%autoreload 2
import pathlib
import IPython.display
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import scipy.interpolate
import scipy.signal
import pymedphys
import pymedphys._wlutz.iview
indexed_dir = pathlib.Path(r'S:\DataExchange\iViewDB_decoded\indexed')
movie... | github_jupyter |
```
import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import make_blobs
from sklearn.model_selection import train_test_split
X, y = make_blobs(n_samples = 100, centers = 2, random_state = 42)
# Splitting the data for training and testing
X_train, X_test, y_train, y_test = train_test_split(X, y, ... | github_jupyter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.