code
stringlengths
2.5k
150k
kind
stringclasses
1 value
# Zipline Pipeline ### Introduction On any given trading day, the entire universe of stocks consists of thousands of securities. Usually, you will not be interested in investing in all the stocks in the entire universe, but rather, you will likely select only a subset of these to invest. For example, you may only wa...
github_jupyter
**0. Code for Colab Debugging** ``` from google.colab import drive drive.mount('/content/gdrive') %cd /content/gdrive/My Drive/lxmert/src/ !pip install transformers import torch print(torch.cuda.is_available()) ``` **1. Import pckgs & Set basic configs** ``` # Base packages import logging import math import os from ...
github_jupyter
``` %load_ext cypher import json import random geotweets = %cypher match (n:tweet) where n.coordinates is not null return n.tid, n.lang, n.country, n.name, n.coordinates, n.created_at geotweets = geotweets.get_dataframe() geotweets.head() json.loads(geotweets.ix[1]["n.coordinates"])[0][0] def get_random_coords(df): ...
github_jupyter
# Network waterfall generation ``` import pandas as pd import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt %matplotlib inline from math import sqrt import re, bisect from colorama import Fore ``` ## Select input file and experiment ID (~10 experiments per file) - ./startup : Application startu...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.linear_model import LinearRegression from sklearn.model_selection import train_test_split from sklearn.metrics import r2_score, mean_squared_error import seaborn as sns import statsmodels.api as sm %matplotlib inline ``` # 1. BUSIN...
github_jupyter
# Taller evaluable sobre la extracción, transformación y visualización de datos usando IPython **Juan David Velásquez Henao** jdvelasq@unal.edu.co Universidad Nacional de Colombia, Sede Medellín Facultad de Minas Medellín, Colombia # Instrucciones En la carpeta 'Taller' del repositorio 'ETVL-IPython' se enc...
github_jupyter
## Advanced usage ### Using config files Instead of specifying all inputs using [set_input](https://inbo.github.io/niche_vlaanderen/lowlevel.html#niche_vlaanderen.Niche.set_input), it is possible to use a config file. A config file can be loaded using [read_config_file](https://inbo.github.io/niche_vlaanderen/lowlevel...
github_jupyter
### Requirements #### Jupyter Nbextensions - Python Markdown - Load Tex Macros #### Python & Libs - Python version $\geq$ 3.4 - Numpy version $\geq$ 1.17 - Pandas version $\geq$ 1.0.3 ``` import string import operator import functools import numpy as np import pandas as pd from collections import Counter from I...
github_jupyter
## Figure tracer transport ``` #import gsw as sw # Gibbs seawater package import cmocean as cmo import matplotlib.pyplot as plt import matplotlib.colors as mcolors import matplotlib.gridspec as gspec %matplotlib inline from netCDF4 import Dataset import numpy as np import pandas as pd import seaborn as sns import sys ...
github_jupyter
# Documentation - Generate the datasets used for evotuning the esm model - for each dataset, filter out those sequence longer than 1024 - pfamA_balanced: 18000 entries for 4 clans related to motors - motor_toolkit: motor toolkit - kinesin_labelled: kinesin labelled dataset - pfamA_target_shuffled: pfamA_target - pfamA_...
github_jupyter
## Compare Network Architectures Now that we have a reasonable baseline for our EasyDeepFakes dataset, let's try to improve performance. For starters, let's just compare how a variety of networks perform on this dataset. We will try: - ResNet - XResNet - EfficientNet - MesoNet - XceptionNet ``` from fastai.core...
github_jupyter
# 开发 AI 应用 未来,AI 算法在日常生活中的应用将越来越广泛。例如,你可能想要在智能手机应用中包含图像分类器。为此,在整个应用架构中,你将使用一个用成百上千个图像训练过的深度学习模型。未来的软件开发很大一部分将是使用这些模型作为应用的常用部分。 在此项目中,你将训练一个图像分类器来识别不同的花卉品种。可以想象有这么一款手机应用,当你对着花卉拍摄时,它能够告诉你这朵花的名称。在实际操作中,你会训练此分类器,然后导出它以用在你的应用中。我们将使用[此数据集](http://www.robots.ox.ac.uk/~vgg/data/flowers/102/index.html),其中包含 102 个花卉类别。你可以在下面查看...
github_jupyter
# Machine Learning for Telecom with Naive Bayes # Introduction Machine Learning for CallDisconnectReason is a notebook which demonstrates exploration of dataset and CallDisconnectReason classification with Spark ml Naive Bayes Algorithm. ``` from pyspark.sql.types import * from pyspark.sql import SparkSession from s...
github_jupyter
# Feature Engineering with PySpark ## Exploratory Data Analysis ``` import pyspark as sp sp.version import sys print(sys.version_info) sys.version ``` import os os.environ["JAVA_HOME"] = "/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home" ``` sc = sp.SparkContext.getOrCreate() sc.version # spark sess...
github_jupyter
# Recommending products with RetailRocket event logs This IPython notebook illustrates the usage of the [ctpfrec](https://github.com/david-cortes/ctpfrec/) Python package for _Collaborative Topic Poisson Factorization_ in recommender systems based on sparse count data using the [RetailRocket](https://www.kaggle.com/re...
github_jupyter
``` import numpy as np import seaborn as sns import pandas as pd import matplotlib.pyplot as plt plt.rcParams['axes.titlesize'] = 20 plt.rcParams['axes.titleweight'] = 10 ``` ## 1. Dataset Read ``` df = pd.read_csv("haberman.csv") df.head() ``` ## 2. Basic Analysis ``` print("No. of features are in given dataset :...
github_jupyter
``` """ You can run either this notebook locally (if you have all the dependencies and a GPU) or on Google Colab. Instructions for setting up Colab are as follows: 1. Open a new Python 3 notebook. 2. Import this notebook from GitHub (File -> Upload Notebook -> "GITHUB" tab -> copy/paste GitHub URL) 3. Connect to an in...
github_jupyter
``` from os import fsdecode import subprocess import math import json from numpy import linalg as la, ma import numpy as np import time import os import julian import matplotlib.pyplot as plt import pandas as pd from numpy.linalg import linalg from scipy.spatial.transform import Rotation as R from scipy.spatial import ...
github_jupyter
# Continuous Control --- In this notebook, you will learn how to use the Unity ML-Agents environment for the second project of the [Deep Reinforcement Learning Nanodegree](https://www.udacity.com/course/deep-reinforcement-learning-nanodegree--nd893) program. ### 1. Start the Environment We begin by importing the ne...
github_jupyter
<a href="https://colab.research.google.com/github/GMTAccount/Projets-scolaires/blob/main/Projet_Gomoku.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> <h1> Liste des erreurs </h1> <ul> <li style="color:green;"> Recentrer le premier point (fa...
github_jupyter
# Introduction to Python part IV (And a discussion of linear transformations) ## Activity 1: Discussion of linear transformations * Orthogonality also plays a key role in understanding linear transformations. How can we understand linear transformations in terms of a composition of rotations and diagonal matrices? ...
github_jupyter
View more, visit my tutorial page: https://morvanzhou.github.io/tutorials/ My Youtube Channel: https://www.youtube.com/user/MorvanZhou Dependencies: * torch: 0.1.11 * torchvision * matplotlib ``` import torch import torch.nn as nn from torch.autograd import Variable import torch.utils.data as Data import torchvision ...
github_jupyter
``` import torch torch.cuda.is_available() # check if GPU is available ``` # Automatic differentiation using Autograd ``` x = torch.ones(2, 2, requires_grad=True) print(x) y = x + 2 print(y) z = y * y * 3 out = z.mean() print(z, out) a = torch.randn(2, 2) a = ((a * 3) / (a - 1)) print(a.requires_grad) a.requires_gra...
github_jupyter
# **Welcome to the Python Workshop! Here is your starter code** ``` %matplotlib inline ``` ### Try out hello world below! It's easy I promise. ``` print("Hello World") ``` ## What are we analyzing? We're going to be looking at the sales numbers over a 5 year period of batmobiles for Wayne Enterprises. We can see ...
github_jupyter
``` import cv2 import matplotlib.pyplot as plt import time import cProfile import numpy as np ``` # Walker detection with openCV ## Open video and get video info ``` video_capture = cv2.VideoCapture('resources/TestWalker.mp4') # From https://www.learnopencv.com/how-to-find-frame-rate-or-frames-per-second-fps-in-open...
github_jupyter
# 人脸检测 人脸检测,顾名思义,从图像中找到人脸。这是计算机视觉中一个非常经典的物体检测问题。经典人脸检测算法如Viola-Jones算法已经内置在OpenCV中,一度是使用OpenCV实现人脸检测的默认方案。不过OpenCV最新发布的4.5.4版本中提供了一个全新的基于神经网络的人脸检测器。这篇笔记展示了该检测器的使用方法。 ## 准备工作 首先载入必要的包,并检查OpenCV版本。 如果你还没有安装OpenCV,可以通过如下命令安装: ```bash pip install opencv-python ``` ``` import cv2 from PIL import Image print(f"你需要Open...
github_jupyter
``` # This Python 3 environment comes with many helpful analytics libraries installed # It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python # For example, here's several helpful packages to load in import numpy as np # linear algebra import pandas as pd # data processing, CSV file...
github_jupyter
<a href="https://colab.research.google.com/github/Eurus-Holmes/PyTorch-Tutorials/blob/master/Training_a__Classifier.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` %matplotlib inline ``` Training a Classifier ===================== This is it....
github_jupyter
# Direct Outcome Prediction Model Also known as standardization ``` %matplotlib inline from sklearn.linear_model import LinearRegression from sklearn.ensemble import GradientBoostingRegressor from causallib.datasets import load_smoking_weight from causallib.estimation import Standardization, StratifiedStandardization...
github_jupyter
Getting rid of bottom bands - Jessica's run (run01) =================================================== Run01 Jessica's runs (360x360x90, her bathymetry and stratification initial files) -------------------------------------------------------------- Initial stratifications, Depths 162, 315, 705 m, Across-shelf slice ...
github_jupyter
# Classifying Fashion-MNIST Now it's your turn to build and train a neural network. You'll be using the [Fashion-MNIST dataset](https://github.com/zalandoresearch/fashion-mnist), a drop-in replacement for the MNIST dataset. MNIST is actually quite trivial with neural networks where you can easily achieve better than 9...
github_jupyter
<a href="https://colab.research.google.com/github/HenrryCordovillo/Redes_Neuronales_con_Python/blob/main/Ejercicio_3%2C_Perceptr%C3%B3n.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import numpy as np from keras.models import Sequential from...
github_jupyter
## Observations and Insights ## Dependencies and starter code ``` # Dependencies and Setup import matplotlib.pyplot as plt import pandas as pd import scipy.stats as st import numpy as np # Study data files mouse_metadata = "data/Mouse_metadata.csv" study_results = "data/Study_results.csv" # Read the mouse data and ...
github_jupyter
# Accessing data in a DataSet After a measurement is completed all the acquired data and metadata around it is accessible via a `DataSet` object. This notebook presents the useful methods and properties of the `DataSet` object which enable convenient access to the data, parameters information, and more. For general ov...
github_jupyter
# Inverse Analysis of Turbidites by Machine Learning Technique # Preprocessing of training and test data sets ``` import numpy as np import os import ipdb def connect_dataset(dist_start, dist_end, file_list, outputdir, topodx=5, offset=5000,gclass_num=4,test_data_num=100): """ Connect mul...
github_jupyter
Plotting with matplotlib - 1 ======================== ``` # plotting imports import matplotlib.pyplot as plt import seaborn as sns # other imports import numpy as np import pandas as pd from scipy import stats ``` Hello world --- Using the `pyplot` notation, very similar to how MATLAB works ``` plt.plot([0, 1, 2, 3...
github_jupyter
## Interacting with CerebralCortex Data Cerebral Cortex is MD2K's big data cloud tool designed to support population-scale data analysis, visualization, model development, and intervention design for mobile-sensor data. It provides the ability to do machine learning model development on population scale datasets and p...
github_jupyter
``` import numpy as np import pandas as pd from matplotlib import pyplot as plt from tqdm import tqdm %matplotlib inline from torch.utils.data import Dataset, DataLoader import torch import torchvision import torch.nn as nn import torch.optim as optim from torch.nn import functional as F device = torch.device("cuda" i...
github_jupyter
# Project: Wrangling and Analyze Data ``` import pandas as pd import numpy as np from twython import Twython import requests import json import time import matplotlib.pyplot as plt import seaborn as sns from wordcloud import WordCloud, STOPWORDS from PIL import Image import urllib ``` ## Data Gathering In the cells b...
github_jupyter
``` import sites_positionWithinProteins as pos reload(pos) fn_fasta = r"/Volumes/Speedy/FASTA/HUMAN20150706.fasta" fn_evidence = r"/Users/dblyon/CloudStation/CPR/BTW_sites/sites_positionsWithinProteins_input_v2.txt" fn_fasta fa = pos.Fasta() fa.set_file(fn_fasta) fa.parse_fasta() COLUMN_MODSEQ = "Modified sequence" COL...
github_jupyter
# Predicting Student Admissions with Neural Networks In this notebook, we predict student admissions to graduate school at UCLA based on three pieces of data: - GRE Scores (Test) - GPA Scores (Grades) - Class rank (1-4) The dataset originally came from here: http://www.ats.ucla.edu/ ## Loading the data To load the da...
github_jupyter
``` import pandas as pd auto_df = pd.read_csv("automatability.csv") #to transpose relative_emp_df = pd.read_csv("relativeEmployment.csv") #to transpose similar_df = pd.read_csv("newsimilarity.csv") wagechange_df = pd.read_csv("wageChange.csv") # all_csvs = [auto_df, relative_emp_df, similar_df, wagechange_df] # for cs...
github_jupyter
``` %reload_ext autoreload %autoreload 2 from fastai.basics import * from pathlib import Path import pandas as pd ``` # Rossmann ## Data preparation / Feature engineering Set `PATH` to the path `~/data/rossmann/`. Create a list of table names, with one entry for each CSV that you'll be loading: - train - store - st...
github_jupyter
``` from fastai.vision.all import * from moving_mnist.models.conv_rnn import * from moving_mnist.data import * if torch.cuda.is_available(): torch.cuda.set_device(1) print(torch.cuda.get_device_name()) ``` # Train Example: We wil predict: - `n_in`: 5 images - `n_out`: 5 images - `n_obj`: up to 3 objects ``...
github_jupyter
<a href="https://colab.research.google.com/github/yunjung-lee/class_python_data/blob/master/skin_cancer.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ########## skin cancer in kaggle dataset #### used knn ,dropout,save file ``` !git clone https...
github_jupyter
<a href="https://colab.research.google.com/github/will-cotton4/DS-Unit-2-Sprint-3-Classification-Validation/blob/master/module4-rf-gb/LS_DS_234_Random_Forests_Gradient_Boosting.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> _Lambda School Data Scie...
github_jupyter
# Basic Matplotlib cookbook By [Terence Parr](https://parrt.cs.usfca.edu). If you like visualization in machine learning, check out my stuff at [explained.ai](https://explained.ai). This notebook shows you how to generate basic versions of the common plots you'll need. ``` import numpy as np import pandas as pd impo...
github_jupyter
# Parameterization for sediment released by sea-ice ``` import numpy as np import matplotlib.pyplot as plt import matplotlib from mpl_toolkits.basemap import Basemap, cm import netCDF4 as nc import datetime as dt import pickle import scipy.ndimage as ndimage import xarray as xr %matplotlib inline ``` ##### Parameter...
github_jupyter
# Enable application insights and add custom logs in your endpoint ## Get your Azure ML Workspace ``` !pip install azureml-core import azureml from azureml.core import Workspace import mlflow.azureml workspace_name = '<YOUR-WORKSPACE>' resource_group = '<YOUR-RESOURCE-GROUP>' subscription_id = '<YOUR-SUBSCRIPTION-ID...
github_jupyter
# Talks markdown generator for academicpages Takes a TSV of talks with metadata and converts them for use with [academicpages.github.io](academicpages.github.io). This is an interactive Jupyter notebook ([see more info here](http://jupyter-notebook-beginner-guide.readthedocs.io/en/latest/what_is_jupyter.html)). The co...
github_jupyter
**Tools - pandas** *The `pandas` library provides high-performance, easy-to-use data structures and data analysis tools. The main data structure is the `DataFrame`, which you can think of as an in-memory 2D table (like a spreadsheet, with column names and row labels). Many features available in Excel are available pro...
github_jupyter
``` import os import sys from PIL import Image import numpy as np import shutil sys.path.extend(['..']) from utils.config import process_config import tensorflow as tf from tensorflow.layers import (conv2d, max_pooling2d, average_pooling2d, batch_normalization, dropout, dense) from tensorflow.nn import (relu, softma...
github_jupyter
# Some useful functions ``` import time from sklearn.metrics import confusion_matrix from sklearn.utils.multiclass import unique_labels import numpy as np import matplotlib import matplotlib.pyplot as plt %matplotlib inline from sklearn import svm from keras.models import Sequential from keras.layers import Conv2D,Ma...
github_jupyter
``` import gensim.downloader as api import gensim from gensim.models import Phrases from gensim.models import KeyedVectors, Word2Vec import numpy as np import nltk from nltk.corpus import stopwords import string from sklearn.metrics.pairwise import cosine_similarity import networkx as nx import ast import json filename...
github_jupyter
``` from __future__ import print_function import keras from keras.models import Sequential, Model, load_model import keras.backend as K import tensorflow as tf import pandas as pd import os import pickle import numpy as np import scipy.sparse as sp import scipy.io as spio import isolearn.io as isoio from scipy.st...
github_jupyter
# Applied Machine Learning ## Table of contents * [1. Notebook General Info](#1.-Notebook-General-Info) * [2. Python Basics](#2.-Python-Basics) * [2.1 Basic Types](#2.1-Basic-Types) * [2.2 Lists and Tuples](#2.2-Lists-and-Tuples) * [2.3 Dictionaries](#2.3-Dictionaries) * [2.4 Conditions](#2.4-Condition...
github_jupyter
*** *** # Introduction to Gradient Descent The Idea Behind Gradient Descent 梯度下降 *** *** <img src='./img/stats/gradient_descent.gif' align = "middle" width = '400px'> <img align="left" style="padding-right:10px;" width ="400px" src="./img/stats/gradient2.png"> **如何找到最快下山的路?** - 假设此时山上的浓雾很大,下山的路无法确定; - 假设你摔不死! ...
github_jupyter
<a href="https://colab.research.google.com/github/Build-Week-Saltiest-Hack-News-Trolls-2/datascience/blob/Moly-malibu-patch-1/Sentimental_Analysis_pre_model.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> #Sentimental Analysis Project: ``` !pip in...
github_jupyter
# What is probability? A simulated introduction ``` #Import packages import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt %matplotlib inline sns.set() ``` ## Learning Objectives of Part 1 - To have an understanding of what "probability" means, in both Bayesian and Frequentist ...
github_jupyter
# hgvs Documention: Examples This notebook is being drafted to run and review the code presented in the hgvs documentation that is in the "Creating a SequenceVariant from scratch" section (https://hgvs.readthedocs.io/en/stable/examples/creating-a-variant.html#overview). ## User Troubleshooting Users proposed state....
github_jupyter
# *Quick, Draw!* GAN In this notebook, we use Generative Adversarial Network code (adapted from [Rowel Atienza's](https://github.com/roatienza/Deep-Learning-Experiments/blob/master/Experiments/Tensorflow/GAN/dcgan_mnist.py) under [MIT License](https://github.com/roatienza/Deep-Learning-Experiments/blob/master/LICENSE)...
github_jupyter
<a href="https://colab.research.google.com/github/AaronGe88inTHU/dreye-thu/blob/master/DataGenerator.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` from google.colab import drive drive.mount('/content/drive') import numpy as np import cv2 from ...
github_jupyter
<a href="https://colab.research.google.com/github/bruno-janota/DS-Unit-2-Linear-Models/blob/master/module1-regression-1/LS_DS_211.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> Lambda School Data Science *Unit 2, Sprint 1, Module 1* --- # Regres...
github_jupyter
# 執行語音轉文字服務操作 ``` import azure.cognitiveservices.speech as speechsdk # Creates an instance of a speech config with specified subscription key and service region. # Replace with your own subscription key and region identifier from here: https://aka.ms/speech/sdkregion speech_key, service_region = "196f2f318dc744049eaf...
github_jupyter
``` import numpy as np import gym import k3d from ratelimiter import RateLimiter from k3d.platonic import Cube from time import time rate_limiter = RateLimiter(max_calls=4, period=1) env = gym.make('CartPole-v0') observation = env.reset() plot = k3d.plot(grid_auto_fit=False, camera_auto_fit=False, grid=(-1,-1,-1,1,1...
github_jupyter
**This notebook is an exercise in the [Python](https://www.kaggle.com/learn/python) course. You can reference the tutorial at [this link](https://www.kaggle.com/colinmorris/loops-and-list-comprehensions).** --- # Try It Yourself With all you've learned, you can start writing much more interesting programs. See if y...
github_jupyter
``` import numpy as np import pandas as pd from sklearn.svm import SVC from sklearn.decomposition import PCA from sklearn.preprocessing import Imputer from sklearn.preprocessing import StandardScaler from sklearn.model_selection import cross_val_score from sklearn.model_selection import train_test_split DATA = 'datas...
github_jupyter
<img align="left" src="https://lever-client-logos.s3.amazonaws.com/864372b1-534c-480e-acd5-9711f850815c-1524247202159.png" width=200> <br></br> <br></br> ## *Data Science Unit 1 Sprint 3 Assignment 1* # Apply the t-test to real data Your assignment is to determine which issues have "statistically significant" differ...
github_jupyter
### Note * Instructions have been included for each segment. You do not have to follow them exactly, but they are included to help you think through the steps. ``` # Dependencies and Setup import pandas as pd # File to Load purchanse_file = "Resources/purchase_data.csv" # Read Purchasing File and store into Pandas d...
github_jupyter
``` import matplotlib.pyplot as plt import matplotlib.image as mpimg import pickle import numpy as np import cv2 from moviepy.editor import VideoFileClip import math import glob class Left_Right: last_L_points = [] last_R_points = [] def __init__(self, last_L_points, last_R_points): self.last_L...
github_jupyter
# 3 More Namespace Operations ### 3.1 `locals()` and `globals()` Name binding operations covered so far: - *name* `=` (assignment) - `del` *name* (unbinds the name) - `def` *name* function definition (including lambdas) - `def name(`*names*`):` (function execution) - *name*`.`*attribute_name* `=`, `__setat...
github_jupyter
# Getting started ## Installing Python It is recommended that you install the full Anaconda Python 3.8, as it set up your Python environment, together with a bunch of often used packages that you'll use during this course. A guide on installing Anaconda can be found here: https://docs.anaconda.com/anaconda/install/. ...
github_jupyter
``` import numpy as np import cv2 import matplotlib.pyplot as plt import random import os img = cv2.imread("./map_bw.png") Map = np.array(~(img[:,:,0]==0)).astype(int) Navigable_terrain = np.array(Map.nonzero()).T Sidx = random.sample(range(0,Navigable_terrain.shape[0]),1) Eidx = Sidx while (Sidx==Eidx): Eidx = r...
github_jupyter
### Basic Programming 13 ### 1. Write a program that calculates and prints the value according to the given formula: ### Q = Square root of [(2 C D)/H] ### Following are the fixed values of C and H: ### C is 50. H is 30. ### D is the variable whose values should be input to your program in a comma-separated sequen...
github_jupyter
``` !pip install efficientnet #import the libraries needed import pandas as pd import numpy as np import os import cv2 from tqdm import tqdm_notebook as tqdm import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split from keras_preprocessing.image import ImageDataGenerator from tensorflo...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import math import seaborn as sns from sklearn import datasets from sklearn import metrics from sklearn.preprocessing import LabelBinarizer from sklearn.model_selection import train_test_split from sklearn.ensemble import RandomForestClassifier ...
github_jupyter
``` # disable overly verbose tensorflow logging import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # or any {'0', '1', '2'} import tensorflow as tf import numpy as np from tensorflow.keras.preprocessing.image import ImageDataGenerator from tensorflow.keras.models import Sequential, Model from tensorflow.keras.la...
github_jupyter
``` import os os.environ['CUDA_VISIBLE_DEVICES'] = '3' from tensor2tensor.data_generators import problem from tensor2tensor.data_generators import text_problems from tensor2tensor.data_generators import translate from tensor2tensor.layers import common_attention from tensor2tensor.utils import registry from tensor2ten...
github_jupyter
# Objective: Classify Amazon food reviews using Random Forest Classifier. We'll do the following exercises in this notebook * Load the data stored in the format 1. BoW 2. Tfidf 3. Avg. W2V 4. Tfidf weighted W2V * Divide the data in cross validation sets and find the optimal parameters...
github_jupyter
# Preprocess "ROC Stories" for Story Completion ``` %load_ext autoreload %autoreload 2 %matplotlib inline import os import glob import pandas as pd DATAPATH = '/path/to/ROCStories' ROCstory_spring2016 = pd.read_csv(os.path.join(DATAPATH, "ROCStories__spring2016 - ROCStories_spring2016.csv")) ROCstory_winter2017 = pd....
github_jupyter
``` from IPython.core.display import display, HTML display(HTML("<style>.container { width:85% !important; }</style>")) import os import time import numpy as np import pandas as pd from os import listdir from io import BytesIO import requests import tensorflow as tf from tensorflow import keras from tensorflow.keras ...
github_jupyter
# Introduction to the jupyter ecosystem & notebooks ## Before we get started ... <br> - most of what you’ll see within this lecture was prepared by Ross Markello, Michael Notter and Peer Herholz and further adapted for this course by Peer Herholz - based on Tal Yarkoni's ["Introduction to Python" lecture at Neurohac...
github_jupyter
## Use barcharts and heatmaps to visualize patterns in your data IGN Game Reviews provide scores from experts for the most recent game releases, ranging from 0 (Disaster) to 10 (Masterpiece). <img src="https://i.imgur.com/Oh06Fu1.png"> ## Load the data 1. Read the IGN data file into a dataframe named `ign_scores`. 2...
github_jupyter
<a href="https://colab.research.google.com/github/harmishpatel21/codesignal-IV-solutions/blob/main/code_signal_IV_solutions.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> **Code Signal Solution for Interview Challenges** **Problem Statement 1:** ...
github_jupyter
Fashion MNIST dataset ``` #!pip install --upgrade tensorflow from __future__ import absolute_import, division, print_function, unicode_literals # TensorFlow and tf.keras import tensorflow as tf from tensorflow import keras # Helper libraries import numpy as np import matplotlib.pyplot as plt print(tf.__version__) `...
github_jupyter
# Part 2: Introduction to Umami and the `Residual` Class Umami is a package for calculating metrics for use with for Earth surface dynamics models. This notebook is the second notebook in a three-part introduction to using umami. ## Scope of this tutorial Before starting this tutorial, you should have completed [Par...
github_jupyter
``` import pickle as pk import pandas as pd %pylab inline y_dic = pk.load(open("labelDic.cPickle","rb")) X_dic = pk.load(open("vectorDicGDIpair.cPickle","rb")) df = pd.read_csv('dida_v2_full.csv', index_col=0).replace('CO', 1).replace('TD', 0).replace('UK', -1) rd = np.vectorize(lambda x: round(x * 10)/10) essA_change...
github_jupyter
# Operations on word vectors Welcome to your first assignment of this week! Because word embeddings are very computionally expensive to train, most ML practitioners will load a pre-trained set of embeddings. **After this assignment you will be able to:** - Load pre-trained word vectors, and measure similarity usi...
github_jupyter
# Introduction # In this exercise, you'll work through several applications of PCA to the [*Ames*](https://www.kaggle.com/c/house-prices-advanced-regression-techniques/data) dataset. Run this cell to set everything up! ``` # Setup feedback system from learntools.core import binder binder.bind(globals()) from learnto...
github_jupyter
<img width="10%" alt="Naas" src="https://landen.imgix.net/jtci2pxwjczr/assets/5ice39g4.png?w=160"/> # LinkedIn - Send posts feed to gsheet <a href="https://app.naas.ai/user-redirect/naas/downloader?url=https://raw.githubusercontent.com/jupyter-naas/awesome-notebooks/master/LinkedIn/LinkedIn_Send_posts_feed_to_gsheet.i...
github_jupyter
--- # **Product Backorders** --- ## Introduction A **product backorder** is a customer order that has not been fulfilled. Product backorder may be the result of strong sales performance (e.g. the product is in such high demand that production cannot keep up with sales). However, backorders can upset consumers, lead ...
github_jupyter
# Regression Week 2: Multiple Regression (Interpretation) The goal of this first notebook is to explore multiple regression and feature engineering with existing graphlab functions. In this notebook you will use data on house sales in King County to predict prices using multiple regression. You will: * Use SFrames to...
github_jupyter
``` import numpy as np import matplotlib import matplotlib.pyplot as plt def N_single_qubit_gates_req_Rot(N_system_qubits, set_size): return (2*N_system_qubits+1)*(set_size-1) def N_CNOT_gates_req_Rot(N_system_qubits, set_size): return 2*(N_system_qubits-1)*(set_size-1) def N_cV_gates_req_LCU(N_system_qubits, s...
github_jupyter
<a href="https://colab.research.google.com/github/prithwis/KKolab/blob/main/KK_B2_Hadoop_and_Hive.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ![alt text](https://4.bp.blogspot.com/-gbL5nZDkpFQ/XScFYwoTEII/AAAAAAAAAGY/CcVb_HDLwvs2Brv5T4vSsUcz7O4r...
github_jupyter
# what's the neuron yield across probes, experimenters and recording sites? Anne Urai & Nate Miska, 2020 ``` # GENERAL THINGS FOR COMPUTING AND PLOTTING import pandas as pd import numpy as np import os, sys, time import scipy as sp # visualisation import matplotlib.pyplot as plt import seaborn as sns # ibl specific ...
github_jupyter
# Measurement Error Mitigation ## Introduction The measurement calibration is used to mitigate measurement errors. The main idea is to prepare all $2^n$ basis input states and compute the probability of measuring counts in the other basis states. From these calibrations, it is possible to correct the average result...
github_jupyter
# Generative Adversarial Network In this notebook, we'll be building a generative adversarial network (GAN) trained on the MNIST dataset. From this, we'll be able to generate new handwritten digits! GANs were [first reported on](https://arxiv.org/abs/1406.2661) in 2014 from Ian Goodfellow and others in Yoshua Bengio'...
github_jupyter
# FINN - Functional Verification of End-to-End Flow ----------------------------------------------------------------- **Important: This notebook depends on the tfc_end2end_example notebook, because we are using models that are available at intermediate steps in the end-to-end flow. So please make sure the needed .onnx...
github_jupyter
``` # dependencies and setup from bs4 import BeautifulSoup as bs from splinter import Browser import time import pandas as pd # NEED TO CHANGE THE PATH TO MATCH YOUR COMPUTER # showing the computer where to find the chromedriver executable_path = {"executable_path": "/usr/local/bin/chromedriver"} browser = Browser("chr...
github_jupyter
``` import tensorflow as tf from tensorflow.compat.v1 import ConfigProto from tensorflow.compat.v1 import InteractiveSession config = ConfigProto() config.gpu_options.per_process_gpu_memory_fraction = 0.5 config.gpu_options.allow_growth = True session = InteractiveSession(config=config) # import the libraries as shown...
github_jupyter