code stringlengths 2.5k 150k | kind stringclasses 1
value |
|---|---|
# <img style="float: left; padding-right: 10px; width: 45px" src="https://raw.githubusercontent.com/Harvard-IACS/2018-CS109A/master/content/styles/iacs.png"> CS109A Introduction to Data Science
## Standard Section 3: Multiple Linear Regression and Polynomial Regression
**Harvard University**<br/>
**Fall 2019**<br/>... | github_jupyter |
# Example 3. CNN + DDA
Here, we train the same CNN as in previous notebook but applying the Direct Domain Adaptation method (DDA) to reduce the gap between MNIST and MNIST-M datasets.
-------
This code is modified from [https://github.com/fungtion/DANN_py3](https://github.com/fungtion/DANN_py3).
```
import os
import... | github_jupyter |
```
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
df = pd.read_csv("E:\Downlload\AAPL.csv")
df
df1 = df[['Date','Close']]
df1
df1 = df1.rename(columns={"Close":'Close'})
df1
df1 = df1.set_index(['Date'])
df1
import math
data = df1.diff()
data = data[1:]
from statsmodels.gr... | github_jupyter |
## Swow On and Free Scenes
```
from plot_helpers import *
plt.style.use('fivethirtyeight')
casi_data = PixelClassifier(CASI_DATA, CLOUD_MASK, VEGETATION_MASK)
hillshade = RasterFile(HILLSHADE, band_number=1).band_values()
snow_on_diff_data = RasterFile(SNOW_ON_DIFF, band_number=1)
band_values_snow_on_diff = snow_on_... | github_jupyter |
This tutorial provides simple examples to learn how to use the functions provided by Preprocesspack package. First we are going to load the modules needed.
```
from preprocesspack import utils, Attribute, DataSet, graphics
```
First we are going to create an Attribute object. There are several ways of creating an obj... | github_jupyter |
# Modelling CpG islands with Hidden Markov Models
<h1>Table of Contents<span class="tocSkip"></span></h1>
<div class="toc"><ul class="toc-item"><li><span><a href="#Introduction" data-toc-modified-id="Introduction-1"><span class="toc-item-num">1 </span>Introduction</a></span><ul class="toc-item"><li><span><... | github_jupyter |
```
import sys
sys.path.append('../modules')
import likelihood_predictor
from likelihood_predictor import PlastPredictor
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from scipy.stats import zscore
import pickle
pl_full = pd.read_pickle('../datab... | github_jupyter |
## Dependencies
```
!pip install --quiet efficientnet
import warnings, time
from kaggle_datasets import KaggleDatasets
from sklearn.model_selection import KFold
from sklearn.metrics import classification_report, confusion_matrix, accuracy_score
from tensorflow.keras import optimizers, Sequential, losses, metrics, Mode... | github_jupyter |
```
# Ricordati di eseguire questa cella con Shift+Invio
import sys
sys.path.append('../')
import jupman
```
# Stringhe 4 - iterazione e funzioni
## [Scarica zip esercizi](../_static/generated/strings.zip)
[Naviga file online](https://github.com/DavidLeoni/softpython-it/tree/master/strings)
### Che fare
- scompat... | github_jupyter |
## Unit 5 - Financial Planning
```
%%capture
# Initial imports
import os
import requests
import pandas as pd
from dotenv import load_dotenv
import alpaca_trade_api as tradeapi
from MCForecastTools import MCSimulation
# Load .env enviroment variables
load_dotenv()
```
## Part 1 - Personal Finance Planner
```
# Se... | github_jupyter |
```
# IMPORT PACKAGES
import spacy, string
nlp = spacy.load('de_core_news_sm')
from spacy.lang.de import German
# LOAD DATA S.T. 1 LINE IN XLSX = 1 DOCUMENT
def load (path):
data_raw = open(path + '.csv', encoding = 'utf-8').read().replace('\"', '').replace('\ufeff', '')
data_1row_1string = data_raw.split('\n')... | github_jupyter |
## Indexing in NumPy
### np.where vs masking
* np.where returns just the indices where the equivalent mask is true
* this is useful if you need the actual indices (maybe for counts)
* otherwise the shorthand notation (masking) is perhaps easier
* np.where returns a tuple
### Why do I care?
You may need ... | github_jupyter |
## Bayesian Optimisation Verification
```
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
from matplotlib.colors import LogNorm
from scipy.interpolate import interp1d
from scipy import interpolate
from sklearn.gaussian_process import GaussianProcessRegressor
from sklearn.gaussian_process.ke... | github_jupyter |
```
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeClassifier
from IPython.display import Image
from sklearn import tree
from os import system
from sklearn.metric... | github_jupyter |
# How to create Data objects
The SciDataTool python module has been created to **ease the handling of scientific data**, and considerately simplify plot commands. It unifies the extraction of relevant data (e.g. slices), whether they are stored in the time/space or in the frequency domain. The call to Fourier Transfor... | github_jupyter |
**On my honor I have neither given nor received any unauthorized aid.**
**Your name here**
# Test 2
On this test we are going use a dataset that researchers collected about 649 high school students in Portugal, and attempt to determine how their grades are affected by several of the variables that they collected inf... | github_jupyter |
# MODIS
MODIS Terra: https://lpdaac.usgs.gov/products/mod11c1v006/
MODIS Acqua: https://lpdaac.usgs.gov/products/myd11c1v061/
Docs: https://lpdaac.usgs.gov/documents/118/MOD11_User_Guide_V6.pdf
```
! wget https://e4ftl01.cr.usgs.gov/MOLA/MYD11C1.061/2018.04.19/MYD11C1.A2018109.061.2021330052306.hdf -O /network/gr... | github_jupyter |
# ODE solver
In this notebook, we show some examples of solving an ODE model. For the purposes of this example, we use the Scipy solver, but the syntax remains the same for other solvers
```
%pip install pybamm -q # install PyBaMM if it is not installed
import pybamm
import tests
import numpy as np
import os
impor... | github_jupyter |
## 初始化
```
import sys,os
root_path = os.path.abspath('../../../../')
sys.path.append(root_path)
root_path
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import src.features.factors.consolidate_factor as cf
import src.visualization.plotting as pt
```
## 整理数据
```
fp = roo... | github_jupyter |
<a href="https://colab.research.google.com/github/muhdlaziem/DR/blob/master/Testing_3_all.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
```
from google.colab import drive
drive.mount('/gdrive')
%cd /gdrive/'My Drive'/
%tensorflow_version 1.x
# im... | github_jupyter |
[View in Colaboratory](https://colab.research.google.com/github/DillipKS/MLCC_assignments/blob/master/feature_sets.ipynb)
#### Copyright 2017 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 ... | github_jupyter |
### Note
* Instructions have been included for each segment. You do not have to follow them exactly, but they are included to help you think through the steps.
```
# Dependencies and Setup
import pandas as pd
# File to Load (Remember to Change These)
HeroesOfPymoli = "Resources/purchase_data.csv"
# Read Purchasing F... | github_jupyter |
# Population Segmentation with SageMaker
In this notebook, we'll employ two, unsupervised learning algorithms to do **population segmentation**. Population segmentation aims to find natural groupings in population data that reveal some feature-level similarities between different regions in the US.
Using **principal ... | github_jupyter |
<a href="https://colab.research.google.com/github/desaibhargav/VR/blob/main/notebooks/Semantic_Search.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
## **Dependencies**
```
!pip install -U -q sentence-transformers
!git clone https://github.com/des... | github_jupyter |
# Think Bayes: Chapter 7
This notebook presents code and exercises from Think Bayes, second edition.
Copyright 2016 Allen B. Downey
MIT License: https://opensource.org/licenses/MIT
```
from __future__ import print_function, division
% matplotlib inline
import warnings
warnings.filterwarnings('ignore')
import math... | github_jupyter |
# Adsorbed Phases on Graphene
```
import numpy as np
import matplotlib.pyplot as plt
from graphenetools import gt
import re,glob,os,sys
from scipy.signal import argrelextrema
import dgutils.colors as colortools
import dgutils.pypov as pypov
from collections import defaultdict
import importlib
from PIL import Image,Ima... | github_jupyter |
# USGS Earthquakes with the Mapboxgl-Jupyter Python Library
https://github.com/mapbox/mapboxgl-jupyter
```
# Python 3.5+ only!
import asyncio
from aiohttp import ClientSession
import json, geojson, os, time
import pandas as pd
from datetime import datetime, timedelta
from mapboxgl.viz import *
from mapboxgl.utils impo... | github_jupyter |
Using min and max in another way
Just passing minrange and maxrange
r
/ \
/ \
min, r-1 r, max
```
import queue
class BinaryTreeNode:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
def minTree(root)... | github_jupyter |
```
# Tensorflowが使うCPUの数を制限します。(VMを使う場合)
%env OMP_NUM_THREADS=1
%env TF_NUM_INTEROP_THREADS=1
%env TF_NUM_INTRAOP_THREADS=1
from tensorflow.config import threading
num_threads = 1
threading.set_inter_op_parallelism_threads(num_threads)
threading.set_intra_op_parallelism_threads(num_threads)
#ライブラリのインポート
%matplotlib i... | github_jupyter |
<a href="http://colab.research.google.com/github/dipanjanS/nlp_workshop_odsc19/blob/master/Module05%20-%20NLP%20Applications/Project07C%20-%20Text%20Classification%20Deep%20Learning%20Sequential%20Models%20LSTMs.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Col... | github_jupyter |
```
%matplotlib inline
```
Saving and loading models for inference in PyTorch
==================================================
There are two approaches for saving and loading models for inference in
PyTorch. The first is saving and loading the ``state_dict``, and the
second is saving and loading the entire model.
... | github_jupyter |
## Autograd: automatic differentiation
Central to all neural networks in PyTorch is the `autograd` package. Let's first briefly visit this, and we will then go to train our first neural network.
The `autograd` package provides automatic differentiation for all operation on Tensors. It is a define-by-run framework, wh... | github_jupyter |
# Sampling the potential energy surface
## Introduction
This interactive notebook demonstrates how to utilize the Potential Energy Surface (PES) samplers algorithm of qiskit chemistry to generate the dissociation profile of a molecule. We use the Born-Oppenhemier Potential Energy Surface (BOPES)and demonstrate how t... | github_jupyter |
# Weight Initialization
In this lesson, you'll learn how to find good initial weights for a neural network. Weight initialization happens once, when a model is created and before it trains. Having good initial weights can place the neural network close to the optimal solution. This allows the neural network to come to ... | github_jupyter |
```
%load_ext autoreload
%autoreload 2
from os import path
import sys, inspect
current_dir = path.dirname(path.abspath(inspect.getfile(inspect.currentframe())))
parent_dir = path.dirname(current_dir)
sys.path.insert(0, parent_dir)
import numpy as np
import pandas as pd
import statsmodels.formula.api as smf
import mat... | github_jupyter |
# 實驗:實作InceptionV3網路架構
<table class="tfo-notebook-buttons" align="left">
<td>
<a target="_blank" href="https://colab.research.google.com/github/taipeitechmmslab/MMSLAB-TF2/blob/master/Lab8.ipynb"><img src="https://www.tensorflow.org/images/colab_logo_32px.png" />Run in Google Colab</a>
</td>
<td>
<a targ... | github_jupyter |
# Distribuciones de probabilidad
```
# Importamos librerías a trabajar en todas las simulaciones
import matplotlib.pyplot as plt
import numpy as np
from itertools import cycle # Librería para hacer ciclos
import scipy.stats as st # Librería estadística
from math import factorial as fac # Importo la operación fact... | github_jupyter |
```
%matplotlib notebook
import pickle
import numpy as np
import matplotlib.pyplot as plt
from refnx.reflect import SLD, Slab, ReflectModel, MixedReflectModel
from refnx.dataset import ReflectDataset as RD
from refnx.analysis import Objective, CurveFitter, PDF, Parameter, process_chain, load_chain
from FreeformVFP i... | github_jupyter |
# Iterative reconstruction of undersampled MR data
This demonstration shows how to hande undersampled data
and how to write a simple iterative reconstruction algorithm with
the acquisition model.
This demo is a 'script', i.e. intended to be run step by step in a
Python notebook such as Jupyter. It is organised in 'ce... | github_jupyter |
# k-Nearest Neighbor (kNN) exercise
*Complete and hand in this completed worksheet (including its outputs and any supporting code outside of the worksheet) with your assignment submission. For more details see the [assignments page](http://vision.stanford.edu/teaching/cs231n/assignments.html) on the course website.*
... | github_jupyter |
### Forced Alignment with Wav2Vec2
In this notebook we are going to follow [this pytorch tutorial](https://pytorch.org/tutorials/intermediate/forced_alignment_with_torchaudio_tutorial.html) to align script to speech with torchaudio using the CTC segmentation algorithm described in [ CTC-Segmentation of Large Corpora f... | github_jupyter |
```
"""Keras-ImageDataGenerator
『本次練習內容』
學習使用Keras-ImageDataGenerator 與 Imgaug 做圖像增強
『本次練習目的』
熟悉Image Augmentation的實作方法
瞭解如何導入Imgae Augmentation到原本NN架構中"""
from keras.models import Sequential
from keras.layers import Convolution2D
from keras.layers import MaxPooling2D
from keras.layers import Flatten
from keras.layers ... | github_jupyter |
```
import pandas as pd
import random
```
### Read the data
```
movies_df = pd.read_csv('mymovies.csv')
ratings_df = pd.read_csv('myratings.csv')
```
### Select the data
The recommender system should avoid bias, for example, the recommender system should not recommend movie with just 1 rating which is also a 5-star ... | github_jupyter |
# Call stacks and recursion
In this notebook, we'll take a look at *call stacks*, which will provide an opportunity to apply some of the concepts we've learned about both stacks and recursion.
### What is a *call stack*?
When we use functions in our code, the computer makes use of a data structure called a **call sta... | github_jupyter |
<a href="https://colab.research.google.com/github/RajArPatra/MIDAS-task-2/blob/main/Results_Summary.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
Libraries
```
from sklearn.preprocessing import StandardScaler,MinMaxScaler
import pandas as pd
impo... | github_jupyter |
# How many cases of COVID-19 does each U.S. state really have?
> Reported U.S. case counts are based on the number of administered tests. Since not everyone is tested, this number is biased. We use Bayesian techniques to estimate the true number of cases.
- author: Joseph Richards
- image: images/covid-state-case-esti... | github_jupyter |
```
%matplotlib inline
%pylab inline
from parsing import parser, digit
from plotting import plotter, voronoi
from analysis import training, sampling, testing, classify
from config import settings
import warnings
warnings.filterwarnings('ignore')
n_observation_classes = 256
n_hidden_states = 30
n_iter = 10000
tol = 0.1... | github_jupyter |
# GLM: Logistic Regression
* This is a reproduction with a few slight alterations of [Bayesian Log Reg](http://jbencook.github.io/portfolio/bayesian_logistic_regression.html) by J. Benjamin Cook
* Author: Peadar Coyle and J. Benjamin Cook
* How likely am I to make more than $50,000 US Dollars?
* Exploration of model ... | github_jupyter |
# Indian food analysis
Firstly please read docs.md
## Table of contents
* Data preparation
* Load original dataset into dataframes
* Data cleansing
* Save dataset
* Load cleansed dataset
* Analysis
* Top 30 popular songs of all time
* Analyze by a single song
* Analyze track duration with ... | github_jupyter |
```
import numpy
from keras.models import Sequential
from keras.layers import Dense, Dropout, Flatten, Activation
from keras.layers.convolutional import Conv2D, MaxPooling2D
from keras.layers.normalization import BatchNormalization
from keras.utils import to_categorical
from keras import backend as K
from keras.wrappe... | github_jupyter |
```
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
from scipy.stats import zscore
import sklearn.preprocessing as preproc
from sklearn.cluster import KMeans, DBSCAN
from collections import Counter
from pract2_utils import *
RESULTS='results/accidentes/'
DATA='data/accidente... | github_jupyter |
```
import os
import sys
import numpy as np
import pandas as pd
from scipy.io import mmread
from scipy.linalg import hessenberg
import scipy.linalg as sl
sys.path.append("../qr")
from qr import *
import sympy as sp
a = np.random.default_rng().random(size = (10, 10))
%%timeit
max(a[0])
%%timeit
np.max(a[0])
path = "..... | github_jupyter |
```
import os
import sys
module_path = os.path.abspath('..')
sys.path.append(module_path)
from lc.measurements import CurveMeasurements
from lc.curve import LearningCurveEstimator
from omegaconf import OmegaConf
```
Load error measurements using `CurveMeasurements`. See `notebooks/measurements.ipynb` for more about re... | github_jupyter |
<h3 style='color:blue'>Exercise: GPU performance for fashion mnist dataset</h3>
This notebook is derived from a tensorflow tutorial here: https://www.tensorflow.org/tutorials/keras/classification
So please refer to it before starting work on this exercise
You need to write code wherever you see `your code goes here` ... | github_jupyter |
# Chapter 7
This is the seventh in a series of notebooks related to astronomy data.
As a continuing example, we will replicate part of the analysis in a recent paper, "[Off the beaten path: Gaia reveals GD-1 stars outside of the main stream](https://arxiv.org/abs/1805.00425)" by Adrian M. Price-Whelan and Ana Bonaca.... | github_jupyter |
# Exercises
## Playing with the interpreter
Try to execute some simple statements and expressions (one at a time) e.g
```
print("Hello!")
1j**2
1 / 2
1 // 2
5 + 5
10 / 2 + 5
my_tuple = (1, 2, 3)
my_tuple[0] = 1
2.3**4.5
```
Do you understand what is going on in all cases?
Most Python functions and objects can provide... | github_jupyter |
<h1> Data Transformation </h1>
## Logistic Regression - on [Titanic Dataset](https://www.kaggle.com/c/titanic)
- Models the probability an object belongs to a class
- Values ranges from 0 to 1
- Can use threshold to classify into which classes a class belongs
- An S-shaped curve
$
\begin{align}
\sigma(t) = \frac{1}{... | github_jupyter |
**_Privacy and Confidentiality Exercises_**
This notebook shows you how to prepare your results for export and what you have to keep in mind in general when you want to export output. You will learn how to prepare files for export so they meet our export requirements.
```
# Load packages
%pylab inline
from __future__... | github_jupyter |
```
import pandas as pd
import os
import glob
import shutil
import random
import time
from sklearn.ensemble import RandomForestRegressor
from sklearn.metrics import mean_squared_error
import pickle
import numpy as np
es_url = 'http://ckg07:9200'
es_index = 'wikidatadwd-augmented'
# GDrive Path: /table-linker-dataset/2... | github_jupyter |
# Logistic Regression with Hyperparameter Optimization (scikit-learn)
<a href="https://colab.research.google.com/github/VertaAI/modeldb/blob/master/client/workflows/examples-without-verta/notebooks/sklearn-census.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In C... | github_jupyter |
# Sesiones prácticas
## 0
Instalación de Python + ecosistema científico + opencv + opengl
- aula virtual -> página web -> install
- git o unzip master
- anaconda completo o miniconda
- linux, windows, mac
- probar scripts con webcam y verificar opengl, dlib etc.
- manejo básico de jupyter
- repaso Python
- Ejercicio... | github_jupyter |
# Other widget libraries
We would have loved to show you everything the Jupyter Widgets ecosystem has to offer today, but we are blessed to have such an active community of widget creators and unfortunately can't fit all widgets in a single session, no matter how long.
This notebook lists some of the widget librarie... | github_jupyter |
[Schema](Schema.ipynb) <- vorige - [Inhoudsopgave](Inhoud.ipynb) - volgende -> [JSON-LD en linked data](json-ld-linked-data.ipynb)
# JSON-schema
Met JSON-schema kun je schema's voor JSON-objecten maken.
Deze kun je gebruiken als documentatie van JSON-objecten die bijvoorbeeld in een web-API gebruikt worden.
Vervolgen... | github_jupyter |
```
from IPython import display
from torch.utils.data import DataLoader
from torchvision import transforms, datasets
from utils import Logger
import tensorflow as tf
import numpy as np
DATA_FOLDER = './tf_data/VGAN/MNIST'
IMAGE_PIXELS = 28*28
NOISE_SIZE = 100
BATCH_SIZE = 100
def noise(n_rows, n_cols):
return n... | github_jupyter |
# 基本程序设计
- 一切代码输入,请使用英文输入法
```
print('hello world')
```
## 编写一个简单的程序
- 圆公式面积: area = radius \* radius \* 3.1415
```
radius = int(input('请输入一个半径:'))
area = radius * radius * 3.1433223
print(area)
```
### 在Python里面不需要定义数据的类型
## 控制台的读取与输入
- input 输入进去的是字符串
- eval
- 在jupyter用shift + tab 键可以跳出解释文档
## 变量命名的规范
- 由字母、数... | github_jupyter |
# Import Required Packages
```
# Imports
import os
import datetime
import glob
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import time
```
# Input data from User
```
#Market analysed: 'Investment','FullYear','DayAhead','Balancing' (choose one or several)
market_analysed=['DayAhead','Balanc... | github_jupyter |
# Mining the Social Web, 2nd Edition
## Appendix B: OAuth Primer
This IPython Notebook provides an interactive way to follow along with and explore the numbered examples from [_Mining the Social Web (3rd Edition)_](http://bit.ly/Mining-the-Social-Web-3E). The intent behind this notebook is to reinforce the concepts f... | github_jupyter |
# Homework 9 - Berkeley STAT 157
**Your name: XX, SID YY, teammates A,B,C** (Please add your name, SID and teammates to ease Ryan and Rachel to grade.)
**Please submit your homework through [gradescope](http://gradescope.com/)**
Handout 4/18/2019, due 4/25/2019 by 4pm.
This homework deals with sequence models for ... | github_jupyter |
# 2 Data Acquisition
In this chapter we will discuss data acquisition and data formatting for four online Assyriological projects: [ORACC](http://oracc.org) (2.1), [ETCSL](https://etcsl.orinst.ox.ac.uk/), (2.2) [CDLI](http://cdli.ucla.edu) (2.3) and [BDTNS](http://bdtns.filol.csic.es/) (2.4).
The data in [CDLI](http... | github_jupyter |
# Hello World API with Flask
```
# We'll create the script - we created our folder structure with cookiecutter
import os
hello_world_script_file = os.path.join(os.path.pardir,'src','models','hello_world_api2.py')
%%writefile $hello_world_script_file
from flask import Flask, request
app = Flask(__name__)
@app.route(... | github_jupyter |
```
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import dill as pickle
import os, sys
import scipy.interpolate as intp
import bead_util as bu
plt.rcParams['figure.figsize'] = (12,8)
plt.rcParams['xtick.labelsize'] = 15
plt.rcParams['ytick.labelsize'] = 15
%matplotlib inline
from symmetric_attr... | github_jupyter |
```
#default_exp data.transform
#export
from local.torch_basics import *
from local.test import *
from local.notebook.showdoc import show_doc
from PIL import Image
```
# Transforms
## Helpers
```
#exports
def type_hints(f):
"Same as `typing.get_type_hints` but returns `{}` if not allowed type"
return typing.... | github_jupyter |
# Text Generation with Neural Networks
Import necessary packages for preprocessing, model building, etc. We follow the steps described in the theoretical part of this summer school as follows:
0. Define Reseach Goal (already done)
2. Retrieve Data
3. Prepare Data
4. Explore Data
5. Model Data
6. Present and automate ... | github_jupyter |
```
##take Max cosine/jaccard similarity from 5 annotators
from sklearn.metrics import cohen_kappa_score
import pandas as pd
import sklearn
from rouge_score import rouge_scorer
from similarity.cosine import Cosine
from similarity.jaccard import Jaccard
import numpy as np
def compute_similarity_cosine(text1,text2):
... | github_jupyter |
## Variant of the Blocked Input Model in which the stop process decelerates the go process by a rate that varies across trials
```
import numpy
import random
import matplotlib.pyplot as plt
import matplotlib
import seaborn
import pandas
import matplotlib.patches as patches
from matplotlib.ticker import FormatStrFormat... | github_jupyter |
# ELEC 400M / EECE 571M Assignment 2: Neural networks
(This assignment is a modified version of an assignment used in ECE 421 at the University of Toronto and kindly made available to us by the instructor.)
In this assignment, you will implement a neural network model for multi-class classification. The purpose is to ... | github_jupyter |
```
!pip install --upgrade progressbar2
from torch import nn
from collections import OrderedDict
import torch.nn.functional as F
import torch
from torch.utils.data import DataLoader
import torchvision
import random
from torch.utils.data import Subset
from matplotlib import pyplot as plt
from torchsummary import summary... | github_jupyter |
## Quaxis Corporation for Research & Innovation 2020
### Written by: JP Aldama
#### MIT License, feel free to do whatever you want with this code.
### Goal: Object detection using opencv-python and numpy.
***Requirements: opencv-python, numpy. It is highly recommended to install Anaconda for python 3.x. Using cv2 we w... | github_jupyter |
<table>
<tr><td><img style="height: 150px;" src="images/geo_hydro1.jpg"></td>
<td bgcolor="#FFFFFF">
<p style="font-size: xx-large; font-weight: 900; line-height: 100%">AG Dynamics of the Earth</p>
<p style="font-size: large; color: rgba(0,0,0,0.5);">Jupyter notebooks</p>
<p style="font-size: large; color: ... | github_jupyter |

## Amazon Access Samples Data Set
Let's apply our boosting algorithm to a real dataset! We are going to use the __Amazon Access Samples dataset__.
We download this dataset from UCI ML repository from this [link](https://archive.ics.uci.edu/ml/datasets/Amazon+Access+Samples).... | github_jupyter |
## Preprocessing
```
# Import our dependencies
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
import pandas as pd
import tensorflow as tf
# Import and read the charity_data.csv.
import pandas as pd
application_df = pd.read_csv("/Users/melissa/Downloads/Deep Lea... | github_jupyter |
# ML Scripts
So far, we've done everything inside the Jupyter notebooks but we're going to now move our code into individual python scripts. We will lay out the code that needs to be inside each script but checkout the `API` lesson to see how it all comes together.
<div align="left">
<a href="https://github.com/madew... | github_jupyter |
# Model Selection, Underfitting, and Overfitting
:label:`sec_model_selection`
As machine learning scientists,
our goal is to discover *patterns*.
But how can we be sure that we have
truly discovered a *general* pattern
and not simply memorized our data?
For example, imagine that we wanted to hunt
for patterns among ge... | github_jupyter |
```
import numpy as np
import math
import random
import pandas as pd
import os
import matplotlib.pyplot as plt
import cv2
import glob
import gc
from google.colab import files
src = list(files.upload().values())[0]
open('utils.py','wb').write(src)
from utils import *
from tqdm import tqdm
import pickle
from keras.optim... | github_jupyter |
# Face Recognition & Verification for Person Identification
Inspired by Coursera deeplearning.ai's assignment of programming a face recognition for happy house, I wanted to give it a try implementing a face recognition system by using face detection library(https://github.com/ageitgey/face_recognition) and face_recogn... | github_jupyter |
<a href="https://colab.research.google.com/github/meisben/docs/blob/master/bmcCompletedTutorials/tutorials/keras/basic_text_classification.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
##### Copyright 2018 The TensorFlow Authors.
```
#@title Lice... | github_jupyter |
# Fetching Hydrology Data
We have prepared shapefiles containing the USGS quarter quadrangles that have good coverage of forest stand delineations that we want to grab other data for.
# Mount Google Drive
So we can access our files showing tile locations, and save the rasters we will generate from the elevation data.... | github_jupyter |
[Table of Contents](http://nbviewer.ipython.org/github/rlabbe/Kalman-and-Bayesian-Filters-in-Python/blob/master/table_of_contents.ipynb)
# Installation
```
#format the book
%matplotlib inline
from __future__ import division, print_function
from book_format import load_style
load_style()
```
This book is written in J... | github_jupyter |
```
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm
import os
kdata = np.load('KeplerSampleFullQ.npy',encoding='bytes')
print(kdata.shape)
print(len(kdata[250][0]))
import os
dmints = [-1.2,-0.3,-0.1,-0.05, -0.02,-0.01, -0.006, -0.005, -0.004, -0.0012,
... | github_jupyter |
# [ATM 623: Climate Modeling](index.ipynb)
A graduate-level course on the hands-on use of climate models for understanding climate processes.
### [Brian E. J. Rose](http://www.atmos.albany.edu/facstaff/brose/index.html)
University at Albany, Department of Atmospheric and Environmental Sciences
[Course home page](ht... | github_jupyter |
```
import ipywidgets as W
from wxyz.jsonld.widget_jsonld import Expand, Compact, Flatten, Frame, Normalize
from wxyz.lab.widget_dock import DockBox
from wxyz.lab.widget_editor import Editor
from wxyz.core.widget_json import JSON
flex = lambda x=1: dict(layout=dict(flex=f"{x}"))
context = JSON("""{
"@context": {
... | github_jupyter |
# A Whirlwind Tour of Python
*Jake VanderPlas*
<img src="fig/cover-large.gif">
These are the Jupyter Notebooks behind my O'Reilly report,
[*A Whirlwind Tour of Python*](http://www.oreilly.com/programming/free/a-whirlwind-tour-of-python.csp).
The full notebook listing is available [on Github](https://github.com/jakev... | github_jupyter |
## Content-Based Filtering Using Neural Networks
This notebook relies on files created in the [content_based_preproc.ipynb](./content_based_preproc.ipynb) notebook. Be sure to run the code in there before completing this notebook.
Also, we'll be using the **python3** kernel from here on out so don't forget to change... | github_jupyter |
```
import pandas as pd
import numpy as np
from sklearn.decomposition import PCA
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.preprocessing import scale
wines=pd.read_csv("wine.csv")
wines
wines.describe()
wines.info()
wines_ary=wines.values
wines_ary
wines_normal = scale(wines_ary)
wines_normal
`... | github_jupyter |
## Final rescale for paper 1
Final figures for the scaling section of paper 1 and cleaner fits for:
* Maximum and minimum squeezing of isopyncals (max $N^2/N^2_0$, min $N^2/N^2_0$ )
* Effective stratification ($N_{eff}$)
* Upwelling flux induced by the canyon ($\Phi$)
* Maximum and minimum squeezing of isopyncals is... | github_jupyter |
```
# import packages
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from scipy.optimize import fmin_bfgs
%matplotlib inline
#loc = 'https://raw.githubusercontent.com/chenyuw1/coursera-ml-hw/master/hw2/ex2data2.txt'
loc = r'C:\Users\c0w00f8.WMSC\Documents\Coursera\1. Machi... | github_jupyter |
# 循环结构
在程序中我们需要执行重复重复再重复的东东,使用循环结构。
一种是for-in循环
一种是while循环
```
"""
for循环实现1~100 求和
"""
sum = 0
for x in range(101):
sum += x
print(sum)
sum = 0
for x in range(1,101):
sum += x
print(sum)
####偶数求和
sum = 0
for x in range(2,101,2):
sum += x
print(sum)
```
while循环 :常用于死循环进行取值
```
"""
for循环实现1~100 求和
"""
s... | github_jupyter |
This notebook contains a bunch of experiments to determine the optimal learning rate value for different optimizers. The reference model is a CNN with 3 convolutional blocks; the dataset is an augmented version of the CBIS dataset.
# Environment setup
```
# Connect to Google Drive
from google.colab import drive
driv... | github_jupyter |
# Converting between the 4-metric $g_{\mu\nu}$ and ADM variables $\left\{\gamma_{ij}, \alpha, \beta^i\right\}$ or BSSN variables $\left\{h_{ij}, {\rm cf}, \alpha, {\rm vet}^i\right\}$
## Author: Zach Etienne
[comment]: <> (Abstract: TODO)
### We will often find it useful to convert between the 4-metric $g_{\mu\nu}$ a... | github_jupyter |
### Load Test deployed web application
This notebook pulls some images and tests them against the deployed web application. We submit requests asychronously which should reduce the contribution of latency.
```
import asyncio
import json
import random
import urllib.request
from timeit import default_timer
import aioht... | github_jupyter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.