text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
``` 1/3 a = 0.99999999999999999 a? 62 * 41.2 * 2 / 250 from sklearn.preprocessing import scale, robust_scale, minmax_scale, maxabs_scale x = (np.arange(10, dtype=np.float) - 3).reshape(-1,1) df = pd.DataFrame(np.hstack([x, scale(x), robust_scale(x), minmax_scale(x), maxabs_scale(x)]), columns = ["x", ...
github_jupyter
# Test For The Best Machine Learning Algorithm For Prediction This notebook takes about 40 minutes to run, but we've already run it and saved the data for you. Please read through it, though, so that you understand how we came to the conclusions we'll use moving forward. ## Six Algorithms We're going to compare six ...
github_jupyter
Create the tables for this section. ``` %load_ext sql # Connect to an empty SQLite database %sql sqlite:// %%sql DROP TABLE IF EXISTS Purchase; -- Create tables CREATE TABLE Purchase ( Product VARCHAR(255), Date DATE, Price FLOAT, Quantity INT ); -- Insert tuples INSERT INTO Purchase ...
github_jupyter
``` import pandas as pd import numpy as np from sklearn.linear_model import LinearRegression from sklearn.preprocessing import MinMaxScaler from sklearn.model_selection import train_test_split from sklearn.model_selection import RandomizedSearchCV,GridSearchCV from sklearn.metrics import mean_absolute_error from s...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from sklearn.metrics import accuracy_score from sklearn.model_selection import train_test_split from sklearn.naive_bayes import GaussianNB from sklearn.linear_model import LogisticRegression from sklearn.neighbors import KN...
github_jupyter
# Construction of the Model of Adaptive Resistance in Melanoma (MARM1) In this notebook we will provide a step-by-step construction of the MARM model. The model is constructed using the rule-based modeling tool PySB <cite data-cite="2754712/L894YC64"></cite>. The model definition files generated by this script in PySB...
github_jupyter
##### Copyright 2019 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
# Agilent 34411A versus Keysight 34465A The following notebook perfoms a benchmarking of the two DMMs. In part one, raw readings of immediate voltages are timed and compared. In part two, actual sweeps are performed with a QDac. ``` %matplotlib notebook import time import matplotlib.pyplot as plt import numpy as np ...
github_jupyter
``` from arcgishub.hub import Hub myhub = Hub("https://www.arcgis.com", "username", "password") ``` We start by fetching the page we would like to edit the layout of. ``` page1 = myhub.pages.get('e014c56c58854f0289d2c4b4009e1818') page1 layout = page1.layout ``` ### Accessing elements of a page ``` page1.layout.se...
github_jupyter
# Task description - Classify the speakers of given features. - Main goal: Learn how to use transformer. - Baselines: - Easy: Run sample code and know how to use transformer. - Medium: Know how to adjust parameters of transformer. - Hard: Construct [conformer](https://arxiv.org/abs/2005.08100) which is a variety ...
github_jupyter
*This notebook was adapted from [course notes by Dr. Kate Follette](https://github.com/kfollette/ASTR200-Spring2017)* Further modified from notes by G. Besla, P. Pinto, E. Hayati (https://github.com/gurtina/P105A_2019) ## CIERA Summer Camp 2019: Intro to Python ## Contents 1. Variable Types 2. Conditi...
github_jupyter
``` import sagemaker print(sagemaker.__version__) sess = sagemaker.Session() bucket = sess.default_bucket() print(bucket) prefix = 'dogscats-images' s3_train_path = 's3://{}/{}/input/train/'.format(bucket, prefix) s3_val_path = 's3://{}/{}/input/val/'.format(bucket, prefix) s3_train_lst_path = 's3://{}/{}/input/trai...
github_jupyter
## Customizing datasets in fastai ``` from fastai.gen_doc.nbdoc import * from fastai.vision import * ``` In this tutorial, we'll see how to create custom subclasses of [`ItemBase`](/core.html#ItemBase) or [`ItemList`](/data_block.html#ItemList) while retaining everything the fastai library has to offer. To allow basi...
github_jupyter
# SVM with polynomial kernel The goal of this notebook is to find the best parameters for polynomial kernel. We also want to check if the parameters depend on stock. We will use [sklearn.svm](http://scikit-learn.org/stable/modules/generated/sklearn.svm.SVC.html#sklearn.svm.SVC) library to perform calculations. We wan...
github_jupyter
# Model This notebook builds a Doc2Vec model for matching course descriptions to job descriptions. It trains the model on a corpus of course descriptions (from the Coursera catalog). Then it evaluates the model by testing it out with a sample set of job descriptions for which relevant courses have already been pre-sel...
github_jupyter
# Serving Deep Learning Models ``` %matplotlib inline import matplotlib.pyplot as plt import pandas as pd import numpy as np df = pd.read_csv('../data/wifi_location.csv') df.head() df['location'].value_counts() df.plot(figsize=(12, 8)) plt.axvline(500) plt.axvline(1000) plt.axvline(1500) plt.title('Indoor location dat...
github_jupyter
## Load libraries ``` !pip install -q -r requirements.txt import sys import os import numpy as np import pandas as pd from PIL import Image import torch import torch.nn as nn import torch.utils.data as D from torch.optim.lr_scheduler import ExponentialLR import torch.nn.functional as F from torch.autograd import Var...
github_jupyter
``` import os from tensorflow.keras import layers from tensorflow.keras import Model !wget --no-check-certificate \ https://storage.googleapis.com/mledu-datasets/inception_v3_weights_tf_dim_ordering_tf_kernels_notop.h5 \ -O /tmp/inception_v3_weights_tf_dim_ordering_tf_kernels_notop.h5 from tensorflow.keras....
github_jupyter
``` import cv2 import numpy as np from pynput.mouse import Button, Controller import wx mouse = Controller() app=wx.App(False) (sx,sy)=wx.GetDisplaySize() lower_blue = np.array([110,100,100]) upper_blue = np.array([130,255,255]) lower_red = np.array([170,120,70]) upper_red = np.array([180,255,255]) imw =500 imh = int(i...
github_jupyter
# Bring Your Own R Algorithm _**Create a Docker container for training R algorithms and hosting R models**_ --- --- ## Notes awesome blog post: <https://aws.amazon.com/de/blogs/machine-learning/train-and-host-scikit-learn-models-in-amazon-sagemaker-by-building-a-scikit-docker-container/> ```bash aws ec2 describe-r...
github_jupyter
A **Deep Q Network** implementation in tensorflow with target network & random experience replay. The code is tested with Gym's discrete action space environment, CartPole-v0 on Colab. --- ## Notations: Model network = $Q_{\theta}$ Model parameter = $\theta$ Model network Q value = $Q_{\theta}$ (s, a) Target netw...
github_jupyter
# Basis for grayscale images ## Introduction Consider the set of real-valued matrices of size $M\times N$; we can turn this into a vector space by defining addition and scalar multiplication in the usual way: \begin{align} \mathbf{A} + \mathbf{B} &= \left[ \begin{array}{ccc} a_{0,0} & \do...
github_jupyter
## Practice with the Gensium Tutorial for LDA Topic Modeling Topic modeling is a technique for taking some unstructured text and automatically extracting its common themes, it is a great way to get a bird's eye view on a large text collection. Gensim = “Generate Similar” is a popular open source natural language pro...
github_jupyter
# Splunk Hypergraphs ### Prerequisites Install Python packages using some variant of `pip install juypter splunk-sdk graphistry` ### Headers ``` import pandas as pd import graphistry #api.graphistry.com/api/encrypt?text=emailCanary graphistry.register("FIXME") ``` ### Connect to Splunk https://github.com/graphistry...
github_jupyter
# Matching of curves, optimal transport v kernel-varifold data attachment ``` # Preliminary imports to get the right path to lddmm_python... import os import sys module_path = os.path.abspath(os.path.join('..')) if module_path not in sys.path: sys.path.append(module_path) PACKAGE_PARENT = '..' SCRIPT_DIR = os.path...
github_jupyter
# Kubeflow Pipelines with Katib component In this notebook you will: - Create Katib Experiment using random algorithm. - Use median stopping rule as an early stopping algorithm. - Use Kubernetes Job with mxnet mnist training container as a Trial template. - Create Pipeline to get the optimal hyperparameters. Referenc...
github_jupyter
## Import packages ``` import numpy as np import matplotlib.pyplot as plt from scipy.signal import savgol_filter import cline_analysis as ca import pandas as pd import seaborn as sns import datetime import os from scipy.signal import medfilt import functools from scipy.optimize import bisect from scipy import stats s...
github_jupyter
``` %matplotlib inline import pandas as pd import numpy as np import matplotlib.pyplot as plt from functools import reduce plt.style.use('ggplot') results = pd.read_csv("/Users/rob/proj/lt/gwgm/geowave-geomesa-comparative-analysis/analyze/gwgm-ca-run-results-Oct1.csv") def get_cluster_results(clusterId): return re...
github_jupyter
## Experimenting with loss Truncation Based on the paper: <i>Improved Natural Language Generation via Loss Truncation</i>. In broad strokes, they show that adaptively removing high loss examples is a method to optimize for distinguishability. ``` import tensorflow as tf from tensorflow.keras import backend as K from ...
github_jupyter
``` import numpy as np import pandas as pd from gensim.models import word2vec from keras.preprocessing.text import Tokenizer from keras.preprocessing.sequence import pad_sequences from sklearn.preprocessing import LabelEncoder,OneHotEncoder from keras.preprocessing import sequence from keras.models import Sequentia...
github_jupyter
``` import pandas as pd from sklearn import preprocessing from sklearn.preprocessing import Binarizer from sklearn.preprocessing import LabelEncoder, OneHotEncoder from sklearn.linear_model import LogisticRegression from sklearn.model_selection import train_test_split from sklearn.pipeline import Pipeline, make_union f...
github_jupyter
``` import pickle import numpy as np import matplotlib.pyplot as plt # from keras.models import Model # from keras.layers import Input, Conv2D, MaxPooling2D, UpSampling2D # import tensorflow.python.util.deprecation as deprecation # deprecation._PRINT_DEPRECATION_WARNINGS = False from tensorflow.keras.models import ...
github_jupyter
# Building offline iPhone spam classifier using coreml iOS 11 introduced message extension to filter spam messages and coreml to build custom machine learned models to predict spam or not. In this article I’ll go over all the steps I took to build a machine learning model and how I added it to an iphone project. ## L...
github_jupyter
![alt text](https://github.com/callysto/callysto-sample-notebooks/blob/master/notebooks/images/Callysto_Notebook-Banner_Top_06.06.18.jpg?raw=true) # Music - Let's Play! **Submitted by: A, B, C, D** <table><tr> <td> <img src="data/spotify.png" alt="Spotify Logo" style="width: 650px;"/> </td> <td> <img src="data/instr...
github_jupyter
``` # Install TensorFlow # !pip install -q tensorflow-gpu==2.0.0-rc0 try: %tensorflow_version 2.x # Colab only. except Exception: pass import tensorflow as tf print(tf.__version__) # More imports from tensorflow.keras.layers import Input, Dense, Flatten from tensorflow.keras.applications.vgg16 import VGG16 as Pr...
github_jupyter
# Evaluate the performance of a model on the test set ``` %load_ext autoreload %autoreload 2 from pathlib import Path import holoviews as hv import hvplot.pandas import janitor import numpy as np import pandas as pd import torch from pytorch_hcs.datasets import BBBC021DataModule from pytorch_hcs.models import ResNet...
github_jupyter
# Classificadores binários ``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns import itertools import time import warnings import collections as cll from keras.utils import np_utils from sklearn.neural_network import MLPClassifier from sklearn.model_selection import train_...
github_jupyter
# Multilayer Perceptron After the first notebook, we now have an impression on what neural networks and deep learning are capable of. But one question remained open: <center>__What is a neural network?__</center> The most basic form of a neural network is the **multi-layer perceptron (MLP)** and goes back to Frank Ro...
github_jupyter
# Tutorial 3a: Extreme Averaging In this notebook we will set up a huge single column database and take the average of the numbers in it. The goal is to stress test `pandas` ability to work with large datasets. ### Requirements You will need to have installed `sqlalchemy` and `pandas`. ``` import numpy as np import...
github_jupyter
# Model comparison ## 0. Libraries import ``` %pylab inline #utils import pandas as pd import re import copy from datetime import datetime from costum_utils import glasgow_maker #data pre processing from sklearn.preprocessing import StandardScaler from sklearn.preprocessing import PowerTransformer from sklearn.mode...
github_jupyter
## Introduction<br> ### Analayzed Data<br> In this data analysis project, I have chosen csv's from the data set Gapminder World. The csv's are:<br> <ul style="list-style-type:circle"> <li><b>car_deaths_per_100000_people.csv</b> (description: Mortality among drivers and passengers of 4-wheel motorized vehicles, per ...
github_jupyter
# DSE Course 1, Lab 3 Alternate: Practice with Statistical Methods **Instructor**: Wesley Beckner **Contact**: wesleybeckner@gmail.com <br> --- <br> In this lab we will continue to practice with the regression models we've covered: Linear, log, lasso and ridge regression <br> --- ``` # Pandas library for the p...
github_jupyter
**Initialization** * I use these 3 lines of code on top of my each Notebooks because it will help to prevent any problems while reloading and reworking on a Project or Problem. And the third line of code helps to make visualization within the Notebook. ``` #@ Initialization: %reload_ext autoreload %autoreload 2 %matp...
github_jupyter
# CSE 555 - Introduction to Pattern Recognition ## Programming Assignment 3 ### Probabilistic Graphical Models #### Mohamed Fazil M S ``` from pgmpy.models import BayesianModel from pgmpy.factors.discrete import TabularCPD import daft from daft import PGM import matplotlib.pyplot as plt from pgmpy.models import Junct...
github_jupyter
``` %tensorflow_version 2.x ``` #Diving into the ML ecosystem ``` import matplotlib.pyplot as plt import random random.seed(7) fig = plt.figure() for i in range(10): x1 = abs(random.random()*70.0) + 20.0 x2 = abs(random.random()*100.0) + 100.0 plt.plot(x1,x2,'rx') plt.xlabel('$x_1$') plt.ylabel('$x_2$') plt.t...
github_jupyter
### 2.2 CNN Models - Test Cases The trained CNN model was performed to a hold-out test set with 10,873 images. The network obtained 0.743 and 0.997 AUC-PRC on the hold-out test set for cored plaque and diffuse plaque respectively. ``` import time, os import torch torch.manual_seed(42) from torch.autograd import Var...
github_jupyter
``` %matplotlib inline from __future__ import unicode_literals, print_function, division from io import open import unicodedata import string import re import random import torch import torch.nn as nn from torch.autograd import Variable from torch import optim import torch.nn.functional as F use_cuda = torch.cuda.is_...
github_jupyter
The purpose of this notebook is to test that the Unity environment works as expected while training with ml environments ``` from mlagents.envs.environment import UnityEnvironment import numpy as np import matplotlib.pyplot as plt import torch print(torch.cuda.is_available()) from ddpg_agent import Agent ``` ## Star...
github_jupyter
``` %matplotlib inline from pyvista import set_plot_theme set_plot_theme('document') ``` # Parametric Geometric Objects Creating parametric objects ``` # sphinx_gallery_thumbnail_number = 12 import pyvista as pv from math import pi ``` This example demonstrates how to plot parametric objects using pyvista ## Sup...
github_jupyter
# Ex3: Fitting spiky responses The Vector Fitting feature is demonstrated using a 4-port example network copied from the scikit-rf `tests` folder. This network is a bit tricky to fit because of its many resonances in the individual response. Additional explanations and background information can be found in the [Vecto...
github_jupyter
This post continue [series](http://intellimath.bitbucket.org/blog/categories/axon.html) about [AXON](http://intellimath.bitbucket.org/axon) and [pyaxon](http://pypi.python.org/pypi/pyaxon). Now we consider some examples of object serialization/deserialization. <!-- TEASER_END --> ``` from __future__ import print_func...
github_jupyter
# Generalized Network Analysis Tutorial - Step 2 In the second part of our generalized network analysis tutorial, the user is presented with another jupyter notebook where all the correlation maps calculated in the first part can be translated into molecular visualizations or plots. Here we provide an opportunity for ...
github_jupyter
## Memory management utils Utility functions for memory management. Currently primarily for GPU. ``` from fastai.gen_doc.nbdoc import * from fastai.utils.mem import * show_doc(gpu_mem_get) ``` [`gpu_mem_get`](/utils.mem.html#gpu_mem_get) * for gpu returns `GPUMemory(total, free, used)` * for cpu returns `GPUMemory(...
github_jupyter
# Create your own pipeline ## Initial phase ### Import necessary libraries ``` # Standard python libraries import logging import os import time logging.basicConfig(format='[%(asctime)s] (%(levelname)s): %(message)s', level=logging.INFO) # Installed libraries import numpy as np import pandas as pd from sklearn.metri...
github_jupyter
<sub>&copy; 2021-present Neuralmagic, Inc. // [Neural Magic Legal](https://neuralmagic.com/legal)</sub> # PyTorch Detection Model Pruning using SparseML This notebook provides a step-by-step walkthrough for pruning an already trained (dense) model to enable better performance at inference time using the [DeepSparse ...
github_jupyter
``` from torch.utils.data import DataLoader from sentence_transformers import SentenceTransformer, SentencesDataset, LoggingHandler, losses, util, InputExample, models from sentence_transformers.evaluation import EmbeddingSimilarityEvaluator import logging import math import numpy as np logging.basicConfig(format='%(a...
github_jupyter
``` import keras from keras.models import Sequential, Model, load_model import os import pickle import numpy as np import pandas as pd import scipy.sparse as sp import scipy.io as spio import matplotlib.pyplot as plt from scrambler.models import * from scrambler.utils import OneHotEncoder, get_sequence_masks from s...
github_jupyter
# Using Existing Accuracy Reference Points You maybe fortunate enough to have some existing reference points which you can use for your accuracy assessment. If this is the case then you simply need to populate those points with your classification information. ## Running Notebook The notebook has been run and saved...
github_jupyter
First, move within a simulation directory. This directory should contains the sub-directory 'output/' that contains snapshot files, and a file 'snapshot_times.txt' that lists all snapshot scale-factors/redshifts/times in the simulation and their corresponding file index number. Ensure that gizmo_analysis and utilities...
github_jupyter
### Init stuff ``` from matplotlib.pyplot import * import matplotlib from numpy import * import pandas as pd import niddk_covid_sicr as ncs ``` ### Define ROI ``` roi = 'US_SD' ``` ### Define paths and other ``` model_name = 'SICRMQC' models_path = '/Users/carsonc/github/covid-sicr/models/' casepath = '/Users/cars...
github_jupyter
<center> <h1>DatatableTon</h1> 💯 datatable exercises <br> <br> <a href='https://github.com/vopani/datatableton/blob/master/LICENSE'> <img src='https://img.shields.io/badge/license-Apache%202.0-blue.svg?logo=apache'> </a> <a href='https://github.com/vopani/datatableton'> <img...
github_jupyter
# 5. Parameter Space To run a DYNAMITE model, one must specify a number of parameters for the gravitational potential. The aim of this notebook is to demonstrate how to specify these parameters and to highlight features that we have implemented in order to help you explore parameter space. We'll start as before by r...
github_jupyter
## PaySim Dataset ##### <b>step</b> - integer - maps a unit of time in the real world. In this case 1 step is 1 hour of time. Total steps 744 (30 days simulation). ##### <b>type</b> - string/categorical - type of transaction: CASH-IN, CASH-OUT, DEBIT, PAYMENT and TRANSFER. ##### <b>amount</b> - float - amount of the...
github_jupyter
``` %matplotlib inline import numpy as np from matplotlib import pyplot as plt ``` # Unsupervised learning: Hierarchical and density-based clustering algorithms In a previous notebook, "08 Unsupervised Learning - Clustering.ipynb", we introduced one of the essential and widely used clustering algorithms, K-means. One...
github_jupyter
## Dependencies ``` import os, warnings import numpy as np import pandas as pd import seaborn as sns from matplotlib import pyplot as plt from transformers import TFDistilBertModel import tensorflow as tf from tensorflow.keras.models import Model from tensorflow.keras import optimizers, metrics, losses from tensorflow...
github_jupyter
# The Fibonacci Sequence **Reference Note:** This reference notebook includes 3 reference implementations: one checking for a hash map implementation, one checking for a dynamic programming implementation, and one checking that a student is _not_ using the naive recursive implementation. ``` import pybryt import pybr...
github_jupyter
# Deutsch-Josza Algorithm In this section, we first introduce the Deutsch-Josza problem, and classical and quantum algorithms to solve it. We then implement the quantum algorithm using Qiskit, and run on a simulator and device. ## Contents 1. [Introduction](#introduction) 1.1 [Deutsch-Josza Problem](#djprobl...
github_jupyter
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/vik0/LangevinDQN/blob/main/LangevinDQN_tutorial.ipynb) # Langevin DQN Colab to run a simple experiment with Langevin DQN on deep sea environment. The aim of this colab is to provide sample code to run...
github_jupyter
# K Fold Cross Validation K-fold cross-validation works by: * splitting the full dataset into k equal length partitions, * selecting k-1 partitions as the training set and * selecting the remaining partition as the test set * training the model on the training set, * using the trained model to predict labels on the t...
github_jupyter
``` import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt import re from nltk.corpus import stopwords stop = list(set(stopwords.words('english'))) f_train = open('../data/train_14k_split_conll.txt','r',encoding='utf8') line_train = f_train.readlines() f_val = open('../data/dev_3...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt from matplotlib import rcParams import seaborn as sns import json import pandas as pd import random from numba import jit import time plt.style.use('ggplot') # Load the Drive helper and mount from google.colab import drive # This will prompt for authorization. dri...
github_jupyter
<a href="https://colab.research.google.com/github/toandaominh1997/Kaggle/blob/master/Digit%20Recognizer/Digit_Recognizer.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` #Import Library import numpy as np import pandas as pd import os import te...
github_jupyter
Title: RP- Spatial Accessibility of COVID-19 Healthcare Resources in Illinois --- ### Original Replication (no results altering improvements have been made to the code) **Reproduction of**: Rapidly measuring spatial accessibility of COVID-19 healthcare resources: a case study of Illinois, USA Original study *by* Kan...
github_jupyter
<img src="https://github.com/fjmeyer/HydroSAR/raw/master/HydroSARbanner.jpg" width="100%" /> <font face="Calibri"> <br> <font size="6"> <b>Load HyP3 Data for Flood Depth Mapping</b><img style="padding: 7px" src="../Master/NotebookAddons/UAFLogo_A_647.png" width="170" align="right"/></font> <font size="4"> <b> Part of...
github_jupyter
<a href="https://colab.research.google.com/github/yukinaga/twitter_bot/blob/master/python_basic/02_python_basic_2.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Pythonの基礎2 Pythonの基礎として、関数やクラスについて解説します。 ## ●関数 関数を用いることで、複数行の処理をまとめることができます。 関数はd...
github_jupyter
# Spectral Representation Method Author: Lohit Vandanapu Date: August 19, 2018 Last Modified: May 09, 2019 In this example, the Spectral Representation Method is used to generate stochastic processes from a prescribed Power Spectrum and associated Cross Spectral Density. This example illustrates how to use the SRM cla...
github_jupyter
``` # default_exp models.transformer ``` # Transformer model > inspired from DETR : https://colab.research.google.com/github/facebookresearch/detr/blob/colab/notebooks/detr_demo.ipynb#scrollTo=h91rsIPl7tVl ``` #export from fastai.vision.all import * from moving_mnist.models.conv_rnn import * if torch.cuda.is_availabl...
github_jupyter
``` import pandas as pd import numpy as np import string import os import sys import random from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler import matplotlib.pyplot as plt ``` 식사 항목의 가격 문제 ``` #계산대에서의 진짜 가격 p_fish = 150;p_chips = 50;p_ketchup = 100 #식사 가격 샘플: 10일 ...
github_jupyter
# DIPY S0s `02-diff-dipy-S0s.ipynb` ver. 20200422 ``` import os import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import dipy from dipy.io.image import save_nifti from dipy.io.image import load_nifti from dipy.io import read_bvals_bvecs from dipy.core.gradients import gradient_table dipy.__ver...
github_jupyter
``` # download training data from https://www.kaggle.com/c/avazu-ctr-prediction/data # upload the data to s3 # !aws s3 cp --profile ml_user ~/SageMaker/mastering-ml-on-aws/chapter4/train.gz s3://mastering-ml-aws/chater4/data/train.gz s3_train_path = 's3://mastering-ml-aws/chapter4/data/train.gz' ctr_df = spark.read.c...
github_jupyter
<table class="ee-notebook-buttons" align="left"> <td><a target="_blank" href="https://github.com/giswqs/earthengine-py-notebooks/tree/master/Datasets/sentinel-2.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td> <td><a target="_blank" href="ht...
github_jupyter
##Introduction The Black-Scholes model was first introduced by Fischer Black and Myron Scholes in 1973 in the paper "The Pricing of Options and Corporate Liabilities". Since being published, the model has become a widely used tool by investors and is still regarded as one of the best ways to determine fair prices of o...
github_jupyter
![Astrofisica Computacional](../logo.PNG) --- ## 01. Ecuaciones Diferenciales Parciales I. Generalidades Eduard Larrañaga (ealarranaga@unal.edu.co) --- ### Resumen Se presentan las generalidades de los sistemas de Ecuaciones Diferenciales Parciales (PDE). `A. Garcia. Numerical Methods for Physics. (1999). Chapt...
github_jupyter
# Scenario 1 Data Creation This notebook creates 4 datasets to be used for Scenario 1 and then solves each problem to ensure that the results make reasonable sense. ``` import pandas as pd import names import random import requests import re from numpy.random import choice from datetime import datetime, timedelta impo...
github_jupyter
``` from itertools import product import numpy as np from graspy.simulations import er_np, sbm from graspy.plot import heatmap from scipy.stats import ttest_ind import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from joblib import Parallel, delayed import warnings warnings.filterwarnings("ignore...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec testY=np.load('TestY.npy') predictY=np.load('PredictY.npy') timeSeriesLen=testY.shape[1] x=np.arange(timeSeriesLen) testYsample=testY[0,:,:] predictSample=predictY[0,:,:] plt.clf() plt.figure(figsize = (9,7)) gs=gridspec.Grid...
github_jupyter
## Auto Submission Tool For Deepracer ## Import the required Libraries ``` from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by import By import time import datetime from selenium.webdr...
github_jupyter
## TODO: * possibly add other activation functions (non-differentiable) * simulated annealing? ~~nelder mead?~~ * ~~right now, only globalbestpso used~~ * ~~add button to run optimization only after clicking~~ * ~~Cost history / number of iterations needed compared to classic MLP~~ comparison between # Neural Network...
github_jupyter
## How to use In this noteboook we test the rewards given out by the protocol to different types of validators. Our `fast` config reduces the size of most constants to avoid allocating more memory than necessary (we'll only test with a few validators). We also reduce the number of slots per epoch to speed things up. A...
github_jupyter
*아래 링크를 통해 이 노트북을 주피터 노트북 뷰어(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/nlp-with-pytorch/blob/master/chapter_7/7_3_surname_generation/7_3_Model2_Condition...
github_jupyter
# Experiment C Ideas: ~~1) Estudar as diferentes distâncias para vetores 1-D em `scipy.spatial.distance`.~~ ~~2) De 1, implementar e otimizar os que melhor performam comos portfólios.~~ 3) Ver a possibilidade de recomendar com base em 2 ou mais empresas (`users`) Eu não queria usar valores médios entre os vetores...
github_jupyter
# An Introduction to Linear Algebra for Quantum Computing ``` from matplotlib import pyplot as plt import numpy as np from qiskit import * from qiskit.visualization import plot_bloch_vector ``` ### Introduction Linear algebra is the language of quantum computing. It is therefore crucial to develop a good understandi...
github_jupyter
### In this notebook we will compile interesting questions that we can answer using the data from this table. ### We can refer to data_exploration.ipynb to figure out what kind of information we already have. 1. On an average, how often do people order from Instacart? 2. What product was ordered most often? 3. At what...
github_jupyter
# Deep CNNs for Violin Melody Extraction from Polyphonic Music Signals #### Contributors: Mr. David Fong, Dr. Patrick Naylor ## Import Required Modules ``` # import standard modules import numpy as np # import custom modules import chooseRepresentation import preprocessing import training import postprocessing impor...
github_jupyter
This notebook shows how to use `GatedFeedbackLSTMRNNCell` along with `MultiGatedFeedbackRNNCell`. It essentially borrows the code from this blog: https://r2rt.com/recurrent-neural-networks-in-tensorflow-ii.html, which I have to make a few changes on to let it be compatible with the current Tensorflow version (r1.3) I ...
github_jupyter
``` import sys import os from autodp.calibrator_zoo import eps_delta_calibrator,generalized_eps_delta_calibrator, ana_gaussian_calibrator from autodp import rdp_bank from autodp.mechanism_zoo import ExactGaussianMechanism, PureDP_Mechanism,SubsampleGaussianMechanism, GaussianMechanism, ComposedGaussianMechanism, Laplac...
github_jupyter
``` from functools import reduce import pandas as pd import pprint class Classifier(): data = None class_attr = None priori = {} cp = {} hypothesis = None def __init__(self,filename=None, class_attr=None ): self.data = pd.read_csv(filename, sep=',', header =(0)) self.class_at...
github_jupyter
# Dropout Dropout [1] is a technique for regularizing neural networks by randomly setting some output activations to zero during the forward pass. In this exercise you will implement a dropout layer and modify your fully-connected network to optionally use dropout. [1] [Geoffrey E. Hinton et al, "Improving neural netw...
github_jupyter
``` import sys sys.path.append('../') import os import numpy as np import pandas as pd from PIL import Image from sklearn.externals import joblib from tqdm import tqdm_notebook as tqdm from common_blocks.utils import run_length_encoding from common_blocks.metrics import compute_eval_metric METADATA_FILEPATH = 'YOU...
github_jupyter
## mixer calibration ``` %load_ext autoreload %autoreload 2 import h5py import numpy as np import matplotlib.pyplot as plt from src.utils import * path = '../data/raw/mix_cal/mixer1/' file_name = 'mix_cal_0' file = path + file_name + '.h5' import json with open(path + 'config_' + file_name + '.json', 'r') as f: c...
github_jupyter