code
stringlengths
2.5k
150k
kind
stringclasses
1 value
<a href="https://colab.research.google.com/github/mancunian1792/causal_scene_generation/blob/master/causal_model/game_characters/GameCharacter_ImageClassification.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` from google.colab import drive dr...
github_jupyter
``` %reload_ext autoreload %autoreload 2 from fastai.tabular import * ``` # Rossmann ## Data preparation To create the feature-engineered train_clean and test_clean from the Kaggle competition data, run `rossman_data_clean.ipynb`. One important step that deals with time series is this: ```python add_datepart(train,...
github_jupyter
``` import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt import matplotlib matplotlib.pyplot.style.use('seaborn') matplotlib.rcParams['figure.figsize'] = (15, 5) %matplotlib inline import math from IPython.core.interactiveshell import InteractiveShell InteractiveShell.ast_nod...
github_jupyter
Code testing for https://github.com/pymc-devs/pymc3/pull/2986 ``` import numpy as np import pymc3 as pm import pymc3.distributions.transforms as tr import theano.tensor as tt from theano.scan_module import until import theano import matplotlib.pylab as plt import seaborn as sns %matplotlib inline ``` # Polar transfo...
github_jupyter
# Mean Normalization In machine learning we use large amounts of data to train our models. Some machine learning algorithms may require that the data is *normalized* in order to work correctly. The idea of normalization, also known as *feature scaling*, is to ensure that all the data is on a similar scale, *i.e.* that...
github_jupyter
In this notebook we will use the boundary exploration algorithm to fully explore the parameter space of a generic Markov chain. Last updated by: Jonathan Liu, 10/22/2020 ``` #Import necessary packages %matplotlib inline import numpy as np from scipy.spatial import ConvexHull import matplotlib.pyplot as plt import sci...
github_jupyter
``` import pandas as pd import os import hashlib import requests from bs4 import BeautifulSoup from bs4.element import Comment import urllib.parse from tqdm.notebook import tqdm import random from multiprocessing import Pool import spacy import numpy as np industries = pd.read_csv("industry_categories.csv") industries....
github_jupyter
``` from nltk.corpus import stopwords from nltk.cluster.util import cosine_distance import numpy as np import networkx as nx from nltk.corpus import stopwords from nltk.cluster.util import cosine_distance import numpy as np import networkx as nx def read_article(file_name): file = open(file_name, "r") filedata...
github_jupyter
## Dependencies ``` import json, warnings, shutil, glob from jigsaw_utility_scripts import * from scripts_step_lr_schedulers import * from transformers import TFXLMRobertaModel, XLMRobertaConfig from tensorflow.keras.models import Model from tensorflow.keras import optimizers, metrics, losses, layers SEED = 0 seed_ev...
github_jupyter
# Amazon SageMaker Model Monitor This notebook shows how to: * Host a machine learning model in Amazon SageMaker and capture inference requests, results, and metadata * Analyze a training dataset to generate baseline constraints * Monitor a live endpoint for violations against constraints --- ## Background Amazon Sa...
github_jupyter
### Importing the required libraries ### ``` import numpy as np import pandas as pd from matplotlib import pyplot as plt %matplotlib inline import seaborn as sns import re import zipfile ``` ### UNZIP files ### ``` # Will unzip the files so that you can see them.. with zipfile.ZipFile("/kaggle/input/jigsaw-toxic-com...
github_jupyter
``` from google.colab import drive drive.mount('/content/drive') import numpy as np import pandas as pd train_srp53 = pd.read_csv('/content/drive/MyDrive/Molecular Exploration/Data/sr-p53.smiles', sep='\t', names=['smiles', 'id', 'target']) train_srp53.head() len(trai...
github_jupyter
# Plagiarism Detection Model Now that you've created training and test data, you are ready to define and train a model. Your goal in this notebook, will be to train a binary classification model that learns to label an answer file as either plagiarized or not, based on the features you provide the model. This task wi...
github_jupyter
``` # 任意选一个你喜欢的整数,这能帮你得到稳定的结果 seed = 2333 # todo ``` # 欢迎来到线性回归项目 若项目中的题目有困难没完成也没关系,我们鼓励你带着问题提交项目,评审人会给予你诸多帮助。 所有选做题都可以不做,不影响项目通过。如果你做了,那么项目评审会帮你批改,也会因为选做部分做错而判定为不通过。 其中非代码题可以提交手写后扫描的 pdf 文件,或使用 Latex 在文档中直接回答。 # 1 矩阵运算 ## 1.1 创建一个 4*4 的单位矩阵 ``` # 这个项目设计来帮你熟悉 python list 和线性代数 # 你不能调用任何NumPy以及相关的科学计算库来完成作业 # 本...
github_jupyter
# Batch Processing! #### A notebook to show some of the capilities available through the pCunch package This is certainly not an exhaustive look at everything that the pCrunch module can do, but should hopefully provide some insight. ...or, maybe I'm just procrastinating doing more useful work. ``` # Python Modules ...
github_jupyter
<a href="https://colab.research.google.com/github/laicheil/force2019/blob/master/tf_keras_test.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` !pip3 install --upgrade laicheil.force2019==0.post0.dev6 from laicheil.force2019 import something som...
github_jupyter
# MXNet with DALI - ResNet 50 example ## Overview This example shows, how to use DALI pipelines with Apache MXNet. ## ResNet 50 pipeline Let us first define a few global constants. ``` from __future__ import print_function from nvidia.dali.pipeline import Pipeline import nvidia.dali.ops as ops import nvidia.dali.t...
github_jupyter
#manipulate_regonline_output This notebook reads the RegOnline output into a pandas DataFrame and reworks it to have each row contain the attendee, the Doppler Primer Session, the Monday Breakout session, and the Tuesday breakout session in each row. ``` import re import numpy as np import pandas as pd import matplot...
github_jupyter
# <center>Using Optimization in Hyperparameter settings in Deep Learning</center> <center>by Cecilie Dura André</center> <img src="https://blog.ml.cmu.edu/wp-content/uploads/2018/12/heatmap.001-min.jpeg" width="90%"> <p style="text-align: right;">Image from: https://blog.ml.cmu.edu/2018/12/12/massively-parallel-hy...
github_jupyter
``` from __future__ import print_function import argparse import os import random import torch import torch.nn as nn import torch.nn.parallel import torch.backends.cudnn as cudnn import torch.optim as optim import torch.utils.data import torchvision.datasets as dset import torchvision.transforms as transforms import t...
github_jupyter
# Deep learning for computer vision This notebook will teach you to build and train convolutional networks for image recognition. Brace yourselves. # CIFAR dataset This week, we shall focus on the image recognition problem on cifar10 dataset * 60k images of shape 3x32x32 * 10 different classes: planes, dogs, cats, t...
github_jupyter
# 基本程序设计 - 一切代码输入,请使用英文输入法 ``` print('hello word') print('hello word') print 'hello' ``` ## 编写一个简单的程序 - 圆公式面积: area = radius \* radius \* 3.1415 ``` radius = 1 area = radius * radius * 3.1415 print(area) radius = 1.0 area = radius * radius * 3.14 # 将后半部分的结果赋值给变量area # 变量一定要有初始值!!! # radius: 变量.area: 变量! # int 类型 pri...
github_jupyter
# Loading Image Data 강아지와 고양이를 구분하는 이미지 분류기를 생성하기 위해서는 고양이와 강아지 사진을 모아야 한다. 임의로 수집된 다음과 같은 고양이/강아지 사진을 사용하자. ![img](../assets/dog_cat.png) 이 사진을 사용하여 CNN으로 이미지 분류기를 만들기 위해서는 해당 사진을 적절히 전처리하여야 한다. ``` %matplotlib inline %config InlineBackend.figure_format = 'retina' import matplotlib.pyplot as plt import torch from ...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt import pandas as pd import pymc3 as pm from theano import tensor as T import arviz import os import sys from jupyterthemes import jtplot jtplot.style(theme="monokai") os.listdir() lng = pd.read_csv("LNG.csv", index_col="Date")[["Adj Close"]] dji = pd.read_csv("^D...
github_jupyter
# Load MXNet model In this tutorial, you learn how to load an existing MXNet model and use it to run a prediction task. ## Preparation This tutorial requires the installation of Java Kernel. For more information on installing the Java Kernel, see the [README](https://github.com/awslabs/djl/blob/master/jupyter/READM...
github_jupyter
## Aligning rasters: A step-by-step breakdown This notebook aligns input rasters with a base reference raster. The implict purpose, reflected in the datasets used here, is to align rasters so that raster math operations can be performed between the rasters ``` import os, sys import re import pprint # from pprint impo...
github_jupyter
# Introduction to Deep Learning with PyTorch In this notebook, you'll get introduced to [PyTorch](http://pytorch.org/), a framework for building and training neural networks. PyTorch in a lot of ways behaves like the arrays you love from Numpy. These Numpy arrays, after all, are just tensors. PyTorch takes these tenso...
github_jupyter
``` %matplotlib inline from matplotlib import style style.use('fivethirtyeight') import matplotlib.pyplot as plt import numpy as np import pandas as pd from scipy import stats from scipy.stats import ttest_ind, ttest_ind_from_stats import datetime as dt from datetime import datetime,timedelta from itertools import chai...
github_jupyter
``` import numpy as np import cv2 import matplotlib.pyplot as plt import math def rgb2hsi(rgb): # separar R,G,B= cv2.split(rgb) # normalizar R =R/255 G =G/255 B =B/255 # cantidad de elementos x=R.shape[0] y=R.shape[1] # crear arrays r=np.empty([x,y]) g=np.empty([x,y]) ...
github_jupyter
<a href="https://colab.research.google.com/github/andrewm4894/colabs/blob/master/some_json_wrangling.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import pandas as pd data = [{"event_date":"20201107","event_timestamp":"1604801718108000","even...
github_jupyter
## Analyze A/B Test Results This project will assure you have mastered the subjects covered in the statistics lessons. The hope is to have this project be as comprehensive of these topics as possible. Good luck! ## Table of Contents - [Introduction](#intro) - [Part I - Probability](#probability) - [Part II - A/B Te...
github_jupyter
# Modeling and Simulation in Python Chapter 18 Copyright 2017 Allen Downey License: [Creative Commons Attribution 4.0 International](https://creativecommons.org/licenses/by/4.0) ``` # Configure Jupyter so figures appear in the notebook %matplotlib inline # Configure Jupyter to display the assigned value after an a...
github_jupyter
``` %load_ext autoreload %autoreload 2 import ambry l = ambry.get_library() b = l.bundle('d04w001') # Geoschemas sumlevels_p = l.partition('census.gov-acs_geofile-schemas-2009e-sumlevels') sumlevels = {} for row in sumlevels_p.stream(as_dict=True): sumlevels[row['sumlevel']] = row['description'] from collections im...
github_jupyter
``` import sys from pathlib import Path sys.path.append(str(Path.cwd().parent.parent)) import numpy as np from kymatio.scattering2d.core.scattering2d import scattering2d import matplotlib.pyplot as plt import torch import torchvision from kymatio import Scattering2D from PIL import Image from IPython.display import di...
github_jupyter
# Basic training functionality ``` from fastai.basic_train import * from fastai.gen_doc.nbdoc import * from fastai.vision import * from fastai.distributed import * ``` [`basic_train`](/basic_train.html#basic_train) wraps together the data (in a [`DataBunch`](/basic_data.html#DataBunch) object) with a pytorch model to...
github_jupyter
``` # load text filename = 'metamorphosis_clean.txt' file = open(filename, 'rt') text = file.read() file.close() # open('metamorphosis_clean.txt', rt).read() ``` ### split by whitespace ``` # load text filename = 'metamorphosis_clean.txt' file = open(filename, 'rt') text = file.read() file.close() # split into words ...
github_jupyter
``` import datetime as dt import pandas as pd # Get dataframe of boroughs df = pd.read_csv("taxi_zone_lookup.csv") df # Create dictionary of boroughs, and build the list of locations for each borough # (6 boroughs vs of 265 NY locations) dfdict = {'EWR': [], 'Queens': [], 'Bronx': [], 'Manhattan': [], 'Staten Island...
github_jupyter
# Todoist Data Analysis This notebook processed the downloaded history of your todoist tasks. See [todoist_downloader.ipynb](https://github.com/markwk/qs_ledger/blob/master/todoist/todoist_downloader.ipynb) to export and download your task history from Todoist. --- ``` from datetime import date, datetime as dt, time...
github_jupyter
# Training and Evaluating Machine Learning Models in cuML This notebook explores several basic machine learning estimators in cuML, demonstrating how to train them and evaluate them with built-in metrics functions. All of the models are trained on synthetic data, generated by cuML's dataset utilities. 1. Random Fores...
github_jupyter
``` %matplotlib inline import json import os import matplotlib.pyplot as plt import pandas as pd import seaborn as sns from functools import reduce from matplotlib.ticker import FuncFormatter DAMORE = '@Fired4Truth' DATA_DIR = os.path.join("data", "clean") sns.set_palette(sns.xkcd_palette(["windows blue", "amber",...
github_jupyter
``` import scanpy as sc import pandas as pd import numpy as np import scipy as sp from statsmodels.stats.multitest import multipletests import matplotlib.pyplot as plt import seaborn as sns import os from os.path import join import time plt.rcParams['pdf.fonttype'] = 42 plt.rcParams['ps.fonttype'] = 42 # scTRS tools ...
github_jupyter
# Probando el ajuste de distribuciones hipotéticas A veces, el conocimiento específico sugiere fuertes razones que justifiquen alguna suposición; de lo contrario, esto debería probarse de alguna manera. Cuando comprobamos si los datos experimentales se ajustan a una distribución de probabilidad dada, no estamos realme...
github_jupyter
# Properties of drugs Find various properties of the individual drugs 1.) ATC 2.) GO Annotations 3.) Disease 4.) KeGG Pathways 5.) SIDER (known effects) 6.) Offside (known off sides) 7.) TwoSides 8.) Drug Properties (physico-chemical properties) 9.) Enzymes, Transporters and Carriers 10.) Chemic...
github_jupyter
# Graded Programming Assignment In this assignment, you will implement re-use the unsupervised anomaly detection algorithm but turn it into a simpler feed forward neural network for supervised classification. You are training the neural network from healthy and broken samples and at later stage hook it up to a messag...
github_jupyter
# Reproduce Allen smFISH results with Starfish This notebook walks through a work flow that reproduces the smFISH result for one field of view using the starfish package. ``` from copy import deepcopy from glob import glob import json import os %matplotlib inline import matplotlib.pyplot as plt import numpy as np im...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import os import PIL import skimage as sk import random from PIL import Image def prepare_dataset(path): #declare arrays x=[] y=[] # 이미지와 label을 리스트에 넣기 data_folders = os.listdir(path) for folder in data_folders: ...
github_jupyter
<a href="https://colab.research.google.com/github/LucyKinyua/Week2_MS/blob/main/Moringa_Data_Science_Prep_W2_Independent_Project_2021_05_Lucy_Kinyua_SQL_Notebook.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Overview In this part of the assessm...
github_jupyter
# Autonomous driving - Car detection Welcome to your week 3 programming assignment. You will learn about object detection using the very powerful YOLO model. Many of the ideas in this notebook are described in the two YOLO papers: [Redmon et al., 2016](https://arxiv.org/abs/1506.02640) and [Redmon and Farhadi, 2016](h...
github_jupyter
``` # default_exp helpers ``` # helpers > this didn't fit anywhere else ``` #export import numpy as np import matplotlib.pyplot as plt import numpy as np import matplotlib.pyplot as plt #ToDo: Propagate them through the methods iters = 10 l2 = 1 n_std = 4 from pygments import highlight from pygments.lexers impor...
github_jupyter
``` #export from local.torch_basics import * from local.test import * from local.core import * from local.data.all import * from local.tabular.core import * try: import cudf,nvcategory except: print("This requires rapids, see https://rapids.ai/ for installation details") from local.notebook.showdoc import * #default_ex...
github_jupyter
# Inspirational Notebooks ### Generating new festures according to these notebooks * https://www.kaggle.com/nuhsikander/lgbm-new-features-corrected * https://www.kaggle.com/rteja1113/lightgbm-with-count-features * https://www.kaggle.com/aharless/swetha-s-xgboost-revised * https://www.kaggle.com/bk0000/non-blending-lig...
github_jupyter
<a href="https://colab.research.google.com/github/findingfoot/ML_practice-codes/blob/master/principal_component_analysis_.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` from sklearn import datasets import numpy as np import matplotlib.pyplot as...
github_jupyter
What you should know about C ---- - Write, compile and run a simple program in C - Static types - Control flow especially `for` loop - Using functions - Using structs - Pointers and arrays - Function pointers - Dynamic memory allocation - Separate compilation and `make` ### Structs **Exercise 1** Write and use a `s...
github_jupyter
## Training Network In supervised training, the network processes inputs and compares its resulting outputs against the desired outputs. Errors are propagated back through the system, causing the system to adjust the weights which control the network. This is done using the Backpropagation algorithm, also called bac...
github_jupyter
# Chapter 3 - a binary classification example ``` from keras.datasets import imdb from keras import models, layers from keras import optimizers from keras import losses from keras import metrics import numpy as np import matplotlib.pyplot as plt ``` ## Loading dataset ``` # Suggested code - doesn't work # (train_da...
github_jupyter
# Natural language inference: task and datasets ``` __author__ = "Christopher Potts" __version__ = "CS224u, Stanford, Fall 2020" ``` ## Contents 1. [Overview](#Overview) 1. [Our version of the task](#Our-version-of-the-task) 1. [Primary resources](#Primary-resources) 1. [Set-up](#Set-up) 1. [SNLI](#SNLI) 1. [SNLI ...
github_jupyter
``` import glob import os import pandas as pd import numpy as np ##################### Traces description # 1. CLT_PUSH_START - SENDING Time between the scheduling of the request and its actual processing # 2. CLT_PUSH_END - CLT_PUSH_START Time to prepare the packet, send it to the NIC driver through rt...
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
``` from os.path import exists, join, isfile from os import listdir, makedirs from obspy.geodetics import kilometer2degrees import numpy as np from obspy.taup import TauPyModel import matplotlib.pyplot as plt from SS_MTI import Inversion import threading import subprocess import Create_Vmod from SS_MTI import Gradien...
github_jupyter
``` from sklearn.model_selection import RandomizedSearchCV from sklearn.model_selection import cross_validate import numpy as np import xgboost as xgb import pandas as pd train_datasetL = pd.read_csv("../data/ori_data/train_process.csv", header=None, sep="\t").iloc[:, 0].values dev_datasetL = pd.read_csv("../data/ori_d...
github_jupyter
# Basic Motion Welcome to JetBot's browser based programming interface! This document is called a *Jupyter Notebook*, which combines text, code, and graphic display all in one! Prett neat, huh? If you're unfamiliar with *Jupyter* we suggest clicking the ``Help`` drop down menu in the top toolbar. This has useful r...
github_jupyter
# 머신 러닝 교과서 3판 # 14장 - 텐서플로의 구조 자세히 알아보기 (2/3) **아래 링크를 통해 이 노트북을 주피터 노트북 뷰어(nbviewer.jupyter.org)로 보거나 구글 코랩(colab.research.google.com)에서 실행할 수 있습니다.** <table class="tfo-notebook-buttons" align="left"> <td> <a target="_blank" href="https://nbviewer.jupyter.org/github/rickiepark/python-machine-learning-book-3r...
github_jupyter
# Posthoc Inference on Contrasts In this notebook, we provide examples of how to run posthoc inference to infer on contrasts in the linear model. ## Set Up #### Import the required python packages. ``` import numpy as np import numpy.matlib as npm import matplotlib.pyplot as plt import sanssouci as ss import pyr...
github_jupyter
<h1 align="center">Welcome to SimpleITK Jupyter Notebooks</h1> ## Newcomers to Jupyter Notebooks: 1. We use two types of cells, code and markdown. 2. To run a code cell, select it (mouse or arrow key so that it is highlighted) and then press shift+enter which also moves focus to the next cell or ctrl+enter which does...
github_jupyter
[View in Colaboratory](https://colab.research.google.com/github/PranY/FastAI_projects/blob/master/TSG.ipynb) ``` !pip install fastai !pip install torch_nightly -f https://download.pytorch.org/whl/nightly/cu92/torch_nightly.html ! pip install kaggle ! pip install tqdm from google.colab import drive drive.mount('/conten...
github_jupyter
``` import pandas as pd #数据分析 import numpy as np #科学计算 from pandas import Series,DataFrame data_train = pd.read_csv("/Users/zhijun/Desktop/Titanic/all/train.csv") data_train.columns data_train.info() data_train.describe() import matplotlib.pyplot as plt fig = plt.figure() fig.set(alpha=0.2) # 设定图表颜色alpha参数 plt.subpl...
github_jupyter
# Measuring Monotonic Relationships By Evgenia "Jenny" Nitishinskaya and Delaney Granizo-Mackenzie with example algorithms by David Edwards Reference: DeFusco, Richard A. "Tests Concerning Correlation: The Spearman Rank Correlation Coefficient." Quantitative Investment Analysis. Hoboken, NJ: Wiley, 2007 Part of the ...
github_jupyter
# Spacy ### Models Spacy comes with a variety of different models that can used per language. For instance, the models for English are available [here](https://spacy.io/models/en). You'll need to download each model separately: ```python python3 -m spacy download en_core_web_sm python3 -m spacy download en_core_web_...
github_jupyter
# In this notebook an estimator for the Volume will be trained. No hyperparameters will be searched for, and the ones from the 'Close' values estimator will be used instead. ``` # Basic imports import os import pandas as pd import matplotlib.pyplot as plt import numpy as np import datetime as dt import scipy.optimize ...
github_jupyter
## Dependencies ``` import json, glob from tweet_utility_scripts import * from tweet_utility_preprocess_roberta_scripts_aux import * from transformers import TFRobertaModel, RobertaConfig from tokenizers import ByteLevelBPETokenizer from tensorflow.keras import layers from tensorflow.keras.models import Model ``` # L...
github_jupyter
# Monitoring Data Drift Over time, models can become less effective at predicting accurately due to changing trends in feature data. This phenomenon is known as *data drift*, and it's important to monitor your machine learning solution to detect it so you can retrain your models if necessary. In this lab, you'll conf...
github_jupyter
# 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
[View in Colaboratory](https://colab.research.google.com/github/thonic92/chal_TM/blob/master/model_tweets.ipynb) ``` import json import numpy as np import pandas as pd import tensorflow as tf from keras.models import Sequential from keras.layers import Dense from keras.layers import Dropout from keras.layers import LS...
github_jupyter
<div align="center"> <h1>Homework 7</h1> <p> <div align="center"> <h2>Yutong Dai yutongd3@illinois.edu</h2> </div> </p> </div> ## 6.33 The dual problem is $$ \begin{align} & \min \quad 3 w_1 + 6 w_2\\ & s.t \quad w_1 + 2w_2 \geq 2\\ & \qquad w_1 + 3w_2 \geq -3\\ & \qquad w_1\leq 0,...
github_jupyter
# Assignment: Global average budgets in the CESM pre-industrial control simulation ## Learning goals Students completing this assignment will gain the following skills and concepts: - Continued practice working with the Jupyter notebook - Familiarity with atmospheric output from the CESM simulation - More complete c...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt import butcher import bro import os from astropy.io import ascii from astropy.timeseries import LombScargle #Reading in the data #Get the data directory cwd = os.getcwd() data_dir = cwd.replace('Figure_4', 'Data\\') #ASAS data orgasas_data = ascii.read(data_dir ...
github_jupyter
# IMDb Movie Reviews Classifier ``` from sklearn.feature_extraction.text import CountVectorizer from sklearn.linear_model import LogisticRegression from sklearn.metrics import accuracy_score from sklearn.model_selection import train_test_split from nltk.corpus import stopwords from nltk.stem.porter import PorterStemme...
github_jupyter
# Time Series Modeling In this lecture, we'll do some **basic** work with time series modeling. Time series are surprisingly complicated objects to work with and model, and many people spend their careers considering statistical questions related to effective modeling of timeseries. In this set of lecture notes, we wo...
github_jupyter
``` import numpy as np import pandas as pd import math from math import sin, cos, radians import os import matplotlib.pyplot as plt import datetime import scipy.stats as st import scipy.signal as sgl pd.set_option('display.max_columns', 500) #import fastdtw from scipy.spatial.distance import euclidean from fastdtw i...
github_jupyter
# SentencePiece and BPE ## Introduction to Tokenization In order to process text in neural network models it is first required to **encode** text as numbers with ids, since the tensor operations act on numbers. Finally, if the output of the network is to be words, it is required to **decode** the predicted tokens ids...
github_jupyter
### *IPCC SR15 scenario assessment* <img style="float: right; height: 80px; padding-left: 20px;" src="../_static/IIASA_logo.png"> <img style="float: right; height: 80px;" src="../_static/IAMC_logo.jpg"> # Characteristics of four illustrative model pathways ## Figure 3b of the *Summary for Policymakers* This notebook...
github_jupyter
<h1 align=center><font size = 6> Crop Yield Prediction. </font></h1> ## import required libraries. ``` import numpy as np #Library to handle data in vectorized manner. import pandas as pd #library for data analysis. #Plotting libray matplotlib and associated ploting modules. import matplotlib.pyplot as plt impo...
github_jupyter
# MaterialsCoord benchmarking – sensitivity to perturbation analysis This notebook demonstrates how to use MaterialsCoord to benchmark the sensitivity of bonding algorithms to structural perturbations. Perturbations are introduced according the Einstein crystal test rig, in which site is perturbed so that the distribu...
github_jupyter
<a href="https://colab.research.google.com/github/jeffheaton/t81_558_deep_learning/blob/master/t81_558_class_12_02_qlearningreinforcement.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # T81-558: Applications of Deep Neural Networks **Module 12: Re...
github_jupyter
# BikeBuyer Regression ``` # importing libraries import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import numpy as np import numpy.random as nr import math %matplotlib inline # loading data customer_info = pd.read_csv('Data/AdvWorksCusts.csv') customer_spending = pd.read_csv('Data/AW_A...
github_jupyter
___ <a href='http://www.pieriandata.com'> <img src='../Pierian_Data_Logo.png' /></a> ___ # NumPy Exercises Now that we've learned about NumPy let's test your knowledge. We'll start off with a few simple tasks, and then you'll be asked some more complicated questions. #### Import NumPy as np ``` import numpy as np...
github_jupyter
``` """ Update Parameters Here """ COLLECTION_NAME = "Quaks" CONTRACT = "0x07bbdaf30e89ea3ecf6cadc80d6e7c4b0843c729" BEFORE_TIME = "2021-09-02T00:00:00" # One day after the last mint (e.g. https://etherscan.io/tx/0x206c846d0d1739faa9835e16ff419d15708a558357a9413619e65dacf095ac7a) # these should usually stay the same ...
github_jupyter
``` from matplotlib import pyplot as plt %matplotlib notebook from matplotlib import animation import numpy as np #make a fake galaxy distribution from a MOG mean1, std1 = (np.random.rand()*2-1, np.random.rand()*2-1), (np.random.rand()*3+0.5, np.random.rand()*3+0.5) mean2, std2 = (np.random.rand()*2+1, np.random.rand()...
github_jupyter
## INTRODUCTION - It’s a Python based scientific computing package targeted at two sets of audiences: - A replacement for NumPy to use the power of GPUs - Deep learning research platform that provides maximum flexibility and speed - pros: - Iinteractively debugging PyTorch. Many users who have used both fr...
github_jupyter
Random Sampling ============= Copyright 2016 Allen Downey License: [Creative Commons Attribution 4.0 International](http://creativecommons.org/licenses/by/4.0/) ``` from __future__ import print_function, division import numpy import scipy.stats import matplotlib.pyplot as pyplot from ipywidgets import interact, i...
github_jupyter
# Tutorial: CommonRoad Route Planner This tutorial demonstrates how the CommonRoad Route Planner package can be used to plan high-level routes for planning problems given in CommonRoad scenarios. ## 0. Preparation * you have gone through the tutorial for **CommonRoad Input-Output** * you have installed the [route pla...
github_jupyter
# Porting genome scale metabolic models for metabolomics **rat-GEM as default rat model, for better compatibility** https://github.com/SysBioChalmers/rat-GEM **Use cobra to parse SBML models whereas applicable** Not all models comply with the formats in cobra. Models from USCD and Thiele labs should comply. **Base ...
github_jupyter
``` #The birth of skynet, always good to start with a joke print("hello World!") # Dependencies import seaborn as sns import matplotlib.pyplot as plt import pandas as pd import os import scipy.stats as st import numpy as np import requests import time import gmaps import json from pprint import pprint from statsmodels....
github_jupyter
# TTV Retrieval for Kepler-36 (a well-studied, dynamically-interacting system) In this notebook, we will perform a dynamical retrieval for Kepler-36 = KOI-277. With two neighboring planets of drastically different densities (the inner planet is rocky and the outer planet is gaseous; see [Carter et al. 2012](https://ui...
github_jupyter
``` # group_by_SNR.ipynb # Many stars that have mulitple APF spectra have some spectra from different nights of observation. # Calculates the SNR for each group of spectra from one night of observing (calc_SNR combines all observations of one # star and returns an SNR for the star instead), then finds for each star w...
github_jupyter
<a href="https://colab.research.google.com/github/kishkath/Data_Structures-Hashing-/blob/main/Tensorflow_fundamentals_withoutcode.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # **Roadmap of this assignment** **This assignment is divided into fol...
github_jupyter
<a href="https://colab.research.google.com/github/AmberLJC/FedScale/blob/master/dataset/Femnist_stats.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # **[Jupyter notebook] Understand the heterogeneous FL data.** # Download the Femnist dataset and ...
github_jupyter
``` # Code ported from laptop onto 10.12.68.72 starting on 8/24/2020 (Gregory Rouze) # To-do: # 1) need to separate user functions and main code - I have done this successfully in the offline version, but I'm having a # little more trouble in the cloud version # 2) Add comments on putpose of individual user functions...
github_jupyter
## Code for policy section ``` # Load libraries import numpy as np import matplotlib.pyplot as plt import matplotlib as mlp # Ensure type 1 fonts are used mlp.rcParams['ps.useafm'] = True mlp.rcParams['pdf.use14corefonts'] = True mlp.rcParams['text.usetex'] = True import seaborn as sns import pandas as pd import pic...
github_jupyter
``` %load_ext autoreload %autoreload 2 ``` # Sampling from a Bayesian network: an open problem A Bayesian network encodes a probability distribution. It is often desirable to be able to sample from a Bayesian network. The most common way to do this is via forward sampling (also called prior sampling). It's a really d...
github_jupyter