code
stringlengths
2.5k
150k
kind
stringclasses
1 value
# An analysis of the dataset presented in [this technical comment](https://arxiv.org/abs/2004.06601), but with our quality cuts applied As a response to our paper [Dessert et al. _Science_ 2020](https://science.sciencemag.org/content/367/6485/1465) (DRS20), we received [a technical comment](https://arxiv.org/abs/2004....
github_jupyter
# Multi-ConvNet Sentiment Classifier In this notebook, we concatenate the outputs of *multiple, parallel convolutional layers* to classify IMDB movie reviews by their sentiment. #### Load dependencies ``` import tensorflow from tensorflow.keras.datasets import imdb from tensorflow.keras.preprocessing.sequence import...
github_jupyter
# 工厂规划 等级:中级 ## 目的和先决条件 此模型和Factory Planning II都是生产计划问题的示例。在生产计划问题中,必须选择要生产哪些产品,要生产多少产品以及要使用哪些资源,以在满足一系列限制的同时最大化利润或最小化成本。这些问题在广泛的制造环境中都很常见。 ### What You Will Learn 在此特定示例中,我们将建模并解决生产组合问题:在每个阶段中,我们可以制造一系列产品。每种产品在不同的机器上生产需要不同的时间,并产生不同的利润。目的是创建最佳的多周期生产计划,以使利润最大化。由于维护,某些机器在特定时期内不可用。由于市场限制,每个产品每个月的销售量都有上限,并且存储容量也受到限制。...
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 (Remember to Change These) school_data_to_load = "Resources/schools_complete.csv" student_data...
github_jupyter
# Lesson 2: Computer Vision Fundamentals ## Submission, Markus Schwickert, 2018-02-22 ### Photos ``` #importing some useful packages import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np import cv2 import os %matplotlib inline #reading in an image k1=0 # select here which of the images i...
github_jupyter
``` import pandas as pd import matplotlib.pyplot as plt import datetime as dt import seaborn as sns import numpy as np import matplotlib.dates as mdates import datetime #sns.set(color_codes=True) import matplotlib as mpl mpl.rcParams['pdf.fonttype'] = 42 import statistics as st sns.set_style('whitegrid', {'axes.linewid...
github_jupyter
``` import os, importlib, sys import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split %load_ext autoreload # Common paths BASE_PATH = os.path.join(os.getcwd(), "..", "..") MODULE_PATH = os.path.join(BASE_PATH, "modules") DS_PATH = os.path.join(BASE_P...
github_jupyter
## Good review of numpy https://www.youtube.com/watch?v=GB9ByFAIAH4 ## Numpy library - Remember to do pip install numpy ### Numpy provides support for math and logical operations on arrays #### https://www.tutorialspoint.com/numpy/index.htm ### It supports many more data types than python #### https://www.tutor...
github_jupyter
<a href="https://colab.research.google.com/github/MattFinney/practical_data_science_in_python/blob/main/Session_2_Practical_Data_Science.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/><a> # Practical Data Science in Python ## Unsupervised Learning: Clas...
github_jupyter
# Python是什么? ### Python是一种高级的多用途编程语言,广泛用于各种非技术和技术领域。Python是一种具备动态语义、面向对象的解释型高级编程语言。它的高级内建数据结构和动态类型及动态绑定相结合,使其在快速应用开发上极具吸引力,也适合于作为脚本或者“粘合剂”语言,将现有组件连接起来。Python简单、易学的语法强调可读性,因此可以降低程序维护成本。Python支持模块和软件包,鼓励模块化的代码重用。 ``` print('hellow world') ``` ## Python简史 ### 1989,为了度过圣诞假期,Guido开始编写Python语言编译器。Python这个名字来自Guido的喜爱的电视连...
github_jupyter
<a href="https://colab.research.google.com/github/huan/concise-chit-chat/blob/master/Concise_Chit_Chat.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Concise Chit Chat GitHub Repository: <https://github.com/huan/concise-chit-chat> ## Code TODO:...
github_jupyter
# Scraping de Características Generales Se obtienen características generales del equipo de la página whoscored. Las estadísticas son de la temporada más reciente. ![alt text](generales.png) ``` from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import Web...
github_jupyter
``` from IPython.core.debugger import set_trace import numpy as np import import_ipynb from environment import * def heuristicLWR(num_jobs, num_mc, machines, durations): machines_ = np.array(machines) tmp = np.zeros((num_jobs,num_mc+1), dtype=int) tmp[:,:-1] = machines_ machines_ = tmp ...
github_jupyter
<img src="../../../../images/qiskit-heading.gif" 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"> # _*Quantum K-Means algorithm*_ The latest version of this notebook is available on https://github.com/qiskit/qiskit-tutorial....
github_jupyter
``` from tqdm.notebook import tqdm import math import gym import torch import torch.optim as optim from torch.utils.tensorboard import SummaryWriter from collections import deque from active_rl.networks.dqn_atari import ENS_DQN from active_rl.utils.memory import LabelledReplayMemory from active_rl.utils.optimization ...
github_jupyter
# Seminar for Lecture 13 "VAE Vocoder" In the lectures, we studied various approaches to creating vocoders. The problem of sound generation is solved by deep generative models. We've discussed autoregressive models that can be reduced to **MAF**. We've considered the reverse analogue of MAF – **IAF**. We've seen how ...
github_jupyter
# Trigger Examples Triggers allow the user to specify a set of actions that are triggered by the result of a boolean expression. They provide flexibility to adapt what analysis and visualization actions are taken in situ. Triggers leverage Ascent's Query and Expression infrastructure. See Ascent's [Triggers](https://as...
github_jupyter
## These notebooks can be found at https://github.com/jaspajjr/pydata-visualisation if you want to follow along https://matplotlib.org/users/intro.html Matplotlib is a library for making 2D plots of arrays in Python. * Has it's origins in emulating MATLAB, it can also be used in a Pythonic, object oriented way. ...
github_jupyter
# Procedures and Functions Tutorial MLDB is the Machine Learning Database, and all machine learning operations are done via Procedures and Functions. Training a model happens via Procedures, and applying a model happens via Functions. The notebook cells below use `pymldb`'s `Connection` class to make [REST API](../.....
github_jupyter
# Assignment 2 - Elementary Probability and Information Theory # Boise State University NLP - Dr. Kennington ### Instructions and Hints: * This notebook loads some data into a `pandas` dataframe, then does a small amount of preprocessing. Make sure your data can load by stepping through all of the cells up until que...
github_jupyter
_Lambda School Data Science - Model Validation_ # Feature Selection Objectives: * Feature importance * Feature selection ## Yesterday we saw that... ## Less isn't always more (but sometimes it is) ## More isn't always better (but sometimes it is) ![Image of Terry Crews](https://media.giphy.com/media/b8kHKZq3YFf...
github_jupyter
# Scraping Amazon Reviews using Scrapy in Python Part 2 > Are you looking for a method of scraping Amazon reviews and do not know where to begin with? In that case, you may find this blog very useful in scraping Amazon reviews. - toc: true - badges: true - comments: true - author: Zeyu Guan - categories: [spaCy, Pytho...
github_jupyter
### Analysis of motifs using Motif Miner (RINGS tool that employs alpha frequent subtree mining) ``` csv_files = ["ABA_14361_100ug_v5.0_DATA.csv", "ConA_13799-10ug_V5.0_DATA.csv", 'PNA_14030_10ug_v5.0_DATA.csv', "RCAI_10ug_14110_v5.0_DATA.csv", "PHA-E-10ug_13853_V5.0...
github_jupyter
``` from __future__ import division from __future__ import print_function import sys import math import pickle import copy import numpy as np import cv2 import matplotlib.pyplot as plt from DataLoader import Batch from Model import Model, DecoderType from SamplePreprocessor import preprocess # constants like filepaths ...
github_jupyter
# Descripción del TP ## Introducción En este práctico se pide desarrollar un programa que calcule parámetros de interés para un circuito RLC serie. Tomando como datos de entrada: * εmax * la frecuencia de la fuente en Hz * los valores de R, L y C: El programa debe determinar: * Imax * la diferencia de potencial...
github_jupyter
``` import json import random import numpy as np import tensorflow as tf from collections import deque from keras.models import Sequential from keras.optimizers import RMSprop from keras.layers import Dense, Flatten from keras.layers.convolutional import Conv2D from keras import backend as K import datetime import iter...
github_jupyter
<a href="https://colab.research.google.com/github/dauparas/tensorflow_examples/blob/master/VAE_cell_cycle.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> https://github.com/PMBio/scLVM/blob/master/tutorials/tcell_demo.ipynb Variational Autoencoder ...
github_jupyter
# Predicting Boston Housing Prices ## Using XGBoost in SageMaker (Hyperparameter Tuning) _Deep Learning Nanodegree Program | Deployment_ --- As an introduction to using SageMaker's Low Level API for hyperparameter tuning, we will look again at the [Boston Housing Dataset](https://www.cs.toronto.edu/~delve/data/bost...
github_jupyter
``` import DSGRN import cProfile import sys sys.setrecursionlimit(10**9) sys.path.insert(0,'/home/elizabeth/Desktop/GIT/dsgrn_acdc/src') import PhenotypeGraphviz import PhenotypeGraphFun import CondensationGraph_iter database = Database("/home/elizabeth/Desktop/ACDC/ACDC_Fullconn.db") network = Network("/home/elizabe...
github_jupyter
``` from FC_RNN_Evaluater.FC_RNN_Evaluater import * from FC_RNN_Evaluater.Stateful_FC_RNN_Configuration import * from FC_RNN_Evaluater.runFC_RNN_Experiment import * from keras import Model from keras.layers import TimeDistributed, LSTM, Dense, Dropout, Flatten, Input def getFinalModel(timesteps = timesteps, lstm_nodes ...
github_jupyter
``` import csv from io import StringIO with open('/Users/yetongxue/Downloads/网站管理.csv') reader = csv.reader(f, delimiter=',') for index,row in enumerate(reader): if index == 0: continue print(row) import tldextract result = tldextract.extract('http://*.sometime') result from queue import PriorityQueue i...
github_jupyter
### Cell Painting morphological (CP) and L1000 gene expression (GE) profiles for the following datasets: - **CDRP**-BBBC047-Bray-CP-GE (Cell line: U2OS) : * $\bf{CP}$ There are 30,430 unique compounds for CP dataset, median number of replicates --> 4 * $\bf{GE}$ There are 21,782 unique compounds for GE data...
github_jupyter
# Introduction Visualization of statistics that support the claims of Black Lives Matter movement, data from 2015 and 2016. Data source: https://www.theguardian.com/us-news/ng-interactive/2015/jun/01/about-the-counted Idea from BuzzFeed article: https://www.buzzfeednews.com/article/peteraldhous/race-and-police-shooti...
github_jupyter
``` import json import requests from bs4 import BeautifulSoup import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn.linear_model import LinearRegression from scipy.stats import norm df = pd.read_csv('user_info.csv') from selenium import webdriver options = webdriver.ChromeOptions() optio...
github_jupyter
# 1. Write a Python Program to Find LCM? ``` # Given some numbers, LCM of these numbers is the smallest positive integer that is divisible by all the numbers numbers def LCM(ls): lar = max(ls) flag=1 while(flag==1): for i in ls: if(lar%i!=0): flag=1 ...
github_jupyter
# Data Wrangling, Analysis and Visualization of @WeLoveDogs twitter data. ``` import pandas as pd import numpy as np import tweepy as ty import requests import json import io import time ``` ## Gathering ``` df = pd.read_csv('twitter-archive-enhanced.csv') df.head() image_response = requests.get(r'https://d17h27t6h...
github_jupyter
``` import keras import keras.backend as K from keras.datasets import mnist from keras.models import Sequential, Model, load_model from keras.layers import Dense, Dropout, Activation, Flatten, Input, Lambda from keras.layers import Conv2D, MaxPooling2D, AveragePooling2D, Conv1D, MaxPooling1D, LSTM, ConvLSTM2D, GRU, Bat...
github_jupyter
<a href="https://colab.research.google.com/github/iVibudh/TensorFlow-for-DeepLearning/blob/main/08-Time-Series-Forecasting/moving_average.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Moving average <table class="tfo-notebook-buttons" align="le...
github_jupyter
# Approximate q-learning In this notebook you will teach a __tensorflow__ neural network to do Q-learning. __Frameworks__ - we'll accept this homework in any deep learning framework. This particular notebook was designed for tensorflow, but you will find it easy to adapt it to almost any python-based deep learning fr...
github_jupyter
# NOAA Wave Watch 3 and NDBC Buoy Data Comparison *Note: this notebook requires python3.* This notebook demostrates how to compare [WaveWatch III Global Ocean Wave Model](http://data.planetos.com/datasets/noaa_ww3_global_1.25x1d:noaa-wave-watch-iii-nww3-ocean-wave-model?utm_source=github&utm_medium=notebook&utm_campa...
github_jupyter
# Aula 1 ``` import pandas as pd url_dados = 'https://github.com/alura-cursos/imersaodados3/blob/main/dados/dados_experimentos.zip?raw=true' dados = pd.read_csv(url_dados, compression = 'zip') dados dados.head() dados.shape dados['tratamento'] dados['tratamento'].unique() dados['tempo'].unique() dados['dose'].unique()...
github_jupyter
# Part 2 - Lists We learned about **variables** in Part 1. Sometimes it makes sense to group lots of items of information together in a **list**. This is a good idea when the items are all connected in some way. For example, we might want to store the names of our friends. We could create several variables and assign...
github_jupyter
<a href="https://colab.research.google.com/github/osipov/edu/blob/master/pyt0/Demo_Data_Visualization.ipynb" target="_blank"><img src="https://colab.research.google.com/assets/colab-badge.svg"/></a> # Data Visualization ``` %matplotlib inline import torch as pt import matplotlib.pyplot as plt x = pt.linspace(0, 10, ...
github_jupyter
# Classification ## MNIST ``` from sklearn.datasets import fetch_openml mnist = fetch_openml('mnist_784', version=1) mnist.keys() X, y = mnist['data'], mnist['target'] X.shape, y.shape %matplotlib inline import matplotlib as mpl import matplotlib.pyplot as plt some_digit = X[0] some_digit_img = some_digit.reshape(2...
github_jupyter
<center> <img src="https://gitlab.com/ibm/skills-network/courses/placeholder101/-/raw/master/labs/module%201/images/IDSNlogo.png" width="300" alt="cognitiveclass.ai logo" /> </center> # **Hands-on Lab : Web Scraping** Estimated time needed: **30 to 45** minutes ## Objectives In this lab you will perform the fo...
github_jupyter
Datashader provides a flexible series of processing stages that map from raw data into viewable images. As shown in the [Introduction](1-Introduction.ipynb), using datashader can be as simple as calling ``datashade()``, but understanding each of these stages will help you get the most out of the library. The stages ...
github_jupyter
Lambda School Data Science, Unit 2: Predictive Modeling # Applied Modeling, Module 1 You will use your portfolio project dataset for all assignments this sprint. ## Assignment Complete these tasks for your project, and document your decisions. - [ ] Choose your target. Which column in your tabular dataset will you...
github_jupyter
___ <a href='http://www.pieriandata.com'> <img src='../Pierian_Data_Logo.png' /></a> ___ # Matplotlib Exercises Welcome to the exercises for reviewing matplotlib! Take your time with these, Matplotlib can be tricky to understand at first. These are relatively simple plots, but they can be hard if this is your first ...
github_jupyter
``` # Turn on Auto-Complete %config IPCompleter.greedy=True # Start logging process at root level import logging logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO) logging.root.setLevel(level=logging.INFO) # Load model and dictionary #model_id_current = 99999 #model_path_current...
github_jupyter
``` import pandas as pd import psycopg2 import sqlalchemy import config import json import numpy as np import scrape scrape.scrape_bls() from sqlalchemy import create_engine from config import password Engine = create_engine(f"postgresql://postgres:{password}@localhost:5432/Employee_Turnover") Connection = Engine.conne...
github_jupyter
# Implementing the Gradient Descent Algorithm In this lab, we'll implement the basic functions of the Gradient Descent algorithm to find the boundary in a small dataset. First, we'll start with some functions that will help us plot and visualize the data. ``` import matplotlib.pyplot as plt import numpy as np import ...
github_jupyter
``` import json import numpy as np import matplotlib.pyplot as plt from scipy.integrate import quad from scipy.special import comb from tabulate import tabulate %matplotlib inline ``` ## Expected numbers on Table 3. ``` rows = [] datasets = { 'Binary': 2, 'AG news': 4, 'CIFAR10': 10, 'CIFAR100': 100...
github_jupyter
# PageRank Performance Benchmarking # Skip notebook test This notebook benchmarks performance of running PageRank within cuGraph against NetworkX. NetworkX contains several implementations of PageRank. This benchmark will compare cuGraph versus the defaukt Nx implementation as well as the SciPy version Notebook Cred...
github_jupyter
``` pip install contractions import pandas as pd import boto3, sys,sagemaker import pandas as pd import pandas as pd import numpy as np import nltk import string import contractions from nltk.tokenize import word_tokenize from nltk.tokenize import sent_tokenize from nltk.corpus import st...
github_jupyter
# Langmuir-enhanced entrainment This notebook reproduces Fig. 15 of [Li et al., 2019](https://doi.org/10.1029/2019MS001810). ``` import sys import numpy as np from scipy import stats import matplotlib.pyplot as plt from matplotlib...
github_jupyter
##Tirmzi Analysis n=1000 m+=1000 nm-=120 istep= 4 min=150 max=700 ``` import sys sys.path import matplotlib.pyplot as plt import numpy as np import os from scipy import signal ls import capsol.newanalyzecapsol as ac ac.get_gridparameters import glob folders = glob.glob("FortranOutputTest/*/") folders all_data= dict() ...
github_jupyter
``` %load_ext autoreload %autoreload 2 import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns r = np.random.randn((1000)) S0 = 1 S = np.cumsum(r) + S0 T = 2 mu = 0. sigma = 0.01 S0 = 20 dt = 0.01 N = round(T/dt) t = np.linspace(0, T, N) W = np.random.standard_normal(size = N) W = ...
github_jupyter
# Plotting with Matplotlib IPython works with the [Matplotlib](http://matplotlib.org/) plotting library, which integrates Matplotlib with IPython's display system and event loop handling. ## matplotlib mode To make plots using Matplotlib, you must first enable IPython's matplotlib mode. To do this, run the `%matplo...
github_jupyter
<a href="https://colab.research.google.com/github/mjvakili/MLcourse/blob/master/day2/nn_qso_finder.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> Let's start by importing the libraries that we need for this exercise. ``` import numpy as np import ...
github_jupyter
# Udacity PyTorch Scholarship Final Lab Challenge Guide **A hands-on guide to get 90% + accuracy and complete the challenge** **By [Soumya Ranjan Behera](https://www.linkedin.com/in/soumya044)** ## This Tutorial will be divided into Two Parts, ### [1. Model Building and Training](https://www.kaggle.com/soumya044/...
github_jupyter
``` import numpy as np from scipy import pi import matplotlib.pyplot as plt import pickle as cPickle #Sine wave N = 128 def get_sine_wave(): x_sin = np.array([0.0 for i in range(N)]) # print(x_sin) for i in range(N): # print("h") x_sin[i] = np.sin(2.0*pi*i/16.0) plt.plot(x_sin) pl...
github_jupyter
# Exercise: Find correspondences between old and modern english The purpose of this execise is to use two vecsigrafos, one built on UMBC and Wordnet and another one produced by directly running Swivel against a corpus of Shakespeare's complete works, to try to find corelations between old and modern English, e.g. "tho...
github_jupyter
<a href="https://colab.research.google.com/github/jeffheaton/t81_558_deep_learning/blob/master/t81_558_class_04_3_regression.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # T81-558: Applications of Deep Neural Networks **Module 4: Training for Tab...
github_jupyter
``` # flake8: noqa ########################################################## # Relative Imports ########################################################## import sys from os.path import isfile from os.path import join def find_pkg(name: str, depth: int): if depth <= 0: ret = None else: d = ["...
github_jupyter
# About this Notebook In this notebook, we provide the tensor factorization implementation using an iterative Alternating Least Square (ALS), which is a good starting point for understanding tensor factorization. ``` import numpy as np from numpy.linalg import inv as inv ``` # Part 1: Matrix Computation Concepts ##...
github_jupyter
Let's look at: Number of labels per image (histogram) Quality score per image for images with multiple labels (sigmoid?) ``` import csv from itertools import islice from collections import defaultdict import pandas as pd import matplotlib.pyplot as plt import torch import torchvision import numpy as np CSV_PATH = 'wga...
github_jupyter
# Naive Bayes Classifier Predicting positivty/negativity of movie reviews using Naive Bayes algorithm ## 1. Import Dataset Labels: * 0 : Negative review * 1 : Positive review ``` import pandas as pd import warnings warnings.filterwarnings('ignore') reviews = pd.read_csv('ratings_train.txt', delimiter='\t') reviews...
github_jupyter
# Auditing a dataframe In this notebook, we shall demonstrate how to use `privacypanda` to _audit_ the privacy of your data. `privacypanda` provides a simple function which prints the names of any columns which break privacy. Currently, these are: - Addresses - E.g. "10 Downing Street"; "221b Baker St"; "EC2R 8AH" ...
github_jupyter
``` import pandas as pd import numpy as np ``` ## read datafiles - C-18 for language population - C-13 for particular age-range population from a state ``` c18=pd.read_excel('datasets/C-18.xlsx',skiprows=6,header=None,engine='openpyxl') c13=pd.read_excel('datasets/C-13.xls',skiprows=7,header=None) ``` ### particular...
github_jupyter
``` # Neo4J graph example # author: Gressling, T # license: MIT License # code: github.com/gressling/examples # activity: single example # index: 25-2 # https://gist.github.com/korakot/328aaac51d78e589b4a176228e4bb06f # download 3.5.8 or neo4j-enterprise-4.0.0-alpha09mr02-unix !curl https://neo4j.com/artifact.php?name=...
github_jupyter
##### Copyright 2018 The TensorFlow Authors. Licensed under the Apache License, Version 2.0 (the "License"); ``` #@title Licensed under the Apache License, Version 2.0 (the "License"); { display-mode: "form" } # you may not use this file except in compliance with the License. # You may obtain a copy of the License at...
github_jupyter
# Communication in Crisis ## Acquire Data: [Los Angeles Parking Citations](https://www.kaggle.com/cityofLA/los-angeles-parking-citations)<br> Load the dataset and filter for: - Citations issued from 2017-01-01 to 2021-04-12. - Street Sweeping violations - `Violation Description` == __"NO PARK/STREET CLEAN"__ Let's ac...
github_jupyter
#### New to Plotly? Plotly's Python library is free and open source! [Get started](https://plot.ly/python/getting-started/) by downloading the client and [reading the primer](https://plot.ly/python/getting-started/). <br>You can set up Plotly to work in [online](https://plot.ly/python/getting-started/#initialization-fo...
github_jupyter
<h1><center>Clustering Chicago Public Libraries by Top 10 Nearby Venues</center></h1> <h4><center>Author: Kunyu He</center></h4> <h5><center>University of Chicago CAPP'20<h5><center> ### Executive Summary In this notebook, I clustered 80 public libraries in the city of Chicago into 7 clusters, based on the categorie...
github_jupyter
``` from keras.models import load_model import pandas as pd import keras.backend as K from keras.callbacks import LearningRateScheduler from keras.callbacks import Callback import math import numpy as np def coeff_r2(y_true, y_pred): from keras import backend as K SS_res = K.sum(K.square( y_true-y_pred )) ...
github_jupyter
``` import pandas as pd from sklearn.decomposition import IncrementalPCA, PCA from lung_cancer.connection_settings import get_connection_string, TABLE_LABELS, TABLE_FEATURES, TABLE_PCA_FEATURES, IMAGES_FOLDER from lung_cancer.connection_settings import TABLE_PATIENTS, TABLE_TRAIN_ID, MICROSOFTML_MODEL_NAME, TABLE_PRED...
github_jupyter
``` import numpy as np import pandas as pd import sklearn import spacy import re from nltk.corpus import gutenberg import nltk import warnings warnings.filterwarnings("ignore") nltk.download('gutenberg') !python -m spacy download en ``` ## 1. Converting words or sentences into numeric vectors is fundamental when work...
github_jupyter
# Training Collaborative Experts on MSR-VTT This notebook shows how to download code that trains a Collaborative Experts model with GPT-1 + NetVLAD on the MSR-VTT Dataset. ## Setup * Download Code and Dependencies * Import Modules * Download Language Model Weights * Download Datasets * Generate Encodings fo...
github_jupyter
# k-Nearest Neighbor (kNN) exercise *Complete and hand in this completed worksheet (including its outputs and any supporting code outside of the worksheet) with your assignment submission. For more details see the [assignments page](http://vision.stanford.edu/teaching/cs231n/assignments.html) on the course website.* ...
github_jupyter
``` # default_exp callback.core #export from fastai2.data.all import * from fastai2.optimizer import * from nbdev.showdoc import * #export _all_ = ['CancelFitException', 'CancelEpochException', 'CancelTrainException', 'CancelValidException', 'CancelBatchException'] ``` # Callback > Basic callbacks for Learner ## Cal...
github_jupyter
``` # Update sklearn to prevent version mismatches #!pip install sklearn --upgrade # install joblib. This will be used to save your model. # Restart your kernel after installing #!pip install joblib import pandas as pd ``` # Read the CSV and Perform Basic Data Cleaning ``` df = pd.read_csv("resources/exoplanet_data...
github_jupyter
# Negative Binomial Regression (Students absence example) ## Negative binomial distribution review I always experience some kind of confusion when looking at the negative binomial distribution after a while of not working with it. There are so many different definitions that I usually need to read everything more tha...
github_jupyter
# Self-Driving Car Engineer Nanodegree ## Project: **Finding Lane Lines on the Road** *** In this project, you will use the tools you learned about in the lesson to identify lane lines on the road. You can develop your pipeline on a series of individual images, and later apply the result to a video stream (really j...
github_jupyter
# In-Class Coding Lab: Data Analysis with Pandas In this lab, we will perform a data analysis on the **RMS Titanic** passenger list. The RMS Titanic is one of the most famous ocean liners in history. On April 15, 1912 it sank after colliding with an iceberg in the North Atlantic Ocean. To learn more, read here: https:...
github_jupyter
``` import numpy as np from scipy.spatial import Delaunay import networkx as nx import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import pandas import os import graphsonchip.graphmaker from graphsonchip.graphmaker import make_spheroids from graphsonchip.graphmaker import graph_generation_func fro...
github_jupyter
# Model Explainer Example ![architecture](architecture.png) In this example we will: * [Describe the project structure](#Project-Structure) * [Train some models](#Train-Models) * [Create Tempo artifacts](#Create-Tempo-Artifacts) * [Run unit tests](#Unit-Tests) * [Save python environment for our classifier]...
github_jupyter
##### Copyright 2018 The TensorFlow Authors. Licensed under the Apache License, Version 2.0 (the "License"). # Neural Machine Translation with Attention <table class="tfo-notebook-buttons" align="left"> <td> <a target="_blank" href="https://colab.research.google.com/github/tensorflow/docs/blob/master/site/e...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt %matplotlib inline # This code creates a virtual display to draw game images on. # If you are running locally, just ignore it import os if type(os.environ.get("DISPLAY")) is not str or len(os.environ.get("DISPLAY"))==0: !bash ../xvfb start %env DISPLAY=:1...
github_jupyter
<table> <tr align=left><td><img align=left src="https://i.creativecommons.org/l/by/4.0/88x31.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> ``` %matplotlib inline import numpy import matplotl...
github_jupyter
# Many to Many Classification Simple example for Many to Many Classification (Simple pos tagger) by Recurrent Neural Networks - Creating the **data pipeline** with `tf.data` - Preprocessing word sequences (variable input sequence length) using `padding technique` by `user function (pad_seq)` - Using `tf.nn.embedding_l...
github_jupyter
# Android的人脸识别库(NDK) ## 创建工程向导 ![](images/create_android_ndk_project_guide1.png) ![](images/create_android_ndk_project_guide2.png) ![](images/create_android_ndk_project_guide3.png) ## dlib库源代码添加到工程 * 把dlib目录下的dlib文件夹拷贝到app/src/main/ ## 增加JNI接口 ### 创建Java接口类 在app/src/main/java/com/wangjunjian/facerecognition下创建类Fa...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt from matplotlib import style style.use("ggplot") from sklearn import svm import pandas as pd import os import scipy as sc # get the annotated data to build the classifier direc = r'C:\Users\Daniellab\Desktop\Light_level_videos_second_batch\Data\Step3\Annotation' fi...
github_jupyter
#$EXERCISE_PREAMBLE$ As always, run the setup code below before working on the questions (and if you leave this notebook and come back later, remember to run the setup code again). ``` from learntools.core import binder; binder.bind(globals()) from learntools.python.ex5 import * print('Setup complete.') ``` # Exerci...
github_jupyter
# Your first neural network In this project, you'll build your first neural network and use it to predict daily bike rental ridership. We've provided some of the code, but left the implementation of the neural network up to you (for the most part). After you've submitted this project, feel free to explore the data and...
github_jupyter
<a href="https://colab.research.google.com/github/rlberry-py/rlberry/blob/main/notebooks/introduction_to_rlberry.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Introduction to ![picture](https://raw.githubusercontent.com/rlberry-py/rlberry/main/a...
github_jupyter
# Setup ### Imports ``` import sys sys.path.append('../') del sys %reload_ext autoreload %autoreload 2 from toolbox.parsers import standard_parser, add_task_arguments, add_model_arguments from toolbox.utils import load_task, get_pretrained_model, to_class_name import modeling.models as models ``` ### Notebook funct...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline import warnings warnings.filterwarnings("ignore") df = pd.read_csv("Data.csv") df.head(5) df['sentiment'] = np.where(df['sentiment'] == "positive", 1, 0) df.head() df['sentiment'].value_counts().s...
github_jupyter
``` print('Hello World') import numpy print(numpy.pi) import numpy as np print(np.pi) import numpy as np import numpy as np import matplotlib.pyplot as plt %pinfo print %matplotlib inline plt.style.use('../../solving_pde_mooc/notebooks/styles/mainstyle.use') #create an empty python list that will create values of delta...
github_jupyter
# Implementing TF-IDF ------------------------------------ Here we implement TF-IDF, (Text Frequency - Inverse Document Frequency) for the spam-ham text data. We will use a hybrid approach of encoding the texts with sci-kit learn's TFIDF vectorizer. Then we will use the regular TensorFlow logistic algorithm outline....
github_jupyter
# Table of Contents <p><div class="lev1 toc-item"><a href="#Texte-d'oral-de-modélisation---Agrégation-Option-Informatique" data-toc-modified-id="Texte-d'oral-de-modélisation---Agrégation-Option-Informatique-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>Texte d'oral de modélisation - Agrégation Option Informatique<...
github_jupyter