text stringlengths 2.5k 6.39M | kind stringclasses 3
values |
|---|---|
<a href="https://colab.research.google.com/github/john-s-butler-dit/Numerical-Analysis-Python/blob/master/Chapter%2004%20-%20Multistep%20Methods/403_Adams%20Moulton%20Example.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Adams Moulton
#### John ... | github_jupyter |
# Building your Deep Neural Network: Step by Step
Welcome to your week 4 assignment (part 1 of 2)! You have previously trained a 2-layer Neural Network (with a single hidden layer). This week, you will build a deep neural network, with as many layers as you want!
- In this notebook, you will implement all the functio... | github_jupyter |
# Analysis of Gray code vs one-hot tomography results for level 2 and level 3 optimization
```
import warnings
warnings.filterwarnings(action='once')
import numpy as np
np.warnings.filterwarnings('ignore')
import pickle
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style('whitegrid')
sns.set(rc={'fi... | github_jupyter |
# k-Nearest Neighbor (kNN) implementation
*Credits: this notebook is deeply based on Stanford CS231n course assignment 1. Source link: http://cs231n.github.io/assignments2019/assignment1/*
The kNN classifier consists of two stages:
- During training, the classifier takes the training data and simply remembers it
- D... | github_jupyter |
# prev
### test = 1:1
```
!cat /home/kesci/data/competition_A/train_set.csv | head -n 2
!cat /home/kesci/data/competition_A/test_set.csv | head -n 1
!./kesci_submit -token ***************** -file /home/kesci/work/sub.csv
```
# data_pre
## train
```
import pandas as pd
import gc
train = pd.read_csv('/home/kesci/dat... | github_jupyter |
# Using `tables_io.TableDict`
The class `tables_io.TableDict` is just an Ordered Dictionary of Tables.
The Tables can be in any of the formats that `tables_io` supports, see more on that in the notebook below.
Let's have a look
```
# Standard imports
import os
import numpy as np
import tables_io
from tables_io.tes... | github_jupyter |
```
%pylab inline
%load_ext autoreload
%autoreload 2
import os
import sprinter
import getpass
qfib_dir = '/home/'+getpass.getuser()+'/Dropbox/TRAKODATA/qfib-data/'
qfib_ext = '.tck'
dpy_dir = '/home/'+getpass.getuser()+'/Dropbox/TRAKODATA/qfib-data/'
dpy_ext = '.tck'
tko_dir = '/home/'+getpass.getuser()+'/Dropbox/TRAKO... | github_jupyter |
# Amazon SageMaker Notebook for ProcGen Starter Kit with homogeneous scaling of multiple CPU instances
```
import os
import time
import yaml
import sagemaker
from sagemaker.rl import RLEstimator, RLToolkit, RLFramework
import boto3
from IPython.display import HTML, Markdown
from source.common.docker_utils import bui... | github_jupyter |
# NOAA HRES Optimum Interpolated V2 SST Data (Daily Update)
```
%matplotlib inline
#using xarray for data read
import xarray as xa
#using Cartopy for mapping
import matplotlib.pyplot as plt
import cmocean
import cartopy.crs as ccrs
import cartopy.feature as cfeature
from cartopy.io import shapereader
from cartopy.mpl... | github_jupyter |
# Keras's Finetune
keras ๅฎ็ฐ็บฟๆงๆจกๅ
```
from utils import *
from keras.optimizers import SGD, RMSprop, Adam
x = random((30, 2))
x[:3]
y = x.dot([2., 3.]) + 1.
y[:3]
lm = Sequential([Dense(1, input_shape=(2,))])
lm.compile(optimizer=SGD(lr=.1), loss='mse')
lm.fit(x, y, nb_epoch=10, batch_size=1)
lm.get_weights()
```
VGG... | github_jupyter |
Copyright (c) Microsoft Corporation.
Licensed under the MIT License.
# Train your own Model and Deploy to Device
**NOTE**
* Warning: copying *.pb, *.bin, or, *.blob using the web interface can corrupt the files. If needed download and use Azure storage explorer or the CL.
* You can run all the cells (after you manual... | github_jupyter |
# Variability in the Arm Endpoint Stiffness
In this notebook, we will calculate the feasible endpoint stiffness of a
simplified arm model for an arbitrary movement. The calculation of the feasible
muscle forces and the generation of the movement is presented in
feasible_muscle_forces.ipynb. The steps are as follows:
... | github_jupyter |
### Minimum Spanning Tree
Minimum spanning tree is a subset of a graph, where every vertex is connected to at least one other vertex, but at most connected to two other vertices, that indicates no cycle, and the total weight of the graph is the minimum possible. Lol, long definition!
```
import os
os.... | github_jupyter |
# Cavity flow with Navier-Stokes
The final two steps will both solve the NavierโStokes equations in two dimensions, but with different boundary conditions.
The momentum equation in vector form for a velocity field vโ
is:
$$ \frac{\partial \overrightarrow{v}}{\partial t} + (\overrightarrow{v} \cdot \nabla ) \overri... | github_jupyter |
```
import cmath
import math
import numpy as np
import qiskit
import matplotlib.pyplot as plt
from qiskit import QuantumCircuit
from typing import Optional, List, Dict
from qiskit_aws_braket_provider.awsprovider import AWSProvider
def compute_rotation(index_state):
if len(index_state) != 2:
return None, ... | github_jupyter |
```
# Initialize OK
from client.api.notebook import Notebook
ok = Notebook('hw01.ok')
# Run this cell, but please don't change it.
# These lines import the Numpy and Datascience modules.
import numpy as np
from datascience import *
np.set_printoptions(threshold=50)
# These lines do some fancy plotting magic
import m... | github_jupyter |
```
import os
import random
import torch
import torchvision.transforms as standard_transforms
import scipy.io as sio
import matplotlib
import pandas as pd
import misc.transforms as own_transforms
import warnings
from torch.autograd import Variable
from torch.utils.data import DataLoader
from PIL import Image, ImageOp... | github_jupyter |
```
import os
os.environ['CUDA_VISIBLE_DEVICES'] = ''
# !git pull
import tensorflow as tf
import malaya_speech
import malaya_speech.train
from malaya_speech.train.model import tacotron2_nvidia as tacotron2
import numpy as np
input_ids = tf.placeholder(tf.int32, [1, None])
input_lengths = tf.placeholder(tf.int32, [1])
... | github_jupyter |
Copyright 2016 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wri... | github_jupyter |
# Evolutionary optimization of a whole-brain model
This notebook provides an example for the use of the evolutionary optimization framework built-in to the library. Under the hood, the implementation of the evolutionary algorithm is powered by `deap` and `pypet` cares about the parallelization and storage of the simul... | github_jupyter |
# 04 - Test and deploy a TFX training pipeline to `Vertex Pipelines`
The purpose of this notebook is to test, deploy, and run the `TFX` pipeline on `Vertex Pipelines`. The notebook covers the following tasks:
1. Run the tests locally.
2. Run the `TFX` pipeline using `Vertex Pipelines`
3. Execute the pipeline deployme... | github_jupyter |
```
import os
import sys
script_dir = os.getcwd()
root_dir = f"{script_dir}/../../"
sys.path.append(os.path.join(root_dir, "dpc"))
import numpy as np
import scipy.io
import imageio
import matplotlib.pyplot as plt
%matplotlib inline
import open3d
from open3d import JVisualizer
from util.system import setup_envir... | github_jupyter |
#### New to Plotly?
Plotly's Python library is free and open source! [Get started](https://plot.ly/python/getting-started/) by downloading the client and [reading the primer](https://plot.ly/python/getting-started/).
<br>You can set up Plotly to work in [online](https://plot.ly/python/getting-started/#initialization-fo... | github_jupyter |
```
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
from sklearn import datasets, svm, metrics
from sklearn.model_selection import train_test_split
from shapkit.shapley_values import ShapleyValues
from shapkit.inspector import inspector
from shapkit.monte_carlo_shapley import... | github_jupyter |
## HDFS File Permissions
Let us go through file permissions in HDFS.
```
%%HTML
<iframe width="560" height="315" src="https://www.youtube.com/embed/I8ZCZYQTaVU?rel=0&controls=1&showinfo=0" frameborder="0" allowfullscreen></iframe>
```
* As we create the files, we can check the permissions on them using `-ls`... | github_jupyter |
# SqueezeNet v1.1
original repo: **https://github.com/DeepScale/SqueezeNet**
for keras: **https://github.com/rcmalli/keras-squeezenet** (pretrained imagenet weights downloaded from here)
```
$ wget -O squeezenet_v1.1.h5 https://github.com/rcmalli/keras-squeezenet/releases/download/v1.0/squeezenet_weights_tf_dim_orde... | github_jupyter |
```
import math
import pylab
import numpy as np
import torch
import torch.nn as nn
from torch.utils.data import Dataset, DataLoader
def gen_data(N):
X = np.random.randn(N, 1)
w1 = 2.
b1 = 8.
sigma1 = 1e1 # ground truth
Y1 = X.dot(w1) + b1 + sigma1 * np.random.randn(N, 1)
w2 = 3
b2 = 3.
... | github_jupyter |
### Load Libraries
```
import pandas as pd
import numpy as np
import sys
import sqlite3
from sklearn.preprocessing import StandardScaler
from sklearn.neighbors import KDTree
from sklearn.neighbors import NearestNeighbors
import spotipy
from spotipy.oauth2 import SpotifyClientCredentials
import spotipy.util as util
... | 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 |
# About this Notebook
Bayesian probabilistic matrix factorization (BPMF) is a classical model in the recommender system field. In the following, we will discuss:
- What the BPMF is?
- How to implement BPMF mainly using Python `Numpy` with high efficiency?
- How to make data imputations with real-world spatiotempora... | github_jupyter |
# Introduction to Logistic Regression
Logistic regression is another technique borrowed by machine learning from the field of statistics.
It is the go-to method for binary classification problems (problems with two class values).Logistic Regression (also called Logit Regression) is commonly used to estimate the probab... | github_jupyter |
## Feature Selection using Random Shuffling
```
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor
from sklearn.metrics import roc_auc_score, mean_squared_error, r2_score
```
## Read Data
```
data = pd... | github_jupyter |
# Graph
Graphs can be used to represent many interesting things about our world, including systems of roads, airline flights from city to city, how the Internet is connected, or even the sequence of classes you must take to complete a major in computer science.
## Vocabulary and Definitions
- **Vertex**: A vertex (... | github_jupyter |
There are three different network topologies:
- Testing: AMST, AOFA, CERN, DENV, WASH, ATLA -> DENV (not SCinet)
- Calibers: AMST, AOFA, CERN, DENV, WASH, ATLA -> SCINET
- TCP: AMST, AOFA, CERN, DENV, WASH, ATLA -> SCINET
Each topology is handle by its own L2VPN VFC on each of the CORSA, by convention:
- Testing is br... | github_jupyter |
# Part 2 - Refine Data
The second step for analyzing the data is to perform some additional preparations and enrichments. While the first step of storing the data into the structured zone should be mainly a technical conversion without losing any information, this next step will integrate some data and also preaggrega... | github_jupyter |
# Pivot_Longer : One function to cover transformations from wide to long form.
```
import janitor
import numpy as np
import pandas as pd
```
Unpivoting(reshaping data from wide to long form) in Pandas is executed either through [pd.melt](https://pandas.pydata.org/docs/reference/api/pandas.melt.html), [pd.wide_to_long... | github_jupyter |
```
import os
import ee
import json
import requests
import requests_cache
from pprint import pprint
import pandas as pd
ee.Initialize()
im = ee.Image('projects/mapbiomas-workspace/public/collection2_3/mapbiomas_collection23_integration_v1')
with open('geoms.txt') as json_data:
d = json.load(json_data)
d[0]
def get... | github_jupyter |
Classification of handwritten digits
------------------------------------
*Fraida Fund*
In this notebook, we will explore the use of different techniques for
classification of handwritten digits, with a focus on:
- Classification accuracy (although we wonโt do any hyperparameter
tuning. Itโs possible to improv... | github_jupyter |
# Reinforcement Learning
Let's describe the "taxi problem". We want to build a self-driving taxi that can pick up passengers at one of a set of fixed locations, drop them off at another location, and get there in the quickest amount of time while avoiding obstacles.
Make sure you installed gym in your computer using p... | github_jupyter |
# MadMiner particle physics tutorial
# Appendix 2: Ensemble methods
Johann Brehmer, Felix Kling, Irina Espejo, and Kyle Cranmer 2018-2019
## (UNDER CONSTRUCTION)
Instead of using a single neural network to estimate the likelihood ratio, score, or Fisher information, we can use an ensemble of such estimators. That p... | github_jupyter |
# ะะตะบัะธั 15 "ะกัััะบัััั ะดะฐะฝะฝัั
: ะดะตัะตะฒัั"
### ะคะธะฝะฐะฝัะพะฒัะน ัะฝะธะฒะตััะธัะตั ะฟัะธ ะัะฐะฒะธัะตะปัััะฒะต ะ ะค, ะปะตะบัะพั ะก.ะ. ะะฐะบัััะธะฝ
ะะตัะตะฒะพ - ัะฒัะทะฝัะน ะฐัะธะบะปะธัะตัะบะธะน ะณัะฐั.
ะัะตะดััะฐะฒะปะตะฝะธะต ะดะตัะตะฒัะตะฒ: ะฐ โ ะธะตัะฐัั
ะธัะตัะบะฐั ััััะบัััะฐ, ะฑ โ ะผะฝะพะถะตััะฒะฐ, ะฒ โ ะปะธะฝะตะนะฝะพะต ะฟัะตะดััะฐะฒะปะตะฝะธะต

* __ะัะฐั__ (ะธะปะธ ัะตัั) ัะพััะพะธั ะธะท: ะฒะตััะธะฝ ะธะปะธ ัะทะปะพะฒ (vertic... | github_jupyter |
TSG068 - Show BDC HDFS status
=============================
Steps
-----
### Common functions
Define helper functions used in this notebook.
```
# Define `run` function for transient fault handling, hyperlinked suggestions, and scrolling updates on Windows
import sys
import os
import re
import json
import platform
i... | github_jupyter |
```
# Importation des modules
import pandas as pd
import nltk
nltk.download('punkt')
nltk.download('stopwords')
from nltk.corpus import stopwords
from nltk.stem.snowball import SnowballStemmer
stemmer = SnowballStemmer(language='french')
#Affichage de toutes les colonnes
pd.set_option('display.max_columns', 500)
#... | github_jupyter |
# Replication of Experiments
This notebook's goal is to attempt to replicate the experiments presented in Arash *et al.* using the ISCXTor2016 dataset provided by the Canadian Institute for Cybersecurity at the University of New Brunswick (CIC-UNB). The experiments in this work are split into Scenario-A and Scenario-B.... | github_jupyter |
This notebook is inspired but not limited by *Machine Learning In Action*.
All rights deserved by Diane(Qingyun Hu).
# 1. About kNN
## 1.1 Mechanism of kNN
kNN is a kind of supervised learning. It has no training process. The main idea is to classify an entry by taking the majority vote of it's closest k examples(la... | github_jupyter |
<a href="https://pymt.readthedocs.io"><img style="float: right" src="images/pymt-logo-header-text.png"></a>
# Dynamically changing a running model
In this tutorial we will learn how to:
* Use the `update_until` method
* The model grid
* Change the input values of a model while it's running
```
import matplotlib.pypl... | github_jupyter |
# Classifying Fashion-MNIST
Now it's your turn to build and train a neural network. You'll be using the [Fashion-MNIST dataset](https://github.com/zalandoresearch/fashion-mnist), a drop-in replacement for the MNIST dataset. MNIST is actually quite trivial with neural networks where you can easily achieve better than 9... | github_jupyter |
# Temperature-dependent solvation free energy and vapor-liquid equilibrium calculations
This ipython notebook calculates temperature-dependent solvation free energy and vapor-liquid equilibrium ratio for a dilue binary mixture at the saturation pressure of the solvent. Read documentation on solvation thermochemistry f... | github_jupyter |
```
%load_ext autoreload
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
import pymc3 as pm
import numpy as np
import theano.tensor as tt
import theano
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.preprocessing import OneHotEncoder
from pymc3.backends import HDF5, text
%autoreloa... | github_jupyter |
# Intro to Pandas
Pandas is a Python package for data analysis and exposes two new
data structures: Dataframes and Series.
- [Dataframes](http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.html) store tabular data consisting of rows and columns.
- [Series](https://pandas.pydata.org/pandas-docs/sta... | github_jupyter |
**Aims**:
- Explore best ways to present the data
- Prepare the publication-quality figure for the manuscript
```
%run notebook_setup.ipynb
%vault from pubmed_derived_data import literature
duplicated_doi = literature.doi.dropna()[literature.doi.dropna().duplicated()]
with_duplicated_doi = literature[literature.doi.... | github_jupyter |
```
from google.colab import drive
drive.mount('/content/gdrive')
import json
with open('/content/gdrive/My Drive/Colab Notebooks/jigsaw-unintended-bias-in-toxicity-classification/comments_videos_pewdiepie_4000.json') as json_data:
data = json.load(json_data)
!pip install pytorch-pretrained-bert
# Converting the line... | github_jupyter |
```
import numpy
import toyplot
numpy.random.seed(1234)
# Generate 8 sets of samples, each with different counts and distributions
datasets = []
for i in numpy.arange(8):
mean = numpy.random.uniform()
scale = numpy.random.uniform()
size = numpy.random.randint(100, 2000)
datasets.append(numpy.random.no... | github_jupyter |
# 6์ฅ ์
๋ ฅ๊ณผ ์ถ๋ ฅ
## 6.1 ํ๋ฉด ์ถ๋ ฅ
### ๊ธฐ๋ณธ ์ถ๋ ฅ
**[6์ฅ: 95ํ์ด์ง]**
```
print("Hello Python!!")
```
**[6์ฅ: 96ํ์ด์ง]**
```
print("Best", "python", "book") # ๊ณต๋ฐฑ์ด ์ฝ์
๋จ
```
**[6์ฅ: 96ํ์ด์ง]**
```
print("Best", "python", "book", sep = '!!!') # ์ฐ๊ฒฐ๋ฌธ์๋ฅผ !!!๋ก ์ง์
print("Best", "python", "book", sep = '\n') # ์ฐ๊ฒฐ๋ฌธ์๋ฅผ \n์ผ๋ก ์ง์
```
**[6์ฅ: 96ํ์ด์ง]*... | github_jupyter |
Lambda School Data Science
*Unit 2, Sprint 2, Module 4*
---
# Classification Metrics
## Assignment
- [ ] If you haven't yet, [review requirements for your portfolio project](https://lambdaschool.github.io/ds/unit2), then submit your dataset.
- [ ] Plot a confusion matrix for your Tanzania Waterpumps model.
- [ ] Co... | github_jupyter |
# Transformer model for predicting modalities in scRNA-seq
**Authors**<br>Vedu Mallela: GiwoTech, vedu.mallela@gmail.com<br>Simon Lee: UC Santa Cruz, siaulee@ucsc.edu
# Goal of the code
**TODO: explain algorithm**
# Libraries
Import all files and modules for this competition<br>
*below will provide documentation o... | github_jupyter |
# A Conceptual, Practical Introduction to Trax Layers
This notebook introduces the core concepts of the Trax library through a series of code samples and explanations. The topics covered in following sections are:
1. **Layers**: the basic building blocks and how to combine them into networks
1. **Data Streams**: ... | github_jupyter |
# Table of Contents
<p><div class="lev2 toc-item"><a href="#group-by-function;-reducer-generator" data-toc-modified-id="group-by-function;-reducer-generator-01"><span class="toc-item-num">0.1 </span>group by function; reducer generator</a></div>
```
sql="""
SELECT cc, sum(iso_num) AS x, sum(cc) AS xm, sum(... | github_jupyter |
## Summary
**Parameters**
- `SEQUENCE_GENERATION_METHOD`
- `STRUCTURE_ID`
- `SLURM_ARRAY_TASK_ID`
**Notes:**
- `astar` method should be given >= 64G memory in order to generate 200k sequences.
- `astar` cannot be ran in parallel.
**SLURM scripts**
```bash
export STRUCTURE_ID="4beuA02"
SEQUENCE_GENERATION_METHOD... | github_jupyter |
```
!pip install pandas
!pip install xlrd
!pip install sklearn
!pip install imblearn
import xlrd
book = xlrd.open_workbook("Datasheets info.xlsx")
sheetMQ2 = book.sheet_by_name("MQ2 - Pololulu")
sheetMQ3 = book.sheet_by_name("MQ3 - Sparkfun")
sheetMQ4 = book.sheet_by_name("MQ4 - Sparkfun")
sheetMQ5 = book.sheet_by_name... | github_jupyter |
<center> <h1>Realismo local y realismo no local</h1>
<h2> Desigualdades de Bell </h2></center>
Para ejemplificar esto, asumamos que se generan parejas de fotones que estรกn mรกximamente entrelazados en el cristal del centro con frecuencias $\nu_A$ y $\nu_B$ en direcciones opuestas. รstos, serรกn detectados por un par de ... | github_jupyter |
# Visualizing Time Series Data
```
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.dates as dates
%matplotlib inline
df_apple = pd.read_csv('data/apple_stock.csv',index_col='Date',parse_dates=True)
df_apple.head()
# Adj.Close ์ Adj.Volume ์ variance ๋ฌธ์ ๋ก ๋ณด๊ธฐ ๋ถํธํจ.
df_apple[['Volume','Adj Close']].p... | github_jupyter |
[](http://rpi.analyticsdojo.com)
<center><h1>Basic Text Feature Creation in Python</h1></center>
<center><h3><a href = 'http://rpi.analyticsdojo.com'>rpi.analyticsdojo.com</a></h3></center>
```
!wget http... | github_jupyter |
# [Chapter 2] ๋จธ์ ๋ฌ๋ ํ๋ก์ ํธ ์ฒ์๋ถํฐ ๋๊น์ง
**โ๏ธ ์์ ํ๋ก์ ํธ ์ฃผ์ ๋จ๊ณ**
1. ํฐ ๊ทธ๋ฆผ์ ๋ณธ๋ค.
2. ๋ฐ์ดํฐ๋ฅผ ๊ตฌํ๋ค.
3. ๋ฐ์ดํฐ๋ฅผ ํ์ํ๊ณ ์๊ฐํํ๋ค.
4. ๋ฐ์ดํฐ๋ฅผ ์ค๋นํ๋ค.
5. ๋ชจ๋ธ์ ์ ํํ๊ณ ํ๋ จ์ํจ๋ค.
6. ๋ชจ๋ธ์ ์์ธํ๊ฒ ์กฐ์ ํ๋ค.
7. ์๋ฃจ์
์ ์ ์ํ๋ค.
8. ์์คํ
์ ๋ก ์นญํ๊ณ ๋ชจ๋ํฐ๋งํ๊ณ ์ ์ง ๋ณด์ํ๋ค.
## 1. ์ค์ ๋ฐ์ดํฐ๋ก ์์
ํ๊ธฐ
**โ๏ธ ์ ๋ช
ํ ๊ณต๊ฐ ๋ฐ์ดํฐ ์ ์ฅ์**
- [UC Irvine ๋จธ์ ๋ฌ๋ ์ ์ฅ์](http://archive.ics.uci.edu/ml/)
- [Kaggle Datasets](http://w... | github_jupyter |
# ElasticNet with StandardScaler
This Code template is for the regression analysis using a ElasticNet Regression and the feature rescaling technique StandardScaler in a pipeline
### Required Packages
```
import warnings as wr
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot... | github_jupyter |
Most similar topics for all DUC2006 + DUC2007 topics
===
Disclaimer. I use python 2.7, so take care if you use something else...
```
import numpy as np
import os
from os import path
from gensim.models import KeyedVectors
import codecs
from scipy.spatial.distance import cosine
import scipy
import json
import pandas as... | github_jupyter |
<center>
<img src="https://gitlab.com/ibm/skills-network/courses/placeholder101/-/raw/master/labs/module%201/images/IDSNlogo.png" width="300" alt="cognitiveclass.ai logo" />
</center>
# **Survey Dataset Exploration Lab**
Estimated time needed: **30** minutes
## Objectives
After completing this lab you will be ... | github_jupyter |
## 1. Breath alcohol tests in Ames, Iowa, USA
<p>Ames, Iowa, USA is the home of Iowa State University, a land grant university with over 36,000 students. By comparison, the city of Ames, Iowa, itself only has about 65,000 residents. As with any other college town, Ames has had its fair share of alcohol-related incident... | github_jupyter |
```
import os
import random as rnd
import numpy as np
import pandas as pd
import peakutils
import cv2 as cv
from matplotlib import pyplot as plt
%matplotlib notebook
def add_images(dirname, offset=np.array([0, 0]), macrostep=np.array([0, 0]), step=np.array([0, 0]),\
infield_shifts=np.array([np.array([0, ... | github_jupyter |
```
%matplotlib inline
```
# Testing DuBE with different number of classes (3-15)
In this example, we compare the :class:`duplebalance.DupleBalanceClassifier`
and other ensemble-based class-imbalanced learning methods on multi-class
tasks (with number of classes varying from 3 to 15).
```
print(__doc__)
RANDOM_ST... | github_jupyter |
# Cake Eating
```
# Cake Eating
# max sum ฮฒ^t * u(c(t))
# s.t. c(t) + x(t+1) <= x(t)(1+r), x(0) given
import numpy as np
x0 = 1
ฮฒ = 0.95
ฮณ = 0.9
r = 0.05
u = lambda c: c**(1-ฮณ)/(1-ฮณ)
# V(x) = max u(x(1+r)-x')) + ฮฒ*V_old(x')
# s.t. 0 < x'< x
N = 100
X = np.linspace(1e-6, x0, N) # State space
V_ = u(X) # initial gue... | github_jupyter |
# Machine Learning with H2O - Tutorial 4b: Classification Models (Ensembles)
<hr>
**Objective**:
- This tutorial explains how to create stacked ensembles of classification models for better out-of-bag performance.
<hr>
**Titanic Dataset:**
- Source: https://www.kaggle.com/c/titanic/data
<hr>
**Steps**:
1. ... | github_jupyter |
# Sustainable energy transitions data model
```
import pandas as pd, numpy as np, json, copy, zipfile, random
```
## Country and region name converters
```
#country name converters
#EIA->pop
clist1={'North America':'Northern America',
'United States':'United States of America',
'Central & South America':'Latin Amer... | github_jupyter |
```
import numpy as np
import pandas as pd
from sklearn import *
import matplotlib.pyplot as plt
%matplotlib inline
sample_size = 5000
data1,target1 = datasets.make_circles(n_samples=sample_size, factor=.1, noise=0.2)
target1 = (3*data1[:,0])-(16*data1[:,1]) + (0.5*data1[:,0]*data1[:,1]) + np.random.normal(0,2,size=sa... | github_jupyter |
# Comparisons using the BatchStudy class
In this notebook, we will be going through the `BatchStudy` class and will be discussing how different models, experiments, chemistries, etc. can be compared with each other using the same.
## Comparing models
We start by creating a simple script to compare `SPM`, `SPMe` and `... | github_jupyter |
## Learning Objectives
The goal of this notebook is for describing data and to see and practice:
- Load raw data
- View the loaded data
- Formulate an explorative data description question
- Describe the raw data tables
- See and practice data science research tools and practices
### 1 Practical Data Science Research... | github_jupyter |
```
import model as model
import math
import anchor as anchor
import random
import torch
import torch.nn.functional as F
import numpy as np
import matplotlib.pyplot as plt
from nyu import my_dataloader as nyu_dataloader
from nyu import testingImageDir, center_test, test_lefttop_pixel, test_rightbottom_pixel, keypointsU... | github_jupyter |
# Session 1: Introduction to Tensorflow
<p class='lead'>
Creative Applications of Deep Learning with Tensorflow<br />
Parag K. Mital<br />
Kadenze, Inc.<br />
</p>
<a name="learning-goals"></a>
# Learning Goals
* Learn the basic idea behind machine learning: learning from data and discovering representations
* Learn ... | github_jupyter |
```
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
#download mnist data and split into train and test sets
df = pd.read_csv('NeutralData.csv')
X = df.drop(['Label'], axi... | github_jupyter |
# Preliminary experiment to examine the effect of the numbers of forward passes to the consistency of the certainty estimate
### Import the libraries
```
import os
import csv
import numpy as np
import pickle
import seaborn as sns
import pandas as pd
from itertools import chain
import matplotlib.pyplot as plt
%matplot... | github_jupyter |
## BUILDING A RECOMMENDER SYSTEM ON USER-USER COLLABORATIVE FILTERING (MOVIELENS DATASET)
We will load the data sets firsts.
```
import pandas as pd
import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
import math
#column headers for the dataset
data_cols = ['user id','movie id','rating','timestamp'... | github_jupyter |
# Ask the Calculator Glass Questions
Here we are going to ask the calculator questions about glass.
```
import os
from pathlib import Path
testfolder = str(Path().resolve().parent.parent / 'PV_DEMICE' / 'TEMP')
# Another option using relative address; for some operative systems you might need '/' instead of '\'
# t... | github_jupyter |
```
password = None
%reload_ext autoreload
%autoreload 2
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import json
import getpass
import pandas as pd
import numpy as np
from utils import load_json_benchmarks, filter_results, plot_comparison
```
repetitions = 10
```
if password is None:
... | github_jupyter |
# EXTRA STUFF: Day 8
First, import our usual things:
```
import ipywidgets
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import bqplot.pyplot as bplt
# also:
import bqplot
```
Load data:
```
planets = pd.read_csv('https://jnaiman.github.io/csci-p-14110_su2020/lesson08/planets_2020.06.17_14.... | github_jupyter |
# 5. Neural Networks
```
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import fetch_openml, make_moons
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelBinarizer
from sklearn.metrics import accuracy_score
from prml import nn
np.... | github_jupyter |
```
from timeatlas import TimeSeries, models, detectors, metrics
import pandas as pd
import matplotlib.pyplot as plt
pd.plotting.register_matplotlib_converters()
from fbprophet.diagnostics import cross_validation, performance_metrics
from fbprophet.plot import plot_cross_validation_metric
```
# Anomaly Detection on Ar... | github_jupyter |
```
%matplotlib inline
```
Analyze Merfish data
====================
This tutorial shows how to apply Squidpy for the analysis of Merfish
data.
The data used here was obtained from `Moffitt2018-me`. We provide a
pre-processed subset of the data, in `anndata.AnnData` format. For
details on how it was pre-processed, p... | github_jupyter |
# TensorFlow-Slim
[TensorFlow-Slim](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/slim) is a high-level API for building TensorFlow models. TF-Slim makes defining models in TensorFlow easier, cutting down on the number of lines required to define models and reducing overall clutter. In partic... | github_jupyter |
# Gaussian mixture model with expectation maximization algorithm
GMM with EM.
This notebook implements the following:
1) Function that avoids computing inverse of matrix when computing $y = A^{-1}x$ by solving system of linear equations.
2) Log sum trick to avoid underflow when multiplying small numbers.
3) pdf of... | github_jupyter |
# Lesson 3: In-class exercises
---
Sarah Middleton (http://sarahmid.github.io/)
http://github.com/sarahmid/python-tutorials
---
**Instructions: For each problem, write code in the provided code block. Don't forget to run your code to make sure it works.**
---
**1\. Simple loop practice**
Write code to accomplish ... | github_jupyter |
# Preparing for ISF '21
### Results analysis and graphing
---
## Plumbing
```
import sys
import os
import importlib
is_colab = importlib.util.find_spec("google")
found = is_colab is not None
import_path = ''
if found:
from google.colab import drive
drive.mount('/content/gdrive/', force_remount=True)
imp... | github_jupyter |
## Search for nearby Amenities for all site locations of each city
List of Amenities by Categories:
Categories:
A. Emergency Facilities
'''How accesible are these facilities in case of mass emergency on/around
sites for containing the situation and resuming business asap'''
... | github_jupyter |
# Aim
1. **Introduce the python ecosystem**
* How do I run a `.py` script?
* Where do I enter python commands?
* What is `Python 2` and `Python 3`?
* wait!, there is something called `Anaconda`?
* `JupyterLab`, `Jupyter Notebooks` and reproducible research
2. **Why should I use python?**
* Is p... | github_jupyter |
## Imports
```
import numpy as np
import uproot
data_dir = "/Users/weisser/MIT_Dropbox/LbVMWeisser_shared/Tracking/Simulated_Velo/LHCbPVFinding_DataSets"
import matplotlib.pyplot as plt
%matplotlib inline
#from sklearn.neighbors import KernelDensity
from scipy.signal import find_peaks_cwt
from scipy.signal import argr... | github_jupyter |
##### Copyright 2020 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 |
# Importing Libraries
```
import networkx as nx
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
import numpy as np
from matplotlib.ticker import MaxNLocator
```
# Creating Erdos Renyi Graph and Plotting Degree Centrality
```
def visualiseER(nodes,p):
G = nx.erdos_renyi_graph(nodes,p)
... | github_jupyter |
# Quantum Phase Estimation on the Hubbard molecule
We would like to study the "Hubbard dimer" molecule, whose Hamiltonian reads:
$$H=-t\sum_{\sigma=\uparrow,\downarrow}\left(c_{1\sigma}^{\dagger}c_{2\sigma}+c_{2\sigma}^{\dagger}c_{1\sigma}\right)-\mu\sum_{i=1,2}\sum_{\sigma=\uparrow,\downarrow}n_{i\sigma}+U\sum_{i=1,... | github_jupyter |
```
import pandas as pd
import csv
import nltk
import re
import matplotlib.pyplot as plt
from nltk.tokenize import TweetTokenizer
from tokenizer import *
from nltk.corpus import stopwords
from ekphrasis.classes.preprocessor import TextPreProcessor
from ekphrasis.classes.tokenizer import SocialTokenizer
from ekphrasis.... | github_jupyter |
```
import subprocess
from subprocess import PIPE
import rasterio
import json
import glob
import pandas as pd
import os
import cv2
```
<h3> Define Functions </h3>
```
# This function takes as argument the a string contraining the a path for one image.
# It check if the first band is empty (if all pixels are zero) ... | github_jupyter |
## MNIST Dataset Overview
This example is using MNIST handwritten digits. The dataset contains 60,000 examples for training and 10,000 examples for testing. The digits have been size-normalized and centered in a fixed-size image (28x28 pixels) with values from 0 to 1. For simplicity, each image has been flattened and ... | github_jupyter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.