code stringlengths 2.5k 150k | kind stringclasses 1
value |
|---|---|
### In this lab, we will implement Linear Regression using Least-square Solution. We will use the same example as we did in the class (Slide 18 from the linear regression slides). There are 5 steps. Let's implement them using only numpy step by step.

```
import numpy as np
```
We... | github_jupyter |
<a href="https://colab.research.google.com/github/grzegorzkwolek/DS-Unit-1-Sprint-1-Dealing-With-Data/blob/master/GKwolek_3rd_assignment_LS_DS_113_Making_Data_backed_Assertions_Assignment.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Lambda Scho... | github_jupyter |
# Convolutional Neural Networks: Step by Step
Welcome to Course 4's first assignment! In this assignment, you will implement convolutional (CONV) and pooling (POOL) layers in numpy, including both forward propagation and (optionally) backward propagation.
**Notation**:
- Superscript $[l]$ denotes an object of the $l... | github_jupyter |
# Ciência de dados - Unidade 3
*Por: Débora Azevedo, Eliseu Jayro, Francisco de Paiva e Igor Brandão*
### Objetivos
O objetivo desse projeto é explorar os [datasets da UFRN](http://dados.ufrn.br/group/despesas-e-orcamento) contendo informações sobre requisições de material, requisições de manutenção e empenhos sob o... | github_jupyter |
# Deconvolution Tutorial
## Introduction
There are several problems with the standard initialization performed in the [Quickstart Guide](../0-quickstart.ipynb):
1. The models exist in a frame with a narrow model PSF while the the observed scene will have a much wider PSF. So the initial models will be spread out ove... | github_jupyter |
# Fast GP implementations
```
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
from matplotlib import rcParams
rcParams["figure.dpi"] = 100
rcParams["figure.figsize"] = 12, 4
```
## Benchmarking GP codes
Implemented the right way, GPs can be super fast! Let's compare the time it takes to evaluate our... | github_jupyter |
# Introduction: Prediction Engineering: Labeling Historical Examples
In this notebook, we will develop a method for labeling customer transactions data for a customer churn prediction problem. The objective of labeling is to create a set of historical examples of what we want to predict based on the business need: in ... | github_jupyter |
## Reference
Data Camp course
## Course Description
* A typical organization loses an estimated 5% of its yearly revenue to fraud.
* Apply supervised learning algorithms to detect fraudulent behavior similar to past ones,as well as unsupervised learning methods to discover new types of fraud activities.
* Deal with ... | github_jupyter |
<a href="https://colab.research.google.com/github/tensorflow/tpu/blob/master/tools/colab/profiling_tpus_in_colab.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
##### Copyright 2018 The TensorFlow Hub Authors.
Copyright 2019-2020 Google LLC
Licens... | github_jupyter |
# Deep learning hands-on


## What frameworks do
- Tensor math
- Common network operations/layers
- Gradient of common operations
- Backpropagation
- Optimizer
- GPU implementation of the above
- usally: data loading, serialization (saving/loading) of models
... | github_jupyter |
```
from typing import List, Union
import numpy as np
```
# Lasso just adds L1 regularization

```
class LinRegLasso:
def _init(self, n_feat: int) -> None:
self.weights = np.ones((n_feat + 1)) # (n_feat + 1,) weights + bias
def predict(self, feature_vector: U... | github_jupyter |
# Newton's Method for Logistic Regression - The Math of Intelligence (Week 2)

## Our Task
We're going to compute the probability that someone has Diabetes given their height, weight, and blood pressure. We'll generate t... | github_jupyter |
# Variables and data types
Variables are used to temporarily store a value in the computer's memory. We can then use it later, when we need it in the program. We can compare that to a small box in which we could store information.
Since Python is a dynamically typed language, Python values, not variables, carry type.... | github_jupyter |
```
!pip install /home/knikaido/work/Cornell-Birdcall-Identification/data/resnest50-fast-package/resnest-0.0.6b20200701/resnest/
!pip install torch==1.4.0
!pip install opencv-python
!pip install slackweb
!pip install torchvision==0.2.2
!pip install torch_summary
from pathlib import Path
import numpy as np
import pandas... | github_jupyter |
# TF-IDF
```
import mwdsbe
import mwdsbe.datasets.licenses as licenses
import schuylkill as skool
import pandas as pd
import numpy as np
# import registry
registry = mwdsbe.load_registry() # geopandas df
registry.head()
# import license data
license = licenses.CommercialActivityLicenses.download()
license.head()
mini_... | github_jupyter |
# Generating percentiles for TensorFlow model input features
The current TensorFlow model uses histogram-like percentile features, which are kind of a continuous version of one-hot features.
For example, if key cutoff points are `[-3, 1, 0, 2, 10]`, we might encode a value `x` as `sigma((x - cutoff) / scale)`. If `si... | github_jupyter |
`BcForms` is a toolkit for concretely describing the primary structure of macromolecular complexes, including non-canonical monomeric forms and intra and inter-subunit crosslinks. `BcForms` includes a textual grammar for describing complexes and a Python library, a command line program, and a REST API for validating an... | github_jupyter |
##### Copyright 2018 The AdaNet 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 agre... | github_jupyter |
## Data Procesing
```
import pandas as pd
import h2o
from h2o.estimators.random_forest import H2ORandomForestEstimator
h2o.init()
%%time
train_new = pd.read_csv("D:\\DC Universe\\Ucsc\\Third Year\\ENH 3201 Industrial Placements\\H20 Applications\\H20 ML Notebooks\\H20Csv\\Titanic\\titanic_train.csv")
test = pd.read_cs... | github_jupyter |
# MNIST Classification with CNN -- Customized training loops --
In this notebook, I describe how to implement CNN using tf.keras.
Training loop is defined by customized step-by-step training loops.
```
import tensorflow as tf
import time
import numpy as np
import sklearn
from sklearn.model_selection import train_test_... | github_jupyter |
```
import pandas as pd
import numpy as np
import datetime as datetime
#read in last_played_wars csv
last_played_wars = pd.read_csv("updated_last_played_wars.csv")
# last_played_wars["Participation"] = last_played_wars["Joined Wars"] / last_played_wars["Total Wars"]
last_played_wars = last_played_wars[["Name", "Tag"... | github_jupyter |
```
import os
import re
import collections
import copy
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
from IPython.display import clear_output
from random import sample
import dlnlputils
from dlnlputils.data import tokenize_corpus, build_vocabulary
import torch
device = torch.device("cuda:0" ... | github_jupyter |
# "Thresholding"
# Recap
This is the Lab on Thresholding for Classical Image Segmention in CE6003. You should complete the tasks in this lab as part of the Thresholding section of the lesson.
Please remember this lab must be completed before taking the quiz at the end of this lesson.
First, if we haven't already ... | github_jupyter |
# Week 1 Assignment: Housing Prices
In this exercise you'll try to build a neural network that predicts the price of a house according to a simple formula.
Imagine that house pricing is as easy as:
A house has a base cost of 50k, and every additional bedroom adds a cost of 50k. This will make a 1 bedroom house cost ... | github_jupyter |
# Handwritten Number Recognition with TFLearn and MNIST
In this notebook, we'll be building a neural network that recognizes handwritten numbers 0-9.
This kind of neural network is used in a variety of real-world applications including: recognizing phone numbers and sorting postal mail by address. To build the netwo... | github_jupyter |
# Pandas
```
import numpy as np
import pandas as pd
```
Pandas提供了3种数据类型,分别是`Series`、`DataFrame`和`Panel`。
* `Series`用于保存一维数据
* `DataFrame` 用于保存二维数据
* `Panel`用于保存三维或者可变维数据
## Series数据结构
`Series`本质上是一个带索引的一维数组。
指定索引:
```
s = pd.Series([1,3,2,4], index=['a', 'b', 'c', 'd'])
s.index
s.values
```
默认索引:
```
s = pd.Se... | github_jupyter |
```
from numpy.random import Generator
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import random
from scipy.optimize import minimize
from scipy.stats import gaussian_kde
from scipy.stats import ks_2samp
from scipy.special import rel_entr
from scipy.stats import entropy
import scipy
from opti... | github_jupyter |
## Índice
### 1 - Análise de Sentimentos: uma introdução
### 2 - Carregando os pacotes necessários
### 3 - Conectando com a API do Twitter
#### 3.1 - Autenticação
#### 3.2 - Obtendo os tweets
### 4 - Text Mining
### 5 - Manipulação de dados
#### 5.1 - Tokenização
#### 5.2 - Núvem de palavras
### 6 - Removendo as... | github_jupyter |
# Linear Discriminate Analysis (LDA)
```
import numpy as np
import matplotlib.pyplot as plt
# data generation
mean1=np.array([0,0])
mean2=np.array([4,5])
var=np.array([[1,0.1],[0.1,1]])
np.random.seed(0)
data1=np.random.multivariate_normal(mean1,var,500)
data2=np.random.multivariate_normal(mean2,var,500)
data=np.con... | github_jupyter |
## AirBnB Data anaylst
### 1. Business Understanding:
This project aims to follow the CRISP-DM to address the three questions which related to business or real-world applications. The dataset is picked up from Kaggle, contributed by AirBnB, which contains the rent data about Seattle. I would like to process whole dat... | github_jupyter |
## Import LIbraries
```
import pandas as pd
import numpy as np
```
## Loading Data
```
data = pd.read_csv( 'datasets/kc_house_data.csv' )
# Ploting data
data.head()
```
# Business questions:
## 1. How many homes are available for purchase?
```
# Counting number of lines the same number of houses
# len(data['id'].... | github_jupyter |
<img align="right" src="tf-small.png"/>
# Search from MQL
These are examples of
[MQL](https://shebanq.ancient-data.org/static/docs/MQL-Query-Guide.pdf)
queries on
[SHEBANQ](https://shebanq.ancient-data.org/hebrew/queries),
now expressed
as Text-Fabric search templates.
For more basic examples, see
[searchTutorial](... | github_jupyter |
## Question and Answer Chatbot
----
------
## Loading the Data
Using the Babi Data Set from Facebook Research.
https://research.fb.com/downloads/babi/
## Paper Reference
- Jason Weston, Antoine Bordes, Sumit Chopra, Tomas Mikolov, Alexander M. Rush,
"Towards AI-Complete Question Answering: A Set of Prerequisite... | github_jupyter |
# Monitoring Data Drift
Over time, models can become less effective at predicting accurately due to changing trends in feature data. This phenomenon is known as *data drift*, and it's important to monitor your machine learning solution to detect it so you can retrain your models if necessary.
In this lab, you'll conf... | github_jupyter |
# Scaling up ML using Cloud AI Platform
In this notebook, we take a previously developed TensorFlow model to predict taxifare rides and package it up so that it can be run in Cloud AI Platform. For now, we'll run this on a small dataset. The model that was developed is rather simplistic, and therefore, the accuracy of... | github_jupyter |
# Nanodegree Engenheiro de Machine Learning
## Aprendizado Supervisionado
## Projeto: Encontrando doadores para a *CharityML*
Seja bem-vindo ao segundo projeto do Nanodegree Engenheiro de Machine Learning! Neste notebook, você receberá alguns códigos de exemplo e será seu trabalho implementar as funcionalidades adicio... | github_jupyter |
# Going deeper with Tensorflow
In this seminar, we're going to play with [Tensorflow](https://www.tensorflow.org/) and see how it helps us build deep learning models.
If you're running this notebook outside the course environment, you'll need to install tensorflow:
* `pip install tensorflow` should install cpu-only T... | github_jupyter |
# VAE for MNIST clustering and generation
The goal of this notebook is to explore some recent works dealing with variational auto-encoder (VAE).
We will use MNIST dataset and a basic VAE architecture.
```
import os
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
from torchvision... | github_jupyter |
# Data Science Ex 00 - Preparation
23.02.2021, Lukas Kretschmar (lukas.kretschmar@ost.ch)
## Let's have some Fun with Data Science!
Welcome to Data Science.
We will use an interactive environment where you can mix text and code, with the awesome feature that you can execute the code.
## Pre-Installation
We will wo... | github_jupyter |
<h1>Table of Contents<span class="tocSkip"></span></h1>
<div class="toc"><ul class="toc-item"><li><span><a href="#My-ideia:" data-toc-modified-id="My-ideia:-1">My ideia:</a></span><ul class="toc-item"><li><span><a href="#1" data-toc-modified-id="1-1.1">1</a></span></li><li><span><a href="#2" data-toc-modified-id="2-1.2... | github_jupyter |
```
import sys
!{sys.executable} -m pip install numpy pandas matplotlib sklearn seaborn
```
### 1 - Step
**1.** Looking for missing values.
```
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
#%matplotlib inline
%matplotlib notebook
df = pd.read_csv('./winequality-red.csv')
df_missig_valu... | github_jupyter |
<h1 align="center">Diabetes Data Analysis</h1>
All information regarding the features and dataset can be found in this research arcticle:
Impact of HbA1c Measurement on Hospital Readmission Rates: Analysis of 70,000 Clinical Database Patient Records
In this project we want to know how different features affect diabet... | github_jupyter |
```
import cv2 as cv
from scipy.spatial import distance
import numpy as np
from collections import OrderedDict
```
##### Object Tracking Class
```
class Tracker:
def __init__(self, maxLost = 30): # maxLost: maximum object lost counted when the object is being tracked
self.nextObjectID = 0 ... | github_jupyter |
```
import pandas as pd
import numpy as np
from datetime import datetime
import pandas as pd
from scipy import optimize
from scipy import integrate
%matplotlib inline
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns
sns.set(style="darkgrid")
mpl.rcParams['figure.figsize'] = (16, 9)... | github_jupyter |
# Step 2: Create Job Submission Script
The next step is to create our job submission script. In the cell below, you will need to complete the job submission script and run the cell to generate the file using the magic `%%writefile` command. Your main task is to complete the following items of the script:
* Create a v... | github_jupyter |
```
import matplotlib.pyplot as plt
import os
import numpy as np
import itertools
from glob import glob
import pandas as pd
from itertools import product
import os
from annsa.model_classes import f1
from tensorflow.python.keras.models import load_model
from pandas import read_csv
from sklearn.metrics import auc
from... | github_jupyter |
# Exercises
### 9. Adjust the learning rate. Try a value of 0.02. Does it make a difference?
** Solution **
This is the simplest exercise and you have do that before.
Find the line:
optimize = tf.train.AdamOptimizer(learning_rate=0.001).minimize(mean_loss)
And change the learning_rate to 0.02.
While Ad... | github_jupyter |
<a href="https://colab.research.google.com/github/jpgill86/python-for-neuroscientists/blob/master/notebooks/02.3-The-Core-Language-of-Python.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# The Core Language of Python: Part 3
## For Loops and List... | github_jupyter |
# A glimpse into the inner working of a 2 layer Neural network
```
%load_ext autoreload
%autoreload 2
import numpy as np
from numpy import random as nprand
from cs771 import plotData as pd, utils, genSyntheticData as gsd
from keras.models import Sequential
from keras.layers import Dense as dense
from keras import opti... | github_jupyter |
<table>
<tr><td align="right" style="background-color:#ffffff;">
<img src="../images/logo.jpg" width="20%" align="right">
</td></tr>
<tr><td align="right" style="color.:#777777;background-color:#ffffff;font-size:12px;">
Prepared by Abuzer Yakaryilmaz and Maksim Dimitrijev<br>
Özlem S... | github_jupyter |
<a href="https://colab.research.google.com/github/NeuromatchAcademy/course-content/blob/master/tutorials/W3D2_DynamicNetworks/W3D2_Tutorial1.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Neuromatch Academy: Week 3, Day 2, Tutorial 1
# Neuronal ... | github_jupyter |
```
import numpy as np
import pandas as pd
yelp = pd.read_csv('https://raw.githubusercontent.com/shrikumarp/shrikumarpp1/master/yelp.csv')
yelp.head()
yelp.info()
yelp.describe()
yelp['text length'] = yelp['text'].apply(len)
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style('white')
%matplotlib inline... | 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 |
```
from keras.preprocessing import sequence
from keras.preprocessing import text
import numpy as np
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation
from keras.layers import Embedding, LSTM
from keras.layers import Conv1D, Flatten
from keras.preprocessing import text
from keras.m... | github_jupyter |
# Hierarchical Clustering
**Hierarchical clustering** refers to a class of clustering methods that seek to build a **hierarchy** of clusters, in which some clusters contain others. In this assignment, we will explore a top-down approach, recursively bipartitioning the data using k-means.
**Note to Amazon EC2 users**:... | github_jupyter |
# Choropleth Maps Exercise
Welcome to the Choropleth Maps Exercise! In this exercise we will give you some simple datasets and ask you to create Choropleth Maps from them. Due to the Nature of Plotly we can't show you examples embedded inside the notebook.
[Full Documentation Reference](https://plot.ly/python/referen... | github_jupyter |
# COMPSCI-589 HW3: Random Forest
name: Harry (Haochen) Wang
```
from evaluationmatrix import *
from utils import *
from decisiontree import *
from randomforest import *
from run import *
housedata, housecategory = importhousedata()
winedata, winecategory = importwinedata()
cancerdata, cancercategory = importcancerdat... | github_jupyter |
```
from PIL import Image
from numpy import *
from pylab import *
import scipy.misc
from scipy.cluster.vq import *
import imtools
import pickle
imlist = imtools.get_imlist('selected_fontimages/')
imnbr = len(imlist)
with open('font_pca_modes.pkl', 'rb') as f:
immean = pickle.load(f)
V = pickle.load(f)
immatrix ... | github_jupyter |
### - Canonical Correlation Analysis btw Cell painting & L1000
- This notebook focus on calculating the canonical coefficients between the canonical variables of Cell painting and L1000 level-4 profiles after applying PCA on them.
---------------------------------------------
- The aim of CCA is finding the relation... | github_jupyter |
<a href="https://colab.research.google.com/github/dmathe18/global_armed_conflict_final_repo/blob/main/Identifying_factors_contributing_to_armed_conflict_scatterplot_analyses.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
```
import pandas as pd
imp... | github_jupyter |
```
import pandas as pd
import risk_tools as rt
import numpy as np
%load_ext autoreload
%autoreload 2
%matplotlib inline
returns = pd.read_csv('data/Portfolios_Formed_on_ME_monthly_EW.csv',
header=0, index_col=0, parse_dates=True, na_values=-99.99)
returns.index = pd.to_datetime(returns.index, f... | github_jupyter |
# YOLO on PYNQ-Z1 and Movidius NCS: Webcam example
To run this notebook, you need to connect a USB webcam to the PYNQ-Z1 and a monitor to the HDMI output. You'll already need a powered USB hub for the Movidius NCS, so you should have a spare port for the webcam.
### Load required packages
```
from mvnc import mvncapi ... | github_jupyter |
```
import os
import json
def findCaptureSessionDirs(path):
session_paths = []
devices = os.listdir(path)
for device in devices:
sessions = os.listdir(os.path.join(path, device))
for session in sessions:
session_paths.append(os.path.join(device, session))
return se... | github_jupyter |
#### Data Fetch
```
import pandas as pd
import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
import math
#extracting lines for simplied verion
open('2-fft-malicious-n-0-4-m-12.txt','w').writelines([ line for line in open("2-fft-malicious-n-0-4-m-12.log") if "Enqueue" in line])
pr... | github_jupyter |
# Skip-gram word2vec
In this notebook, I'll lead you through using TensorFlow to implement the word2vec algorithm using the skip-gram architecture. By implementing this, you'll learn about embedding words for use in natural language processing. This will come in handy when dealing with things like machine translation.... | github_jupyter |
```
from matplotlib import pyplot as plt
import pickle
%matplotlib inline
plt.figure(figsize=(10, 3))
import seaborn as sns; sns.set()
with open("routing_score.pkl",'rb') as h:
test_list=pickle.load(h)
data=test_list[2][0].mean(axis=0,keepdims=True).squeeze()
# data=test_list[0]
xLabel = [
"movie_id", "user... | github_jupyter |
```
import pandas as pd
import numpy as np
df = pd.read_csv('phone_data.csv')
df.head()
df.shape
print(df['item'])
df[['item','duration','month']].head()
df.head()
df.iloc[:8,1:4]
df.loc[8:]
```
#BOOLEAN INDEXING
and &
or |
Equal to ==
Not equal to !=
Not in ~
Equals: ==
Not equals: !=
Greater than, less t... | github_jupyter |
# DAPA Tutorial #2: Area - Sentinel-2
## Load environment variables
Please make sure that the environment variable "DAPA_URL" is set in the `custom.env` file. You can check this by executing the following block.
If DAPA_URL is not set, please create a text file named `custom.env` in your home directory with the foll... | github_jupyter |
```
# Collaborative Base filtering like in Netflix, Youtube
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
movies=pd.read_csv("C:/Users/Dell/Desktop/Movie-Recommendation/movies.csv")
ratings=pd.read_csv("C:/Users/Dell/Desktop/Movie-Recommendation/ratings.csv")
movies.head()
ratings.head()
final=... | github_jupyter |
```
# default_exp core
```
# Core
> Basic healper functions
```
#hide
from nbdev.showdoc import *
#hide
%load_ext autoreload
%autoreload 2
#export
import torch
from torch import nn, einsum
import torch.nn.functional as F
import torch.autograd.profiler as profiler
from fastai.basics import *
from fastai.text.all imp... | github_jupyter |
<a href="https://colab.research.google.com/github/JaimieOnigkeit/DS-Unit-2-Linear-Models/blob/master/module3-ridge-regression/Jaimie_Onigkeit_LS_DS_213_assignment.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, S... | github_jupyter |
```
# 화씨 -> 섭씨로 바꾸기
# categorical 바꾸기
# 날짜 date 형식으로 바꾸기
# NA값 0으로 처리하기
import pandas as pd
import numpy as np
from datetime import datetime
df = pd.read_csv('train.csv',encoding='euc-kr')
df.head()
df.info()
#datetime으로 변환
df['Date'] = pd.to_datetime(df['Date'])
df['Year'] =df['Date'].dt.year
df['Month'] =df['Date'].... | github_jupyter |
```
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from rdkit.Chem import MolFromSmiles
from rdkit.Chem.Descriptors import ExactMolWt
df = pd.read_csv("39_Formose reaction_MeOH.csv")#glucose_dry_impcols.csv
print(df.columns)
# first get rid of empty lines in the mass list by replacing with ''
df... | github_jupyter |
### Example Class
```
import datetime # we will use this for date objects
class Person:
def __init__(self, name, surname, birthdate, address, telephone, email):
self.name = name
self.surname = surname
self.birthdate = birthdate
self.address = address
self.telephone = tele... | github_jupyter |
```
# Load libraries
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import time
from sklearn.cross_validation import train_test_split
from sklearn.grid_search import GridSearchCV
from sklearn.neighbors import KNeighborsClassifier
# Load dataset
url = "https://archive.ics.uci.edu/ml/machine-lear... | github_jupyter |
# pipegraph User Guide
## Rationale
[scikit-learn](http://scikit-learn.org/stable/) provides a useful set of data preprocessors and machine learning models. The `Pipeline` object can effectively encapsulate a chain of transformers followed by final model. Other functions, like `GridSearchCV` can effectively use `Pipe... | github_jupyter |
```
import tensorflow as tf
from tensorflow.keras import backend as K
import matplotlib as mpl
import pickle
import matplotlib.pyplot as plt
import matplotlib
import numpy as np
import os
# Init NuScenes. Requires the dataset to be stored on disk.
from nuscenes.nuscenes import NuScenes
from nuscenes.map_expansion.map... | github_jupyter |
# 2. Acquire the Data
## Finding Data Sources
There are three place to get onion price and quantity information by market.
1. **[Agmarket](http://agmarknet.nic.in/)** - This is the website run by the Directorate of Marketing & Inspection (DMI), Ministry of Agriculture, Government of India and provides daily price ... | github_jupyter |
```
# default_exp tutorial
```
# nbdev tutorial
> A step by step guide
- image: images/nbdev_source.gif
nbdev is a system for *exploratory programming*. See the [nbdev launch post](https://www.fast.ai/2019/12/02/nbdev/) for information about what that means. In practice, programming in this way can feel very differ... | github_jupyter |
I've approached this problem as a regression problem and trained the model with the helps of LSTMs, details of the model architecture are furnished below.
I've evaluated the model using 3 iterations of hold-out validation, the details of which are furnished below
```
from google.colab import drive
import pandas as pd... | github_jupyter |
```
%%javascript
IPython.OutputArea.prototype._should_scroll = function(lines) {
return false;
}
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from matplotlib import rcParams
%matplotlib inline
TEXT_COLOUR = {
'PURPLE':'\033[95m',
'CYAN':'\033[96m',
'DARKCYAN':'\033... | github_jupyter |
#Author : Devesh Kumar
## Task 4 : Prediction using Decision Tree Algorithm
___
## GRIP @ The Sparks Foundation
____
# Role : Data Science and Business Analytics [Batch May-2021]
## Table of Contents<br>
> - 1. Introduction.
- 2. Importing Libraries.
- 3. Fetching and loading data.
- 4. Checking for null values.
- 5.... | github_jupyter |
```
# !pip install pandas_datareader keras seaborn
# !conda install -y -c conda-forge fbprophet
# !pip install pydot graphviz
import boto3
import base64
from botocore.exceptions import ClientError
from IPython.display import display
import pandas_datareader
import pandas as pd
import numpy as np
from keras import Seque... | github_jupyter |
# 04 - Full waveform inversion with Devito and scipy.optimize.minimize
## Introduction
In this tutorial we show how [Devito](http://www.opesci.org/devito-public) can be used with [scipy.optimize.minimize](https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.minimize.html) to solve the FWI gradient base... | github_jupyter |
```
import numpy as np
import collections
import random
import tensorflow as tf
def build_dataset(words, n_words):
count = [['GO', 0], ['PAD', 1], ['EOS', 2], ['UNK', 3]]
count.extend(collections.Counter(words).most_common(n_words - 1))
dictionary = dict()
for word, _ in count:
dictionary[word] ... | github_jupyter |
# End-to-End Machine Learning Project
In this chapter you will work through an example project end to end, pretending to be a recently hired data scientist at a real estate company. Here are the main steps you will go through:
1. Look at the big picture
2. Get the data
3. Discover and visualize the data to gain insigh... | github_jupyter |
```
from utils import *
import tensorflow as tf
from sklearn.cross_validation import train_test_split
import time
trainset = sklearn.datasets.load_files(container_path = 'data', encoding = 'UTF-8')
trainset.data, trainset.target = separate_dataset(trainset,1.0)
print (trainset.target_names)
print (len(trainset.data))
p... | github_jupyter |
# $P_\ell(k)$ measurements for SIMBIG CMASS
In this notebook, I demonstrate how we measure the power spectrum multipoles, $P_\ell(k)$ from the forward modeled SIMBIG CMASS mocks
```
import os, time
import numpy as np
from simbig import halos as Halos
from simbig import galaxies as Galaxies
from simbig import forwardm... | github_jupyter |
# MPI P2P Communication Modes
> "Intro to MPI modes for P2P communication"
- toc:true
- branch: master
- badges: false
- comments: false
- author: Alexandros Giavaras
- categories: [programming, MPI, parallel-computing, C++, distributed-computing]
## <a name="overview"></a> Overview
In the previous <a href="https:... | github_jupyter |
### How To Break Into the Field
Now you have had a closer look at the data, and you saw how I approached looking at how the survey respondents think you should break into the field. Let's recreate those results, as well as take a look at another question.
```
import numpy as np
import pandas as pd
import matplotlib.... | github_jupyter |
# Reading and writing LAS files
This notebook goes with [the Agile blog post](https://agilescientific.com/blog/2017/10/23/x-lines-of-python-load-curves-from-las) of 23 October.
Set up a `conda` environment with:
conda create -n welly python=3.6 matplotlib=2.0 scipy pandas
You'll need `welly` in your environment... | github_jupyter |
# DaKanjiRecognizer - Single Kanji CNN : Create dataset
## Setup
Import the needed libraries.
```
#std lib
import sys
import os
import random
import math
import multiprocessing as mp
import gc
import time
import datetime
from typing import Tuple, List
from shutil import copy
from tqdm import tqdm
import tensorflow ... | github_jupyter |
#### Jupyter notebooks
This is a [Jupyter](http://jupyter.org/) notebook using Python. You can install Jupyter locally to edit and interact with this notebook.
# Finite difference methods for transient PDE
## Method of Lines
Our method for solving time-dependent problems will be to discretize in space first, resul... | github_jupyter |
# Valuación de opciones asiáticas
- Las opciones que tratamos la clase pasada dependen sólo del valor del precio del subyacente $S_t$, en el instante que se ejerce.
- Cambios bruscos en el precio, cambian que la opción esté *in the money* a estar *out the money*.
- **Posibilidad de evitar esto** $\longrightarrow$ su... | github_jupyter |
```
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
tf.enable_eager_execution()
a = ''
if a is None:
print("not None")
if not a :
print("not a")
a = np.arange(10)
print(a[9:])
print(a[:9])
print(a.reshape([1,10,1]))
a = np.arange(6).reshape(3,2)
idxs = np.random.randint(a.shape[0], si... | github_jupyter |
```
import random
suits = ('Hearts','Diamonds','Spades','Clubes')
ranks = ('Two','Three','Four','Five','Six','Seven','Eight','Nine','Ten','Jack','Queen','king','Ace')
values = {'Two':2,'Three':3,'Four':4,'Five':5,'Six':6,
'Seven':7,'Eight':8,'Nine':9,'Ten':10,'Jack':10,'Queen':10,'king':10,'Ace':11}
playing =... | github_jupyter |
# TensorFlow Tutorial
Welcome to this week's programming assignment. Until now, you've always used numpy to build neural networks. Now we will step you through a deep learning framework that will allow you to build neural networks more easily. Machine learning frameworks like TensorFlow, PaddlePaddle, Torch, Caffe, Ke... | github_jupyter |
```
import tensorflow as tf
from tensorflow import keras as keras
import time
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
import matplotlib.image as mpimg
from tensorflow.keras.models import Sequential, load_model
from tensorflow.keras.layers import Dense, Dropout, Lambda, LayerNormalization
fr... | github_jupyter |
# Machine Learning Engineer Nanodegree
## Introduction and Foundations
## Project 0: Titanic Survival Exploration
In 1912, the ship RMS Titanic struck an iceberg on its maiden voyage and sank, resulting in the deaths of most of its passengers and crew. In this introductory project, we will explore a subset of the RMS ... | github_jupyter |
##### Copyright 2019 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.