text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
``` import matplotlib import matplotlib.pyplot as plt from matplotlib.patches import Rectangle import numpy as np from google.colab import drive drive.mount('/content/drive') #First we generate the piano roll from y_test_pred, that has been predicted by the model arr = np.load('/content/drive/MyDrive/Post-Processing/ME...
github_jupyter
<a href="https://colab.research.google.com/github/MathewsJosh/Resmat/blob/main/Resmat_ex03.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> Exercicio 03 <br> Mathews Edwirds Usando uma peça anelar, a força de 75N pode ser aplicada no plano vertical ...
github_jupyter
# The peaks over threshold method This notebook continues with the dataset of the notebook about the `Dataset` object. There are two main approaches in extreme value theory: the peaks over threshold approach and the block maxima approach. In this notebook, the peaks over threshold approach will be illustrated. In the...
github_jupyter
# Network Analysis ``` from elasticsearch import Elasticsearch import pandas as pd import numpy as np import eland as ed import networkx as nx # Optionally add progress bars to df.apply using .progress_apply from tqdm import tqdm tqdm.pandas() # uncomment this if database is not already open (and give ES a couple min...
github_jupyter
``` from queue import Queue import numpy as np import math from operator import itemgetter from cacheout import Cache edge_count = 0 class SystolicArrayCell: def __init__(self, row_n, col_n): self.pos_x = 0 self.pos_y = 0 self.row_n = row_n self.col_n = col_n #ring...
github_jupyter
#Transformer ``` from google.colab import drive drive.mount('/content/drive') # informer, ARIMA, Prophet, LSTMa와는 다른 형식의 CSV를 사용한다.(Version2) !pip install pandas import pandas as pd import numpy as np import matplotlib.pyplot as plt %matplotlib inline df = pd.read_csv('/content/drive/MyDrive/Colab Notebooks/Data/...
github_jupyter
``` import numpy as np import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers from keras import backend as K import matplotlib.pyplot as plt import pandas as pd import datetime ``` # Load classification model ``` classification_model = tf.keras.models.load_model('TrainedModel/trained...
github_jupyter
# Preliminary Analysis of Statement Sentiment by Lexicon Analyse statement by Loughran and McDonald word list to see if the relationship between economy and net sentiment ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import datetime as dt import os import pickle import codecs import re fr...
github_jupyter
## http://scikit-learn.org/stable/auto_examples/manifold/plot_lle_digits.html ``` %matplotlib inline # subset of http://scikit-learn.org/stable/_downloads/plot_lle_digits.py # see Kyle Kastner at https://youtu.be/r-1XJBHot58?t=1335 # Authors: Fabian Pedregosa <fabian.pedregosa@inria.fr> # Olivier Grisel <oli...
github_jupyter
``` import pandas as pd import logging import glob from sklearn.model_selection import train_test_split pd.set_option('display.max_colwidth', 500) logger = logging.getLogger() logger.setLevel(logging.WARNING) ``` # Download Data ``` # Ensure that the github-issues-data volume is mounted in /mnt !ls -la /mnt # Set pat...
github_jupyter
# MNIST Image Classification with TensorFlow This notebook demonstrates how to implement a simple linear image models on MNIST using Estimator. <hr/> This <a href="mnist_models.ipynb">companion notebook</a> extends the basic harness of this notebook to a variety of models including DNN, CNN, dropout, pooling etc. ```...
github_jupyter
# Experiment Management for Hyperparameter Tuning Jobs Demonstrates how to associate trial components created by a hyperparameter tuning job with an experiment management trial. Prerequisite - hyperparameter tuning job has already been created. ## Steps 1. retrieves the most recently created tuning job 1. creates an...
github_jupyter
<img src="../logo_skmob.png" width=250 align="left"/> # Trajectory models Generative models of individual trajectories ``` import skmob %matplotlib inline import pandas as pd import geopandas as gpd import matplotlib.pyplot as plt ``` ## Exploration and Preferential Return EPR ### Density EPR ``` from skmob.model...
github_jupyter
# Circuito cuántico para autoencoder Propuesta para el hackathon es diseñar un circuito cuántico que pueda disminuir el número de variables de imagenes sin perder información y poder trabajar con menos qubits para una clasificación usando el conjunto de datos MNIST. Se indican a continuación las dependencias necesari...
github_jupyter
# Comparison of the CNN filter combinations based on 5-fold cross-validation Investigation into the effect of various filter combinations for the CNN model. To compare the different filter values, five-fold cross-validation was used. For each fold, one subject of the five total subjects (subject C being reserved for fi...
github_jupyter
# Deploy a Trained PyTorch Model In this notebook, we walk through the process of deploying a trained model to a SageMaker endpoint. If you recently ran [the notebook for training](get_started_mnist_deploy.ipynb) with %store% magic, the `model_data` can be restored. Otherwise, we retrieve the model artifact from a pu...
github_jupyter
##### Copyright 2019 Google LLC. Licensed under the Apache License, Version 2.0 (the "License"); ``` #@title Default title text # 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...
github_jupyter
# Introduction In these labs we will work with HMMs in the form of Weighted Finite State Transducers. Examples were given at the start of Lecture 5, but if you need a refresh, read this [introduction](https://github.com/ZhaoZeyu1995/asr_labs/blob/master/introduction.pdf). We will use the Python interface to the [Ope...
github_jupyter
# LEARNING This notebook serves as supporting material for topics covered in **Chapter 18 - Learning from Examples** , **Chapter 19 - Knowledge in Learning**, **Chapter 20 - Learning Probabilistic Models** from the book *Artificial Intelligence: A Modern Approach*. This notebook uses implementations from [learning.py]...
github_jupyter
> **Copyright (c) 2020 Skymind Holdings Berhad**<br><br> > **Copyright (c) 2021 Skymind Education Group Sdn. Bhd.**<br> <br> Licensed under the Apache License, Version 2.0 (the \"License\"); <br>you may not use this file except in compliance with the License. <br>You may obtain a copy of the License at http://www.apach...
github_jupyter
``` import sys if 'google.colab' in sys.modules: !wget https://raw.githubusercontent.com/yandexdataschool/Practical_RL/0ccb0673965dd650d9b284e1ec90c2bfd82c8a94/week08_pomdp/atari_util.py !wget https://raw.githubusercontent.com/yandexdataschool/Practical_RL/0ccb0673965dd650d9b284e1ec90c2bfd82c8a94/week08_pomdp/e...
github_jupyter
# References * Stanford NLP Lecture * http://cs224d.stanford.edu/syllabus.html # Data * babi data for * http://www.thespermwhale.com/jaseweston/ * http://www.thespermwhale.com/jaseweston/babi/tasks_1-20_v1-2.tar.gz # Memory Networks Facebook AI ## Memory Networks (2014) ## End-To-End Memory Networks * Sou...
github_jupyter
# **Deep Learning for Detecting Pneumonia from X-ray Images** ``` import numpy as np # linear algebra import cv2 # import cv2 from PIL import Image from google.colab import drive drive.mount('/content/drive') DIR = open('/content/drive/MyDrive/Chest_Xray','r') print(DIR) train_folder = '/content/drive/MyDrive/Chest_Xr...
github_jupyter
``` %matplotlib inline import matplotlib.pyplot as plt import seaborn as sns sns.set(color_codes=True) from IPython.display import Image ``` Chapter 9 On-policy Prediction with Approximation ========= approximate value function: parameterized function $\hat{v}(s, w) \approx v_\pi(s)$ + applicable to partially obse...
github_jupyter
# PCA-tSNE-AE ``` %matplotlib notebook import tensorflow as tf import math from sklearn import datasets from sklearn.manifold import TSNE import numpy as np import matplotlib.pyplot as plt from matplotlib import cm from mpl_toolkits.mplot3d import Axes3D import seaborn as sns iris_dataset = datasets.load_iris() ``` ...
github_jupyter
``` import numpy as np import tensorflow as tf import lucid.modelzoo.vision_models as models from lucid.misc.io import show import lucid.misc.io.showing as showing from lucid.misc.channel_reducer import ChannelReducer import lucid.optvis.param as param import lucid.optvis.objectives as objectives import lucid.optvis.r...
github_jupyter
<img src="https://raw.githubusercontent.com/Qiskit/qiskit-tutorials/master/images/qiskit-heading.png" alt="Note: In order for images to show up in this jupyter notebook you need to select File => Trusted Notebook" width="500 px" align="left"> # _*Hello Qiskit*_ Click [here](https://mybinder.org/v2/gh/QISKit/qiskit-...
github_jupyter
# Self-Driving Car Engineer Nanodegree ## Deep Learning ## Project: Build a Traffic Sign Recognition Classifier ### Author: Sergey Morozov In this notebook, a traffic sign classifier is implemented. [German Traffic Sign Dataset](http://benchmark.ini.rub.de/?section=gtsrb&subsection=dataset) is used to train the mod...
github_jupyter
# Day 6 ### Topics 1. Bit of a review 1. Read in Image data with Stitch Image 1. Colors in images with Stitch Image 1. Goodness/badness histogram First, import our usual things: ``` import numpy as np import matplotlib.pyplot as plt import pandas as pd ``` ## Bit of a review Recall last time we played around with...
github_jupyter
``` import data_structures import utils import filters import labeling import pyfolio as pf import pandas as pd import numpy as np import pandas as pd import timeit import os from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import train_test_split from sklearn.metrics import roc_curve,...
github_jupyter
``` import sys import os sys.path.append(os.environ['GOTMWORK_ROOT']+'/tools', ) from gotmanalysis import * np.seterr(all='raise') %matplotlib inline timetag = '20080701-20080731' casename = 'JRA55-do_Global' forcing_reg_type = 'BG12' tmname = 'KPP-CVMix' update_data = False plot_figure = True apply_mask = True # check...
github_jupyter
# DataSynthesizer Usage (correlated attribute mode) > This is a quick demo to use DataSynthesizer in correlated attribute mode. ### Step 1 import packages ``` import os from time import time from DataSynthesizer.DataDescriber import DataDescriber from DataSynthesizer.DataGenerator import DataGenerator from DataSynt...
github_jupyter
# Sparse Autoregression Here we fit NeuralProphet to data with 5-minute resolution (daily temperatures at Yosemite). This is a continuation of the example notebook `autoregression_yosemite_temps`, focusing on sparsity. ``` if 'google.colab' in str(get_ipython()): !pip install git+https://github.com/ourownstory/ne...
github_jupyter
<a href="https://colab.research.google.com/github/zaidalyafeai/Notebooks/blob/master/Unet.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Introduction The U-Net model is a simple fully convolutional neural network that is used for binary segment...
github_jupyter
# Accesibilidad rural en Asturias Este documento explica cómo calcular la accesibilidad rural a hospitales, y otros proveedores de servicios básicos, como bancos o supermercados. Permite responder a preguntas como: * ¿Qué porcentaje de asturianos puede no llega, conduciendo, a su hospital más cercano en 1 hora? * ¿Có...
github_jupyter
# Voltammetry Simulations From Compton *et al.* "Understanding voltammetry: simulation of electrode processes", 2014 ## Cyclic Voltammogram (reversible) ``` import numpy as np import matplotlib.pyplot as plt from tqdm import tqdm %matplotlib widget def cv_rev(sigma): #Specify simulation parameters theta_i ...
github_jupyter
``` # initial setup try: # settings colab: import google.colab except ModuleNotFoundError: # settings local: %run "../../../common/0_notebooks_base_setup.py" ``` --- <img src='../../../common/logo_DH.png' align='left' width=35%/> #### Distribución Poisson La distribución Poisson cuenta **cantida...
github_jupyter
``` %matplotlib inline import numpy as np np.random.seed(42) %reload_ext autoreload %autoreload 2 PROJECT_DIR = "/Users/raghav/envPython3/experiments/one_class_neural_networks/" import sys,os import numpy as np sys.path.append(PROJECT_DIR) ``` ## Obtain Training and Test Datasets ``` ## Obtaining the training and te...
github_jupyter
``` import sys import json import time from datetime import datetime from pathlib import Path from dateutil import parser import requests import fiona import shapely.geometry as geom import pandas as pd import geopandas as gpd DIR = Path('..') sys.path.append(str(DIR)) DATA_DIR = DIR/'data/' %load_ext autoreload %...
github_jupyter
# PyTorch Metric Learning See the documentation [here](https://kevinmusgrave.github.io/pytorch-metric-learning/) ## Install the packages ``` !pip install pytorch-metric-learning !pip install -q faiss-gpu !git clone https://github.com/akamaster/pytorch_resnet_cifar10 ``` ## Import the packages ``` %matplotlib inline...
github_jupyter
<a href="https://colab.research.google.com/github/jgraving/deepposekit/blob/master/examples/step1_create_annotation_set.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # DeepPoseKit Step 1 - Create an annotation set This is step 1 of the example no...
github_jupyter
# The Local News Dataset View this document on [Github](https://github.com/yinleon/LocalNewsDataset/blob/master/nbs/local_news_dataset.ipynb?flush_cache=true) | [NbViewer](https://nbviewer.jupyter.org/github/yinleon/LocalNewsDataset/blob/master/nbs/local_news_dataset.ipynb?flush_cache=true#datasheet) by [Leon Yin](http...
github_jupyter
``` import tensorflow as tf import numpy as np from sklearn.preprocessing import normalize from sklearn.preprocessing import StandardScaler from sklearn.preprocessing import scale from sklearn.datasets import load_boston from sklearn.metrics import r2_score from sklearn.metrics import accuracy_score X_train = np.array(...
github_jupyter
# Count epitope mutations by trunk status for natural populations For a given tree, classify each node as trunk or not and count the number of epitope and non-epitope mutations. Finally, summarize the number of mutations by category of trunk and mutation. ``` from augur.distance import read_distance_map from augur.ut...
github_jupyter
# Imports We will be importing the following packages: 1. numpy 2. matplotlib 3. urllib 4. tqdm 5. imageio 6. glob 7. os 8. base64 9. IPython 10. **wandb** ``` %%capture ! pip install -q imageio ! pip install --upgrade wandb ! wandb login import numpy as np import matplotlib.pyplot as plt import urllib.request # impor...
github_jupyter
# Python 装饰器 装饰器(Decorators)是 Python 的一个重要部分。简单地说:他们是修改其他函数的功能的函数。他们有助于让我们的代码更简短,也更Pythonic(Python范儿)。大多数初学者不知道在哪儿使用它们,所以我将要分享下,哪些区域里装饰器可以让你的代码更简洁。 首先,让我们讨论下如何写你自己的装饰器。 这可能是最难掌握的概念之一。我们会每次只讨论一个步骤,这样你能完全理解它。 ## 一切皆对象 首先我们来理解下 Python 中的函数: ``` def hi(name="yasoob"): return "hi " + name print(hi()) # 我们甚至可以将一个函数赋...
github_jupyter
使用ResNet改良版的“批量归一化、激活和卷积”结构 ``` import time import torch from torch import nn, optim import torch.nn.functional as F import d2lzh_pytorch as d2l device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') def conv_block(in_channels, out_channels): blk = nn.Sequential( nn.BatchNorm2d(in_channels...
github_jupyter
<a href="https://colab.research.google.com/github/irahulcse/Data-Science-Work-For-Quora/blob/master/Copy_of_quora.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Quora Data Framework New ``` from sklearn.model_selection import train_test_split f...
github_jupyter
``` import pandas as pd df = pd.read_csv('data/tpch.csv', sep=',') df1 = df.head(1000000) df1['gid'] = 1 df1 paritioning_attributes = ['count_order', 'sum_base_price', 'sum_disc_price', 'sum_charge', 'avg_qty', 'avg_price', 'avg_disc', 'sum_qty'] k = len(paritioning...
github_jupyter
# Lesson 1 - What's your pet ### Trying to pass pretrained weights into Learner created model, and making create_cnn working with custom models. I am using resnet50 only to make it comparable to the usual fastai resnet50 training scores to confirm that my method works. ``` %reload_ext autoreload %autoreload 2 %matplo...
github_jupyter
``` %matplotlib inline import matplotlib.pyplot as plt import matplotlib.colors as colors import matplotlib.cm as cmx import numpy as np from scipy.io import wavfile, loadmat import os import sys print(sys.path) # directory where phonemes are kept, as per phon_input_directory_path dirr = '/Users/robinson/Downloads/data...
github_jupyter
``` import tensorflow as tf from tensorboard.plugins.hparams import api as hp import math import os import sys module_path = os.path.abspath(os.path.join('..')) if module_path not in sys.path: sys.path.append(module_path) from src.preparation import fetch_dataset from src.processing import split_train_test_val, da...
github_jupyter
# The InterlockLedger RESTful API This notebook will show the usage of some features of the Python client of the InterlockLedger RESTful API. ``` %load_ext autoreload %autoreload 2 import sys import traceback import json #sys.path.append('../') from il2_rest import RestNode from il2_rest.util import PKCS12Certifica...
github_jupyter
##### Copyright 2021 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
# Feature Engineering In this notebook, I will focus on feature engineering and seeing how that may improve the performance of the LightGBM model I am currently working on. ## Potential Models to Submit 1. LGBM, all features, OHE of cat variables, on X scores: 0.7994213376003929. Submission score: 0.7306 2. LGBM, al...
github_jupyter
# Computer Lab 4: Forecasting Daily Data using Facebook Prophet **In this practical you will learn:** * How to wrangle time series data into `Prophet` format * How to fit a `Prophet` model to a time series * How to obtain a point forecast and prediction intervals using `Prophet` * How to model special calender events...
github_jupyter
``` %matplotlib inline import matplotlib.pyplot as plt import random def choose(n, k): if n == k: return [[1]*k] subsets = [[0] + a for a in choose(n-1,k)] if k > 0: subsets += [[1] + a for a in choose(n-1,k-1)] return subsets def graham_sloane_codes(n): # n is length of codeword ...
github_jupyter
Copyright (c) Microsoft Corporation. All rights reserved. # Tutorial (part 2): Use automated machine learning to build your regression model This tutorial is **part two of a two-part tutorial series**. In the previous tutorial, you [prepared the NYC taxi data for regression modeling](regression-part1-data-prep.ipynb...
github_jupyter
# Generating Skewed Data for Prediction This notebook helps generating skewed data based on the [covertype](https://archive.ics.uci.edu/ml/datasets/covertype) dataset from UCI Machine Learning Repository. The generated data is then used to simulate online prediction request workload to a deployed model version on the ...
github_jupyter
<div style="text-align: right">Peter Norvig, 12 Feb 2016<br>Revised 17 Feb 2018</div> # A Concrete Introduction to Probability (using Python) In 1814, Pierre-Simon Laplace [wrote](https://en.wikipedia.org/wiki/Classical_definition_of_probability): >*Probability theory is nothing but common sense reduced to calculat...
github_jupyter
# Setting up a non-equilibrium dynamic simulation on quantum hardware ___ This notebook executes the example outlined in Sec. 7.2. ## Overview In this notebook, we will learn how to design a quantum circuit in Qiskit to simulate a quantum quench and run the circuit on the IBM's Quantum Computer and quantum simulator....
github_jupyter
``` import matplotlib.pyplot as plt import numpy as np e_set_cgan = np.load('e_set_cgan.npy')*100 e_set_cvae = np.concatenate(([0],np.load('e_set_cvae.npy')*100)) e_single_cgan = np.load('e_single_cgan.npy')*100 e_single_cvae = np.concatenate(([0],np.load('e_single_cvae.npy')*100)) y_set_cgan = np.load('y_set_cgan.npy'...
github_jupyter
``` !date #Download datasets import requests import os from tqdm import tnrange, tqdm_notebook def download_file(doi,ext): url = 'https://api.datacite.org/dois/'+doi+'/media' r = requests.get(url).json() netcdf_url = r['data'][0]['attributes']['url'] r = requests.get(netcdf_url,stream=True) #Set file name fna...
github_jupyter
# Computer Vision In this notebook we're going to cover the basics of computer vision using CNNs. So far we've explored using CNNs for text but their initial origin began with computer vision tasks. <img src="figures/cnn_cv.png" width=650> # Configuration ``` config = { "seed": 1234, "cuda": True, "data_url":...
github_jupyter
``` import numpy as np import pandas as pd ``` # *Series ``` lbl = ['x','y','z'] my_data = [11,22,33] arr = np.array(my_data) d = {'a':10, 'b':20,'c':30} ``` ## Creating pandas series ### 1) Using Python List ``` pd.Series(my_data) #it looks like numpy array but it has index pd.Series(my_data,lbl) ...
github_jupyter
# Data description & Problem statement: This data set contains a total 5820 evaluation scores provided by students from Gazi University in Ankara (Turkey). There is a total of 28 course specific questions and additional 5 attributes. Please check the description at: http://archive.ics.uci.edu/ml/datasets/turkiye+stude...
github_jupyter
<a href="https://www.bigdatauniversity.com"><img src="https://ibm.box.com/shared/static/cw2c7r3o20w9zn8gkecaeyjhgw3xdgbj.png" width="400" align="center"></a> <h1 align="center"><font size="5">CONTENT-BASED FILTERING</font></h1> Recommendation systems are a collection of algorithms used to recommend items to users bas...
github_jupyter
# Importing Necessary Modules ``` import sys import pandas as pd import numpy as np import matplotlib.pyplot as plt %matplotlib inline plt.style.use("ggplot") plt.rcParams['figure.figsize'] = (12, 8) import seaborn as sns sns.set(style='whitegrid', color_codes=True) import warnings warnings.filterwarnings('ignore') fr...
github_jupyter
### Step 1 Download and prepare data ``` DATA_DIR = 'PATH_TO_THE_DATA_DIR' # This example is for demonstration purposes # Please refer to the corresponding NLP tutorial on NeMo documentation ! bash get_wkt2.sh $DATA_DIR # verify data is there ! ls -l $DATA_DIR/wikitext-2 # Prepare tokenization model ! python create_v...
github_jupyter
## Data curation example This notebook provides two data curation examples using data produced in the PV lab. ### 1. perovskite process data The first example is the processing conditions for solution synthesizing perovsktie materials. We want to understand the relationship between the crystal dimensionality of perov...
github_jupyter
# COMP 135 Fall 2019: HW1 STARTER # Setup comp135_env package imports ``` import os import numpy as np import sklearn.neighbors import sklearn.tree from matplotlib import pyplot as plt import seaborn as sns %matplotlib inline ``` # Setup student-defined imports ``` from LeastSquaresLinearRegression import LeastSqu...
github_jupyter
``` import numpy as np from keras.models import Model from keras.layers import Input from keras.layers.convolutional import ZeroPadding2D from keras import backend as K import json from collections import OrderedDict def format_decimal(arr, places=6): return [round(x * 10**places) / 10**places for x in arr] DATA = ...
github_jupyter
``` from collections import defaultdict, Counter from itertools import zip_longest import json import os import re import sys import urllib import numpy as np import requests from consequence_prediction.vep_mapping_pipeline.consequence_mapping import * %matplotlib inline import matplotlib.pyplot as plt from eva_cttv...
github_jupyter
``` from tensorflow.keras.layers import Conv2D, Flatten, MaxPooling2D, Dense, \ DepthwiseConv2D, Input, ReLU, AvgPool2D, BatchNormalization from tensorflow.keras.optimizers import Adam from tensorflow.keras.preprocessing.image import img_to_array from tensorflow.keras.preprocessing.image import load_img import matp...
github_jupyter
# Exercises 06 - Strings and Dictionaries ## 0. Length of Strings Let's start with a string lightning round to warm up. What are the lengths of the strings below? For each of the five strings below, predict what `len()` would return when passed that string. Use the variable `length` to record your answer. ``` a = "...
github_jupyter
# <center><b>Oil Data Quality Index</b></center> ### <center>First Draft<br><br>January 2015<br>Author: James L. Makela</center> ## <u>1. Background</u> The Adios3 Oil Library will accept data on crude oils and refined products provided they contain a minimum required set of data. Additional missing data will be ge...
github_jupyter
Assignment In this assignment, students will have to use the badges dataset from the UCI repository and pick a vectorizer of their choice to structure the data. Next they have to apply decision tree classifier by trying different maximum depths for the tree and evaluating last 10 instances to verify results. ...
github_jupyter
# Building a case study: vegetation analysis <img align="middle" src="../_static/session_5/01_vegetation_analysis_ch.PNG" alt="Screenshot from the crop health notebook." width="600"> *The Crop Health notebook investigated in Session 1 is an example of a case study. We now have enough knowledge of the Sandbox to build...
github_jupyter
### Dimensional analysis The fastest way to get into the unit system is to explore the quantities that live in the `yt.units` namespace: ``` from yt.units import meter, gram, kilogram, second, joule print (kilogram*meter**2/second**2 == joule) print (kilogram*meter**2/second**2) from yt.units import m, kg, s, W kg*m*...
github_jupyter
# 3.4.4 Least Angle Regression Least angle regression (LAR) uses a similar strategy to Forwarf stepwise regression, but only enters "as much" of a predictor as it deserves. **Algorithm 3.2** 1. Standardize the predictors to have mean zero and unit norm. Start with the residual $\mathbf{r} = \mathbf{y} - \mathbf{\ove...
github_jupyter
<table> <tr align=left><td><img align=left src="./images/CC-BY.png"> <td>Text provided under a Creative Commons Attribution license, CC-BY. All code is made available under the FSF-approved MIT license. (c) Kyle T. Mandli</td> </table> ``` from __future__ import print_function, division ``` Note to lecturers: This...
github_jupyter
``` %matplotlib inline ``` # Visualizing the stock market structure This example employs several unsupervised learning techniques to extract the stock market structure from variations in historical quotes. The quantity that we use is the daily variation in quote price: quotes that are linked tend to cofluctuate dur...
github_jupyter
This notebook is part of the $\omega radlib$ documentation: https://docs.wradlib.org. Copyright (c) 2018, $\omega radlib$ developers. Distributed under the MIT License. See LICENSE.txt for more info. # Converting Reflectivity to Rainfall Reflectivity (Z) and precipitation rate (R) can be related in form of a power...
github_jupyter
# Abstract classes and Interfaces 추상 클래스와 인터페이스 --- ## Abstract classes 추상 클래스는 계층구조를 잡기 위해서만 정의된 클래스로 - `abstract` 키워드를 사용 - 직접 new로 생성자를 호출해 객체를 만들 수 없다 (인터페이스와 마찬가지) - 추상클래스의 특징 - 멤버변수와 생성자를 정의할 수 있음!!! (인터페이 차이점) - 추상메소드(내용이 정의되지 않은 메소드)를 선언할 수 있음 - 이것은 인터페이스와 마찬가지임 - 내용이 있는 메소드도 정의 가능하긴 함 (인터페이스도...
github_jupyter
<h1 style='color: green; font-size: 36px; font-weight: bold;'>Data Science - Regressão Linear</h1> # <font color='red' style='font-size: 30px;'>Conhecendo o Dataset</font> <hr style='border: 2px solid red;'> ## Importando bibliotecas ``` import pandas as pd import numpy as np ``` ## Bibliotecas opcionais ``` impor...
github_jupyter
<img align="right" style="max-width: 200px; height: auto" src="cfds_logo.png"> ### Lab 06 - "Supervised Machine Learning - k Nearest Neighbor Classification" Chartered Financial Data Scientist (CFDS), Autumn Term 2020 In the last lab, you got your hands dirty with supervised learning by using the Gaussian Naive-Bay...
github_jupyter
``` import os import torch import torch.nn as nn import torch.optim as optim import pandas as pd from skimage import io, transform import numpy as np import matplotlib.pyplot as plt from torch.utils.data import Dataset, DataLoader from torchvision import transforms, utils import pickle from PIL import Image names = ope...
github_jupyter
``` %matplotlib inline import pandas as pd import numpy as np import matplotlib.pyplot as plt df = pd.read_csv('../data/csvs/dkpes.csv') df.head(10) y = df['Signal-inhibition'].values fgroup_cols = ['3-Keto', '3-Hydroxy', '12-Keto', '12-Hydroxy', '19-Methyl', '18-Methyl', 'Sulfate-Ester', ...
github_jupyter
# Setup ``` import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from sklearn import (datasets, dummy, metrics, model_selection as skms, multiclass as skmulti, naive_bayes, ...
github_jupyter
# Long Short-Term Memory (LSTM) Model --- Lets first create a tiny LSTM network sample to understand the architecture of LSTM networks. We need to import the necessary modules for our code. We need <b><code>numpy</code></b> and <b><code>tensorflow</code></b>, obviously. Additionally, we can import directly the <b><co...
github_jupyter
# Week 3 - For Loops (part 2) and Conditionals (part 1) ## The following play critical roles: ### 1. For Loops - iterating through data. ### 2. Conditional Statements - adding logic to our statements. ## 1. For Loops ### For Loops are your best friend - most used Python expression for journalists: ### Iterate o...
github_jupyter
The following cell should always be the first coding cell of your python notebooks ``` student_id = raw_input('Please enter your NETID (e.g. ydubief)') print(student_id) assignment_name = 'HW1_'+student_id """ importing the necessary libraries, do not modify """ %matplotlib inline # plots graphs within the notebook ...
github_jupyter
# EDA Exploratory Data Analysis adalah proses yang memungkinkan analyst memahami isi data yang digunakan, mulai dari distribusi, frekuensi, korelasi dan lainnya. Dalam proses ini pemahaman konteks data juga diperhatikan karena akan menjawab masalah - masalah dasar. ## 1. Import Libraries Import library yang akan di...
github_jupyter
... ***CURRENTLY UNDER DEVELOPMENT*** ... ## HyCReWW runup estimation inputs required: * Nearshore reconstructed historical storms * Nearshore reconstructed simulated storms * Historical water levels * Synthetic water levels in this notebook: * HyCReWW runup estimation of historical and synthetic event...
github_jupyter
``` from utils import * import tensorflow as tf from sklearn.cross_validation import train_test_split import time trainset = sklearn.datasets.load_files(container_path = 'data', encoding = 'UTF-8') trainset.data, trainset.target = separate_dataset(trainset,1.0) print (trainset.target_names) print (len(trainset.data)) p...
github_jupyter
``` import torch import os os.environ['CUDA_VISIBLE_DEVICES'] = "0" from tqdm.auto import tqdm import numpy as np from matplotlib import pyplot as plt from torch import nn import gin from functools import partial gin.enter_interactive_mode() @gin.configurable def get_xy(h=10, w=10, s=1000): res = np.zeros((s, h, w)...
github_jupyter
# Snowflake Notebook to demonstrate how to use the Snowflake Spark connector from FinSpace. ## Objective For every table found in a snowflake database, create a FinSpace dataset and populate an associated attribute set with the values necessary to retrieve the table of data from snowflake directly (catalog, schema, an...
github_jupyter
``` import sys from multiprocessing import Pool, cpu_count import pandas as pd import numpy as np from fuzzywuzzy import process sys.path.append('../src') from my_aws import S3 s3_connect = S3() key_tor = 'OMDB_Torrents.csv' bucket = 'movie-torrents' df_tor = s3_connect.get_data(key_tor, bucket) key_num = 'TheNumbe...
github_jupyter
## Введение в Pandas ### Основы Библиотека **Pandas** основана на Numpy и применяется для обработки и анализа данных, представленных в виде больших разнородных таблиц. Как правило, реальные данные хранятся не в виде массивов чисел, а в виде структурированного набора данных (*sql, csv, json, excel, xml* и т.д.). Для о...
github_jupyter
# Monetary Economics: Chapter 4 ### Preliminaries ``` # This line configures matplotlib to show figures embedded in the notebook, # instead of opening a new window for each figure. More about that later. # If you are using an old version of IPython, try using '%pylab inline' instead. %matplotlib inline import matp...
github_jupyter