code stringlengths 2.5k 150k | kind stringclasses 1
value |
|---|---|
# Getting Started
## Platforms to Practice
Let us understand different platforms we can leverage to practice Apache Spark using Python.
* Local Setup
* Databricks Platform
* Setting up your own cluster
* Cloud based labs
## Setup Spark Locally - Ubuntu
Let us setup Spark Locally on Ubuntu.
* Install latest versio... | github_jupyter |
# Predicting Student Admissions with Neural Networks
In this notebook, we predict student admissions to graduate school at UCLA based on three pieces of data:
- GRE Scores (Test)
- GPA Scores (Grades)
- Class rank (1-4)
The dataset originally came from here: http://www.ats.ucla.edu/
## Loading the data
To load the da... | github_jupyter |
## MEG Group Analysis
Group analysis for MEG data, for the FOOOF paper.
The Data Source is from the
[Human Connectome Project](https://www.humanconnectome.org/)
This notebook is for group analysis of MEG data using the
[omapping](https://github.com/voytekresearch/omapping) module.
```
%matplotlib inline
from sc... | github_jupyter |
# Plagiarism Text Data
In this project, you will be tasked with building a plagiarism detector that examines a text file and performs binary classification; labeling that file as either plagiarized or not, depending on how similar the text file is when compared to a provided source text.
The first step in working wi... | github_jupyter |
# Application of SVD in image processing
## Introduction to SVD
Matrix factorization is a very important part of linear algebra. By decomposing the original matrix into matrices of different properties, the matrix factorization can not only show the potential attributes of the original matrix, but also help to implem... | github_jupyter |
# LSTM
```
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import tensorflow
from numpy import *
from math import sqrt
from pandas import *
from sklearn.preprocessing import LabelEncoder, MinMaxScaler
from sklearn.preprocessing import OneHotEncoder
from sklearn.metrics import mean_squared_erro... | github_jupyter |
# Settings
```
%load_ext autoreload
%autoreload 2
%env TF_KERAS = 1
import os
sep_local = os.path.sep
import sys
sys.path.append('..'+sep_local+'..')
print(sep_local)
os.chdir('..'+sep_local+'..'+sep_local+'..'+sep_local+'..'+sep_local+'..')
print(os.getcwd())
import tensorflow as tf
print(tf.__version__)
```
# Data... | github_jupyter |
<a href="https://colab.research.google.com/github/luisgs7/Monitoria/blob/main/aula_03_19_06_2021.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Atividade de Hoje
## 01) Faça um programa para escrever a contagem regressiva do lançamento de um fog... | github_jupyter |
```
import tensorflow as tf
print(tf.__version__)
import numpy as np
import matplotlib.pyplot as plt
# Create features
X = np.array([-7.0, -4.0, -1.0, 2.0, 5.0, 8.0, 11.0, 14.0])
# Create labels
Y = np.array([3.0, 6.0, 9.0, 12.0, 15.0, 18.0, 21.0, 24.0])
# Visualize it
plt.scatter(X, Y);
import numpy as np
import mat... | github_jupyter |
<a href="https://colab.research.google.com/github/gndede/python/blob/main/WebScraping219.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
Web Scraping
```
#In this lab exercise, we'll scrape Goodread's Best Books list:
#link to scrap https://www.goo... | github_jupyter |
# EUC 1993-2017: ECCOv4r4, GISS-G, and GISS-H
```
import os
import numpy as np
import matplotlib.pyplot as plt
import xarray as xr
from xgcm import Grid
from pych.calc import haversine
ecco = xr.open_dataset('/workspace/results/eccov4r4/equatorial-under-current/euc_eccov4r4.nc')
gissg = xr.open_dataset('/workspace/re... | github_jupyter |
# Chapter 11 - Gradient Descent
```
import sys
sys.path.append("../")
from utils import *
np.random.seed(0)
```
The most plain implementation of gradient descent, for minimizing a differentiable function $f$
```
def VanillaGradientDescent(f, f_grad, init=np.random.uniform(-1, 1, 2), eta=lambda t: .1, tol=1e-5):
... | github_jupyter |
```
from IPython.core.display import HTML
def css_styling():
styles = open("./styles/custom.css", "r").read()
return HTML(styles)
css_styling()
```
Open Jupyter notebook:
<br> Start >> Programs >> Programming >> Anaconda3 >> JupyterNotebook
<br>(Start >> すべてのプログラム >> Programming >> Anaconda3 >> JupyterNotebook... | github_jupyter |
<font color="green">*To start working on this notebook, or any other notebook that we will use in the Moringa Data Science Course, we will need to save our own copy of it. We can do this by clicking File > Save a Copy in Drive. We will then be able to make edits to our own copy of this notebook.*</font>
# SQL Programm... | github_jupyter |
```
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
from torch.autograd import Variable
import matplotlib.pyplot as plt
import torch.nn.functional as F
raw = pd.read_csv('../dat/schools_w_clusters.csv')
raw = raw[['Cluster ID', 'Id', 'Site name', 'Address', 'Zip', 'Phone']]
raw['Zip'] = raw['Z... | github_jupyter |
```
!cat "../README.md"
```
# Dependencies and Setup
* Load File
* Read Purchasing File and store into Pandas DataFrame
```
import pandas as pd
file_to_load = "./Resources/purchase_data.csv"
purchase_data = pd.read_csv(file_to_load)
purchase_data.head()
```
## Player Count
* Display the total number of players
... | github_jupyter |
# 决策树
决策树(Decision Tree)首先对数据进行处理,利用归纳算法生成可读的规则和决策树,然后使用决策对新数据进行分析,本质上是通过一系列规则对数据进行分类的过程
决策树是一种典型的分类方法。其中:
+ 每个内部结点表示一个属性上的判断
+ 每个分支代表一个判断结果的输出
+ 每个叶结点代表一种分类结果。
CLS算法是早期提出的决策树学习算法,是很多决策树学习算法的基础框架。
依据其中选择分类属性的策略不同,可以得到不同的决策树算法。比较常用的决策树有ID3,C4.5和CART三种和实现,其中CART一般优于其他决策树,并且可用于回归任务。
下面我们将编写代码实现这三种决策树算法。
### 任务一: 导入包和... | github_jupyter |
The folk at [Code for Berlin](https://www.codefor.de/berlin/) have created a REST API offering access to the database of Berlin street trees and have [an issue open](https://github.com/codeforberlin/tickets/issues/3) asking people to try to do "something" with it. It seemed a cool way to look more deeply into the archi... | github_jupyter |
```
# Importing the Necessary Libraries
from tensorflow.keras.layers import Input, Dense, Flatten, Dropout
from tensorflow.keras.models import Model
from tensorflow.keras.models import load_model
from tensorflow.keras.applications.vgg16 import VGG16
from tensorflow.keras.applications.vgg19 import VGG19
from tensorflow.... | github_jupyter |
# Feature Engineering with Open-Source
In this notebook, we will reproduce the Feature Engineering Pipeline from the notebook 2 (02-Machine-Learning-Pipeline-Feature-Engineering), but we will replace, whenever possible, the manually created functions by open-source classes, and hopefully understand the value they brin... | github_jupyter |
```
import copy
import pandas
import numpy
from sklearn.datasets import make_moons
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import accuracy_score, roc_auc_score
from sklearn.metrics import euclidean_distances
"""
This tutorial shows h... | github_jupyter |
```
%load_ext autoreload
%autoreload 2
from nannon import *
start_pos
end_tuple
roll()
first_roll()
pos = ((0, 0, 1), (0, 2, 3))
print_board(pos)
swapped = swap_players(pos)
print(swapped)
print_board(swapped)
pos = ((0, 0, 1), (0, 2, 3))
print_board(pos)
print(who_won(pos))
pos = ((7, 7, 7), (0, 0, 1))
print_board(po... | github_jupyter |
```
import numpy as np
import scipy
import scipy.misc
import scipy.ndimage
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.preprocessing import MinMaxScaler
from sklearn.preprocessing import OneHotEncoder
from datetime import datetime
import resource
np.set_printoptions(suppress=True, precision=5)
... | github_jupyter |
```
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Overview"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This week we are going to learn a bit about __Data Visualization__, which is an important aspect in Computational Social Science. Why is i... | github_jupyter |
# Use Spark to recommend mitigation for car rental company with `ibm-watson-machine-learning`
This notebook contains steps and code to create a predictive model, and deploy it on WML. This notebook introduces commands for pipeline creation, model training, model persistance to Watson Machine Learning repository, model... | github_jupyter |
# Saving and Loading Models
In this notebook, I'll show you how to save and load models with PyTorch. This is important because you'll often want to load previously trained models to use in making predictions or to continue training on new data.
```
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
i... | github_jupyter |
# Example 01: General Use of BinaryClassificationMetrics
[](https://colab.research.google.com/github/slickml/slick-ml/blob/master/examples/metrics/example_01_BinaryClassificationMetrics.ipynb)
### Google Colab Configuration
```
# !git clone ht... | github_jupyter |
<img src="../../images/qiskit-heading.gif" alt="Note: In order for images to show up in this jupyter notebook you need to select File => Trusted Notebook" width="500 px" align="left">
## _*Shor's Algorithm for Integer Factorization*_
The latest version of this tutorial notebook is available on https://github.com/qis... | github_jupyter |
## ewf-ext-03-03-03 - Flood hazard
### <a name="service">Service definition
```
service = dict([('title', 'ewf-ext-03-03-03 - Flood exposure'),
('abstract', 'ewf-ext-03-03-03 - Flood exposure'),
('id', 'ewf-ext-03-03-03')])
start_year = dict([('id', 'start_year'),
('value'... | github_jupyter |
```
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
#load dataset
mnist = input_data.read_data_sets("MNIST_data",one_hot=True)
#define batch_size
batch_size = 100
#compute the number of batch
n_batch = mnist.train.num_examples // batch_size #
#define 2 placeholders
x = tf.placeholde... | github_jupyter |
# A-weightening filter implementation
The A-weighting transfer function is defined in the ANSI Standards S1.4-1983 and S1.42-2001:
$$
H(s) = \frac{\omega_4^2 s^4}{(s-\omega_1)^2(s-\omega_2)(s-\omega_3)(s-\omega_4)^2}
$$
Where $\omega_i = 2\pi f_i$ are the angular frequencies defined by:
```
import numpy as np
f1 =... | github_jupyter |
<h1 align="center"> Image Captioning </h1>
In this notebook you will teach a network to do image captioning

_image [source](https://towardsdatascience.com/image-captioning-in-deep-learning-9cd23fb4d8d2)_
#### Alright, here's our plan:
1. T... | github_jupyter |
# Supervised baselines
Notebook with strong supervised learning baseline on cifar-10
```
%reload_ext autoreload
%autoreload 2
```
You probably need to install dependencies
```
# All things needed
!git clone https://github.com/puhsu/sssupervised
!pip install -q fastai2
!pip install -qe sssupervised
```
After runni... | github_jupyter |
```
import pandas as pd
import numpy as np
import warnings
warnings.filterwarnings('ignore')
train=pd.read_csv(r'C:\Users\prath\LoanEligibilityPrediction\Dataset\train.csv')
train.Loan_Status=train.Loan_Status.map({'Y':1,'N':0})
train.isnull().sum()
Loan_status=train.Loan_Status
train.drop('Loan_Status',axis=1,inplace... | github_jupyter |
# Jupyter Notebooks and CONSTELLATION
This notebook is an introduction to using Jupyter notebooks with CONSTELLATION. In part 1, we'll learn how to send data to CONSTELLATION to create and modify graphs. In part 2, we'll learn how to retrieve graph data from CONSTELLATION. Part 3 will be about getting and setting info... | github_jupyter |
# Step 1 - Prepare Data
Data cleaning.
```
%load_ext autoreload
%autoreload 2
import pandas as pd
# Custom Functions
import sys
sys.path.append('../src')
import data as dt
import prepare as pr
import helper as he
```
### Load Data
```
dt_task = dt.Data()
data = dt_task.load('fn_clean')
fn_data = he.get_config()['pa... | github_jupyter |
## Create Azure Resources¶
This notebook creates relevant Azure resources. It creates a recource group where an IoT hub with an IoT edge device identity is created. It also creates an Azure container registry (ACR).
```
from dotenv import set_key, get_key, find_dotenv
from pathlib import Path
import json
import time
... | github_jupyter |
# Deutsch-Jozsa Algorithm
In this section, we first introduce the Deutsch-Jozsa problem, and classical and quantum algorithms to solve it. We then implement the quantum algorithm using Qiskit, and run it on a simulator and device.
## Contents
1. [Introduction](#introduction)
1.1 [Deutsch-Jozsa Problem](#djpr... | github_jupyter |
# 💻IDS507 | Lab03
<font size=5><b>Regression Analysis<b></font>
<div align='right'>TA: 류 회 성(Hoe Sung Ryu)</div>
## Concepts | 오늘 배울 개념
---
- 내 데이터를 train/test dataset으로 나누기
- 내 데이터로 `Logistic regression` (로지스틱 회귀) 모델 만들어보기
- 생성한 모델을 이용해 새로운 데이터를 예측해보기
- 내 모델이 얼마나 잘 기능하는가?
- Confusion Matrix, Roc Curve & AUC 계산
## �... | github_jupyter |
# Example of optimizing Xgboost XGBClassifier function
# Goal is to test the objective values found by Mango
# Benchmarking Serial Evaluation: Iterations 60
```
from mango.tuner import Tuner
from scipy.stats import uniform
def get_param_dict():
param_dict = {"learning_rate": uniform(0, 1),
"gamma"... | github_jupyter |
<img src='./img/intel-logo.jpg' width=50%, Fig1>
# OpenCV 기초강좌
<font size=5><b>01. 이미지, 비디오 입출력 <b></font>
<div align='right'>성 민 석 (Minsuk Sung)</div>
<div align='right'>류 회 성 (Hoesung Ryu)</div>
<img src='./img/OpenCV_Logo_with_text.png' width=20%, Fig2>
---
<h1>Table of Contents<span class="tocSkip"><... | github_jupyter |
```
import logging
import warnings
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
import neurolib.optimize.exploration.explorationUtils as eu
import neurolib.utils.pypetUtils as pu
from neurolib.optimize.exploration import BoxSearch
logger = logging.getLogger()
warnings.... | github_jupyter |
# Operator Upgrade Tests
## Setup Seldon Core
Follow the instructions to [Setup Cluster](https://docs.seldon.io/projects/seldon-core/en/latest/examples/seldon_core_setup.html#Setup-Cluster) with [Ambassador Ingress](https://docs.seldon.io/projects/seldon-core/en/latest/examples/seldon_core_setup.html#Ambassador) and ... | github_jupyter |
```
# default_exp scrape8K
```
# scrape8K
> Scrape item summaries from 8-K SEC filings.
```
#hide
%load_ext autoreload
%autoreload 2
from nbdev import show_doc
#export
import collections
import itertools
import os
import re
from secscan import utils, dailyList, basicInfo, infoScraper
default8KDir = os.path.join(u... | github_jupyter |
Comparison for decision boundary generated on iris dataset between Label Propagation and SVM.
This demonstrates Label Propagation learning a good boundary even with a small amount of labeled data.
#### New to Plotly?
Plotly's Python library is free and open source! [Get started](https://plot.ly/python/getting-started... | github_jupyter |
# Pouch cell model
In this notebook we compare the solutions of two reduced-order models of a lithium-ion pouch cell with the full solution obtained using COMSOL. This example is based on the results in [[6]](#References). The code used to produce the results in [[6]](#References) can be found [here](https://github.co... | github_jupyter |
<a href="https://colab.research.google.com/github/satyajitghana/TSAI-DeepVision-EVA4.0/blob/master/05_CodingDrill/EVA4S5F1.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Import Libraries
```
from __future__ import print_function
import torch
imp... | github_jupyter |
```
import numpy as np
import matplotlib.pyplot as plt
import os
plt.rcParams['figure.figsize'] = [10.0, 5.0]
plt.rcParams['figure.dpi'] = 220
def rand_signal_generator(len):
times = np.arange(0, len)
signal = np.sin(times) + np.random.normal(scale=0.1, size=times.size)
return signal
def generate_block(in... | github_jupyter |
# Gene Regulatory Networks
Resources:
1. [week5_feedback_systems.ipynb](https://pages.hmc.edu/pandey/reading/week5_feedback_systems.ipynb): This notebook introduces the analysis of feedback systems using Python and describes the role of feedback in system design using simulations of mathematical models.
1. [week6_sy... | github_jupyter |
# GPU Computing for Data Scientists
#### Using CUDA, Jupyter, PyCUDA, ArrayFire and Thrust
https://github.com/QuantScientist/Data-Science-ArrayFire-GPU
```
%reset -f
import pycuda
from pycuda import compiler
import pycuda.driver as drv
import pycuda.driver as cuda
```
# Make sure we have CUDA
```
drv.init()
print(... | github_jupyter |
```
import os
os.chdir('/Users/yufei/Documents/2-CMU/DebiasingCvxConstrained/Code/Library')
from math import log
import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
from ExperimentFunc import exp_func, beta_gen_lasso
from Step1 import solve_beta_lasso
from Step2 import find_v_lasso
from Step3... | github_jupyter |
## <span style="color:#0B3B2E;float:right;font-family:Calibri">Jordan Graesser</span>
# MpGlue
### Handling image files with MpGlue
---
## Opening images
#### Everything begins with the `ropen` function.
```
%load_ext autoreload
%autoreload 2
%matplotlib inline
import skimage
import matplotlib as mpl
mpl.rcParams['... | github_jupyter |
# Tutorial 05: Creating Custom Networks
This tutorial walks you through the process of generating custom networks. Networks define the network geometry of a task, as well as the constituents of the network, e.g., vehicles, traffic lights, etc... Various networks are available in Flow, depicting a diverse set of open a... | github_jupyter |
# Solving Linear Systems: Iterative Methods
<a rel="license" href="http://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://licensebuttons.net/l/by/4.0/80x15.png" /></a><br />This notebook by Xiaozhou Li is licensed under a <a rel="license" href="http://creati... | github_jupyter |
# Kesten Processes and Firm Dynamics
<a id='index-0'></a>
```
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
import quantecon as qe
from pandas.plotting import register_matplotlib_converters
register_matplotlib_converters()
import yfinance as yf
import pandas as pd
s = yf.download('^IXIC', '... | github_jupyter |
# Self-Driving Car Engineer Nanodegree
## Project: **Finding Lane Lines on the Road**
***
In this project, you will use the tools you learned about in the lesson to identify lane lines on the road. You can develop your pipeline on a series of individual images, and later apply the result to a video stream (really j... | github_jupyter |
```
import subprocess
import shlex
import pandas as pd
import numpy as np
from astropy.table import Table
from astropy.table import Column
import os
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
from matplotlib.ticker import MultipleLocator
import glob
from matplotlib import pyplo... | github_jupyter |
```
import holoviews as hv
hv.extension('bokeh')
hv.opts.defaults(hv.opts.Curve(width=500),
hv.opts.Histogram(width=500),
hv.opts.HLine(alpha=0.5, color='r', line_dash='dashed'))
import numpy as np
import scipy.stats
```
# Cadenas de Markov
## Introducción
En la lección anterior vi... | github_jupyter |
```
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
np.random.seed(0)
```
# Model definition
Let *k-nearest neighbors* of a new example $x$ be the $k$ examples out of the training set $X$ that minimize the distance function $d$ between $x$ and themselve... | github_jupyter |
# The R Programming Language
1. **R**: Popular **open-source programming language** for statistical analysis
2. Widely used in statistics and econometrics
3. **User-friendly and powerful IDE**: [RStudio](https://www.rstudio.com/)
4. Basic functionalities of **R** can be extended by **packages**
5. Large number of pack... | github_jupyter |
```
####################################################################################################
# Copyright 2019 Srijan Verma and EMBL-European Bioinformatics Institute
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License... | github_jupyter |
# Running attribute inference attacks on Regression Models
In this tutorial we will show how to run black-box inference attacks on regression model. This will be demonstrated on the Nursery dataset (original dataset can be found here: https://archive.ics.uci.edu/ml/datasets/nursery).
## Preliminaries
In order to moun... | github_jupyter |
<h1><center>ERM with DNN under penalty of Equalized Odds</center></h1>
We implement here a regular Empirical Risk Minimization (ERM) of a Deep Neural Network (DNN) penalized to enforce an Equalized Odds constraint. More formally, given a dataset of size $n$ consisting of context features $x$, target $y$ and a sensitiv... | github_jupyter |
# Extract Wind Information from NREL WKT
By Mauricio Hernandez
Goal(s):
- Collect and download data from a set of wind stations using the NREL API Wind Toolkit Data Downloads.
- Get insights from wind speed and wind direction data
---
See documentation at: https://developer.nrel.gov/docs/wind/wind-toolkit/mexico-wtk.... | github_jupyter |
# Estimating The Mortality Rate For COVID-19
> Using Country-Level Covariates To Correct For Testing & Reporting Biases And Estimate a True Mortality Rate.
- author: Joseph Richards
- image: images/corvid-mortality.png
- comments: true
- categories: [MCMC, mortality]
- permalink: /covid-19-mortality-estimation/
- toc: ... | github_jupyter |
Building the dataset of numerical data
```
#### STOP - ONLY if needed
# Allows printing full text
import pandas as pd
pd.set_option('display.max_colwidth', None)
#mid_keywords = best_keywords(data, 1, 0.49, 0.51) # same as above, but for average papers
#low_keywords = best_keywords(data, 1, 0.03, 0.05) # same ... | github_jupyter |
```
import requests
import json
headers = {'content-type': 'application/json'}
url = 'https://nid.naver.com/nidlogin.login'
data = {"eventType": "AAS_PORTAL_START", "data": {"id": "lafamila", "pw": "als01060"}}
#params = {'sessionKey': '9ebbd0b25760557393a43064a92bae539d962103', 'format': 'xml', 'platformId': 1}
#re... | github_jupyter |
# 1A See Handwritten Notes
# 1B
```
import os
import pandas as pd
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
mpl.rcParams['figure.figsize'] = [12,8]
# sine wave with noise, aka swell with wind chop
arr = np.linspace(0, 20, 50)
ts = np.sin(arr) * 5 + np.random.uniform(-1, 1, len(arr))... | github_jupyter |
# NumPy
NumPy is also incredibly fast, as it has bindings to C libraries. For more info on why you would want to use arrays instead of lists, check out this great [StackOverflow post](http://stackoverflow.com/questions/993984/why-numpy-instead-of-python-lists).
```
import numpy as np
```
# NumPy Arrays
NumPy array... | github_jupyter |
<a href="https://colab.research.google.com/github/Scott-Huston/DS-Unit-1-Sprint-2-Data-Wrangling-and-Storytelling/blob/master/LS_DS_123_Make_Explanatory_Visualizations.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
_Lambda School Data Science_
# M... | github_jupyter |
# Bloodmeal Calling
In this notebook, we analyze contigs from each bloodfed mosquito sample with LCA in *Vertebrata*. The potential bloodmeal call is the lowest taxonomic group consistent with the LCAs of all such contigs in a sample.
```
import pandas as pd
import numpy as np
from ete3 import NCBITaxa
import boto3
i... | github_jupyter |
# LAB 4b: Create Keras DNN model.
**Learning Objectives**
1. Set CSV Columns, label column, and column defaults
1. Make dataset of features and label from CSV files
1. Create input layers for raw features
1. Create feature columns for inputs
1. Create DNN dense hidden layers and output layer
1. Create custom evaluat... | github_jupyter |
# Часть 1. k-Nearest Neighbor (kNN) классификатор
kNN классификатор:
- Во время обучения получает данные и просто запоминает их
- Во время тестирования каждое тестовое изображение сравнивается с каждым обучающим. Итоговая метка получается на основе анализа меток k ближайших обучающих изображений
- Значение k подбирает... | github_jupyter |
```
%env CUDA_VISIBLE_DEVICES=1
DATA_DIR='/home/HDD6TB/datasets/emotions/zoom/'
import os
from PIL import Image
import cv2
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier,RandomForestRegressor
from sklearn import svm,metrics,preprocessing
from sklearn.neighbors i... | github_jupyter |
```
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
import json # to read json
def squad_json_to_dataframe_train(input_file_path, record_path = ['data','paragraphs','qas','answers'],
verbose = 1):
"""
input_file_path: path t... | github_jupyter |
<table align="center" width=100%>
<tr>
<td width="15%">
<img src="edaicon.png">
</td>
<td>
<div align="center">
<font color="#21618C" size=24px>
<b>Exploratory Data Analysis
</b>
</font>
... | github_jupyter |
# K Nearest Neighbors
This notebook uses scikit-learn's knn model to train classifiers to associate images of peoples' faces and images of handwritten digits.
```
# import libraries
import numpy as np
from scipy.io import loadmat
from scipy.stats import mode
%matplotlib inline
import matplotlib.pyplot as plt
# setti... | github_jupyter |
```
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
def dydx(x,y):
#Set derivatives
#y is an array, 2D array
#1 dimension is x, other one is 1D with y and x elements
#our eqn is d^2y/dx^2 = -y
#so we can write dydz=z, dzdx=-y
#we will set y = y[0], z = y[1]
#declare an ... | github_jupyter |
# Setup
```
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
import itertools as it
import helpers_03
%matplotlib inline
```
# Neurons as Logic Gates
As an introduction to neural networks and their component neurons, we are going to look at using neurons to implement the most primitive lo... | github_jupyter |
# Data Science Bootcamp - The Bridge
## Precurso
En este notebook vamos a ver, uno a uno, los conceptos básicos de Python. Constarán de ejercicios prácticos acompañados de una explicación teórica dada por el profesor.
Los siguientes enlaces están recomendados para el alumno para profundizar y reforzar conceptos a par... | github_jupyter |
# `map` vs `apply`
Do you know the difference between the **`map`** and **`apply`** Series methods?
```
from IPython.display import IFrame
IFrame('http://etc.ch/RjoN', 400, 300)
IFrame('https://directpoll.com/r?XDbzPBd3ixYqg8VzFnGsNyv3rYRtjyM1R0g6HvOxV', 400, 300)
```
# Primary usage of `map` method
As the name impl... | github_jupyter |
```
%load_ext autoreload
%autoreload 2
%aimport utils_1_1
import pandas as pd
import numpy as np
import altair as alt
from altair_saver import save
import datetime
import dateutil.parser
from os.path import join
from constants_1_1 import SITE_FILE_TYPES
from utils_1_1 import (
get_site_file_paths,
get_site_fi... | github_jupyter |
# Session 17: Recommendation system on your own
This script should allow you to build an interactive website from your own
dataset. If you run into any issues, please let us know!
## Step 1: Select the corpus
In the block below, insert the name of your corpus. There should
be images in the directory "images". If th... | github_jupyter |
# K-Nearest Neighbors Algorithm
In this Jupyter Notebook we will focus on $KNN-Algorithm$. KNN is a data classification algorithm that attempts to determine what group a data point is in by looking at the data points around it.
An algorithm, looking at one point on a grid, trying to determine if a point is in group A... | github_jupyter |
# DAT210x - Programming with Python for DS
## Module2 - Lab5
Import and alias Pandas:
```
import pandas as pd
```
As per usual, load up the specified dataset, setting appropriate header labels.
```
# Note: only 8 elements in provided header names, so need to slice out the first index element from original dataset
... | github_jupyter |
```
%load_ext autoreload
%autoreload 2
import pyrds
import pandas as pd
import requests
import datetime
from google.cloud import bigquery
client = bigquery.Client()
lookback = 7
today = datetime.datetime.today()
start_date = (today - datetime.timedelta(days=lookback)).strftime('%Y-%m-%d')
end_date = today.strftime('%... | github_jupyter |
# Quantization of Signals
*This jupyter notebook is part of a [collection of notebooks](../index.ipynb) on various topics of Digital Signal Processing. Please direct questions and suggestions to [Sascha.Spors@uni-rostock.de](mailto:Sascha.Spors@uni-rostock.de).*
## Spectral Shaping of the Quantization Noise
The quan... | github_jupyter |
## Omega and Xi
To implement Graph SLAM, a matrix and a vector (omega and xi, respectively) are introduced. The matrix is square and labelled with all the robot poses (xi) and all the landmarks (Li). Every time you make an observation, for example, as you move between two poses by some distance `dx` and can relate tho... | github_jupyter |
# KNN
K-Nearest Neighbors is a non-parametric model that can be used for classification, binary and multinomial, and for regression. Being non-parametric means that it predicts an output looking at the training data instead of using some learned parameters. This means that the training set needs to be stored.
For the... | github_jupyter |
```
import numpy as np
import pandas as pd
#Data Importing
df = pd.read_csv(r'C:\Users\Nibras\OneDrive\Desktop\covishieldtamilnadu.csv',header=None)
df.head(10)
#Data Cleaning#
headers = ["S.No", "Health_Unit_District","1stDosageCovishieldHCW","2ndDosageCovishieldHCW","1stDosageCovishieldFLW","2ndDosageCovishieldFLW","... | github_jupyter |
<a href="https://colab.research.google.com/github/MuhammedAshraf2020/DNN-using-tensorflow/blob/main/DNN_using_tensorflow_ipynb.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
```
#import libs
import numpy as np
import matplotlib.pyplot as plt
imp... | github_jupyter |
This notebook copies images and annotations from the original dataset, to perform instance detection
you can control how many images per pose (starting from some point) and how many instances to consider as well as which classes
we also edit the annotation file because initially all annotations are made by instance n... | github_jupyter |
<a href="https://colab.research.google.com/github/krsmith/DS-Sprint-01-Dealing-With-Data/blob/master/module4-databackedassertions/LS_DS_114_Making_Data_backed_Assertions.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Lambda School Data Science - ... | github_jupyter |
# Hyperparameter Ensembles for Robustness and Uncertainty Quantification
*Florian Wenzel, April 8th 2021. Licensed under the Apache License, Version 2.0.*
Recently, we proposed **Hyper-deep Ensembles** ([Wenzel et al., NeurIPS 2020](https://arxiv.org/abs/2006.13570)) a simple, yet powerful, extension of [deep ensembl... | github_jupyter |
# Validating Multi-View Spherical KMeans by Replicating Paper Results
Here we will validate the implementation of multi-view spherical kmeans by replicating the right side of figure 3 from the Multi-View Clustering paper by Bickel and Scheffer.
```
import sklearn
from sklearn.datasets import fetch_20newsgroups
from s... | github_jupyter |
# StellarGraph Ensemble for link prediction
In this example, we use `stellargraph`s `BaggingEnsemble` class of [GraphSAGE](http://snap.stanford.edu/graphsage/) models to predict citation links in the Cora dataset (see below). The `BaggingEnsemble` class brings ensemble learning to `stellargraph`'s graph neural network... | github_jupyter |
```
%matplotlib inline
import numpy as np
import scipy.spatial
import pandas as pd
import sklearn.decomposition
import matplotlib.pyplot as plt
import seaborn as sb
import linear_cca
import multimodal_data
```
# Useful References
## https://arxiv.org/pdf/1711.02391.pdf
## http://users.stat.umn.edu/~helwig/notes/canco... | github_jupyter |
```
#!pip install tensorflow
import tensorflow as tf
import numpy as np
corpus_raw = 'He is the king . The king is royal . She is the royal queen '
# convert to lower case
corpus_raw = corpus_raw.lower()
words = []
for word in corpus_raw.split():
if word != '.': # because we don't want to treat . as a word
... | github_jupyter |
```
import re
import os
import copy
from math import log, pow
import subprocess
import matplotlib.pyplot as plt
```
#### Fault Classes
| Fault | Binary | Decimal |
| --- | --- | --- |
| A | 00 | 0 |
| B | 01 | 1 |
| C | 10 | 2 |
| D | 11 | 3 |
#### Fault Code = (variable << 2) + fault_class
| Fault | Binary | Decim... | github_jupyter |
# Six Degrees Of Wikipedia
**A Project by Robin Graham-Hayes**
```
# Run this code to import the nessisary files and libraries
import helpers
import pathways
import wikipedia as wiki
```
## Introduction
In the Wikipedia game the goal is to get from one Wikipedia page to another in the shortest amount of clicks. You ... | github_jupyter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.