code
stringlengths
2.5k
150k
kind
stringclasses
1 value
``` # Import conventions we'll be using here. See Part 1 import matplotlib # matplotlib.use('nbagg') import matplotlib.pyplot as plt import numpy as np ``` # Limits, Legends, and Layouts In this section, we'll focus on what happens around the edges of the axes: Ticks, ticklabels, limits, layouts, and legends. # Lim...
github_jupyter
<a href="https://colab.research.google.com/github/piyushjain220/TSAI/blob/main/NLP/Resources/EVA_P2S3.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> #Imports ``` import numpy as np %matplotlib inline import numpy as np import matplotlib.pyplot as ...
github_jupyter
## QE methods and QE_utils In this tutorial, we will explore various methods needed to handle Quantum Espresso (QE) calculations - to run them, prepare input, and extract output. All that will be done with the help of the **QE_methods** and **QE_utils** modules, which contains the following functions: **QE_methods** ...
github_jupyter
___ <img style="float: right; margin: 0px 0px 15px 15px;" src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/4a/Python3-powered_hello-world.svg/1000px-Python3-powered_hello-world.svg.png" width="300px" height="100px" /> # <font color= #8A0829> Simulación matemática.</font> #### <font color= #2E9AFE> `Miérco...
github_jupyter
``` import matplotlib.pyplot as plt import BondGraphTools from BondGraphTools.config import config from BondGraphTools.reaction_builder import Reaction_Network julia = config.julia ``` # `BondGraphTools` ## Modelling Network Bioenergetics. https://github.com/peter-cudmore/seminars/ANZIAM-2019 &nbsp; Dr. Peter ...
github_jupyter
# Naive-Bayes Classifier ``` #Baseline SVM with PCA classifier import sklearn import numpy as np import sklearn.datasets as skd import ast from sklearn.feature_extraction import DictVectorizer from sklearn import linear_model from sklearn import naive_bayes from sklearn.metrics import precision_recall_fscore_support f...
github_jupyter
# A Whale off the Port(folio) --- In this assignment, you'll get to use what you've learned this week to evaluate the performance among various algorithmic, hedge, and mutual fund portfolios and compare them against the S&P 500 Index. ``` # Initial imports import pandas as pd import numpy as np import datetime as...
github_jupyter
# Basics of probability We'll start by reviewing some basics of probability theory. I will use some simple examples - dice and roullete - to illustrate basic probability concepts. We'll also use these simple examples to build intuition on several properties of probabilities - the law of total probability, independence...
github_jupyter
``` # A simple example of an animated plot import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation fig, ax = plt.subplots() # Initial plot x = np.arange(0., 10., 0.2) y = np.arange(0., 10., 0.2) line, = ax.plot(x, y) plt.rcParams["figure.figsize"] = (10,8) plt.ylabel("Price") plt....
github_jupyter
##### Copyright 2020 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
# Logistic Regression with a Neural Network mindset Welcome to your first (required) programming assignment! You will build a logistic regression classifier to recognize cats. This assignment will step you through how to do this with a Neural Network mindset, and so will also hone your intuitions about deep learning....
github_jupyter
``` import numpy as np import pandas as pd import tensorflow as tf import os import warnings warnings.filterwarnings('ignore') from tensorflow import keras from sklearn.preprocessing import RobustScaler, MinMaxScaler, StandardScaler from sklearn.model_selection import train_test_split from sklearn.ensemble import Ran...
github_jupyter
# ACA-Py & ACC-Py Basic Template ## Copy this template into the root folder of your notebook workspace to get started ### Imports ``` from aries_cloudcontroller import AriesAgentController import os from termcolor import colored ``` ### Initialise the Agent Controller ``` api_key = os.getenv("ACAPY_ADMIN_API_KEY")...
github_jupyter
<a href="https://colab.research.google.com/github/100rab-S/Tensorflow-Developer-Certificate/blob/main/S%2BP_Week_4_Lesson_1.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` #@title Licensed under the Apache License, Version 2.0 (the "License"); #...
github_jupyter
Program: 08_kmeans_test.R Date: September, 2019 Programmer: Hillary Mulder Purpose: Show K means doesnt work well with harmonized trials data ``` library(cluster) library(caret) library(purrr) library(dplyr) library(boot) #library(table1) library(Hmisc) data=read.csv("Data/analysis_ds.csv") data$allhat=ifelse(d...
github_jupyter
# 作业3:设计并训练KNN算法对图片进行分类。 ## example1: ``` import tensorflow as tf import numpy as np from tensorflow.examples.tutorials.mnist import input_data k=7 test_num=int(input('请输入需要测试的数据数量:')) #加载TFRecord训练集的数据 reader = tf.TFRecordReader() filename_queue = tf.train.string_input_producer(["/home/srhyme/ML project/DS/train.t...
github_jupyter
# Continuous Delivery Explained > "An introduction to the devops practice of CI/CD." - toc: false - branch: master - badges: true - comments: true - categories: [devops, continuous-delivery] - image: images/copied_from_nb/img/devops/feedback-cycle.png ![DevOps Feedback Cycle](img/devops/feedback-cycle.png) > *I wrote...
github_jupyter
<center> <img src="https://cf-courses-data.s3.us.cloud-object-storage.appdomain.cloud/IBMDeveloperSkillsNetwork-PY0101EN-SkillsNetwork/IDSNlogo.png" width="300" alt="cognitiveclass.ai logo" /> </center> # String Operations Estimated time needed: **15** minutes ## Objectives After completing this lab you will b...
github_jupyter
**[Pandas Home Page](https://www.kaggle.com/learn/pandas)** --- # Introduction In this set of exercises we will work with the [Wine Reviews dataset](https://www.kaggle.com/zynicide/wine-reviews). Run the following cell to load your data and some utility functions (including code to check your answers). ``` import ...
github_jupyter
# Content-based recommender using Deep Structured Semantic Model An example of how to build a Deep Structured Semantic Model (DSSM) for incorporating complex content-based features into a recommender system. See [Learning Deep Structured Semantic Models for Web Search using Clickthrough Data](https://www.microsoft.co...
github_jupyter
# Plots for logistic regression, consistent vs inconsistent noiseless AT, increasing epsilon ``` import numpy as np import matplotlib.pyplot as plt import matplotlib.patches import dotenv import pandas as pd import mlflow import plotly import plotly.graph_objects as go import plotly.express as px import plotly.subplot...
github_jupyter
# RNN - LSTM - Toxic Comments A corpus of manually labeled comments - classifying each comment by its type of toxicity is available on Kaggle. We will aim to do a binary classification of whether a comment is toxic or not. Approach: - Learning Embedding with the Task - LSTM - BiLSTM ``` import numpy as np import pan...
github_jupyter
## Mask Adaptivity Detection Using YOLO Mask became an essential accessory post COVID-19. Most of the countries are making face masks mandatory to avail services like transport, fuel and any sort of outside activity. It is become utmost necessary to keep track of the adaptivity of the crowd. This notebook contains imp...
github_jupyter
## Precision-Recall Curves in Multiclass For multiclass classification, we have 2 options: - determine a PR curve for each class. - determine the overall PR curve as the micro-average of all classes Let's see how to do both. ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.da...
github_jupyter
``` """Flow around a hole in a porous medium.""" from fenics import * import numpy as np def make_mesh(Theta, a, b, nr, nt, s): mesh = RectangleMesh(Point(a, 0), Point(b, 1), nr, nt, 'crossed') # Define markers for Dirichket boundaries tol = 1E-14 # x=a becomes the inner bore...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns from sklearn import preprocessing from sklearn.model_selection import StratifiedShuffleSplit, cross_val_score, cross_val_predict, GridSearchCV from sklearn.decomposition import PCA from sklearn.linear_model import LogisticR...
github_jupyter
#### Copyright 2017 Google LLC. ``` # 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 agreed to in writin...
github_jupyter
## A motivating example: harmonic oscillator ### created by Yuying Liu, 11/02/2019 ``` # imports import os import sys import torch import numpy as np import scipy as sp from scipy import integrate from tqdm.notebook import tqdm import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec from mpl_toolkits.m...
github_jupyter
<a href="https://colab.research.google.com/github/gmshashank/Deep_Flow_Prediction/blob/main/supervised_airfoils_normalized.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Supervised training for RANS flows around airfoils ## Overview For this e...
github_jupyter
Decoding with ANOVA + SVM: face vs house in the Haxby dataset =============================================================== This example does a simple but efficient decoding on the Haxby dataset: using a feature selection, followed by an SVM. ``` import warnings warnings.filterwarnings('ignore') import matplotlib...
github_jupyter
# Python Flair Basics **(C) 2018-2020 by [Damir Cavar](http://damir.cavar.me/)** **Version:** 0.3, February 2020 **Download:** This and various other Jupyter notebooks are available from my [GitHub repo](https://github.com/dcavar/python-tutorial-for-ipython). **License:** [Creative Commons Attribution-ShareAlike 4....
github_jupyter
``` import datetime import lightgbm as lgb import numpy as np import os import pandas as pd import random from tqdm import tqdm from sklearn.model_selection import train_test_split import haversine import catboost as cb random_seed = 174 random.seed(random_seed) np.random.seed(random_seed) # Load data train = pd.read_...
github_jupyter
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. ![Impressions](https://PixelServer20190423114238.azurewebsites.net/api/impressions/MachineLearningNotebooks/how-to-use-azureml/automated-machine-learning/remote-execution-with-datastore/auto-ml-remote-execution-with-datastore.pn...
github_jupyter
# Assignment 3: Question Answering Welcome to this week's assignment of course 4. In this you will explore question answering. You will implement the "Text to Text Transfer from Transformers" (better known as T5). Since you implemented transformers from scratch last week you will now be able to use them. <img src = ...
github_jupyter
``` #default_exp dataset_torch ``` # dataset_torch > Module to load the slates dataset into a Pytorch Dataset and Dataloaders with default train/valid test splits. ``` #export import torch import recsys_slates_dataset.data_helper as data_helper from torch.utils.data import Dataset, DataLoader import torch import jso...
github_jupyter
# Collaborative filtering on the MovieLense Dataset ###### This notebook is based on part of Chapter 9 of [BigQuery: The Definitive Guide](https://www.oreilly.com/library/view/google-bigquery-the/9781492044451/ "http://shop.oreilly.com/product/0636920207399.do") by Lakshmanan and Tigani. ### MovieLens dataset To illus...
github_jupyter
``` import neuroglancer # Use this in IPython to allow external viewing # neuroglancer.set_server_bind_address(bind_address='192.168.158.128', # bind_port=80) from nuggt.utils import ngutils viewer = neuroglancer.Viewer() viewer import numpy as np import zarr import os # working_d...
github_jupyter
``` ## plot plasma density %pylab inline import numpy as np from matplotlib import pyplot as plt from ReadBinary import * fileSuffix = "-10" folder = "../data/LargePeriodicLattice-GaussianPlasma/fp=1THz/" #folder = "../data/2D/" filename = folder+"Wp2-x{}.data".format(fileSuffix) arrayInfo = GetArrayInfo(filename) ...
github_jupyter
``` import pandas as pd from pylab import rcParams import seaborn as sb import matplotlib.pyplot as plt import sklearn from sklearn.cluster import DBSCAN from collections import Counter import datetime from sklearn.preprocessing import LabelEncoder from collections import defaultdict from functools import reduce imp...
github_jupyter
# Quantum tomography for n-qubit Init state: general GHZ Target state: 1 layer Here is the case for n-qubit with $n>1$. The state that need to reconstruct is GHZ state: $ |G H Z\rangle=\frac{1}{\sqrt{2}}(|0 \ldots 0\rangle+|1 \ldots 1\rangle)=\frac{1}{\sqrt{2}}\left[\begin{array}{c} 1 \\ 0 \\ \ldots \\ 1 \end{array...
github_jupyter
``` import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import numpy as np import warnings warnings.filterwarnings('ignore') df1 = pd.read_csv('monday.csv', sep = ";") df2 = pd.read_csv('tuesday.csv', sep = ";") df3 = pd.read_csv('wednesday.csv', sep = ";") df4 = pd.read_csv('thursday.csv', sep = ...
github_jupyter
# Chapter 2 - Small Worlds vs Large Wolrds [Recorded Classes 2019 Chap2 by Richard McElreath](https://www.youtube.com/watch?v=XoVtOAN0htU&list=PLDcUM9US4XdNM4Edgs7weiyIguLSToZRI&index=2) The **Small World** represents the scientific model itself, and the **Large World** represents the broader context in which one dep...
github_jupyter
# Self-Driving Car Engineer Nanodegree ## Deep Learning ## Project: Build a Traffic Sign Recognition Classifier In this notebook, a template is provided for you to implement your functionality in stages, which is required to successfully complete this project. If additional code is required that cannot be included i...
github_jupyter
# Example 1: How to Generate Synthetic Data (MarginalSynthesizer) In this notebook we show you how to create a simple synthetic dataset. # Environment ## Library Imports ``` import numpy as np import pandas as pd from pathlib import Path import os import sys ``` ## Jupyter-specific Imports and Settings ``` # set p...
github_jupyter
# Mapping QTL in BXD mice using R/qtl2 [Karl Broman](https://kbroman.org) [<img style="display:inline-block;" src="https://orcid.org/sites/default/files/images/orcid_16x16(1).gif">](https://orcid.org/0000-0002-4914-6671), [Department of Biostatistics & Medical Informatics](https://www.biostat.wisc.edu), [University o...
github_jupyter
# Simplifying Codebases Param's just a Python library, and so anything you can do with Param you can do "manually". So, why use Param? The most immediate benefit to using Param is that it allows you to greatly simplify your codebases, making them much more clear, readable, and maintainable, while simultaneously provi...
github_jupyter
Deep Learning Models -- A collection of various deep learning architectures, models, and tips for TensorFlow and PyTorch in Jupyter Notebooks. - Author: Sebastian Raschka - GitHub Repository: https://github.com/rasbt/deeplearning-models ``` !pip install -q IPython !pip install -q ipykernel !pip install -q watermark !p...
github_jupyter
# Changing the input current when solving PyBaMM models This notebook shows you how to change the input current when solving PyBaMM models. It also explains how to load in current data from a file, and how to add a user-defined current function. For more examples of different drive cycles see [here](https://github.com...
github_jupyter
## Discretisation Discretisation is the process of transforming continuous variables into discrete variables by creating a set of contiguous intervals that span the range of the variable's values. Discretisation is also called **binning**, where bin is an alternative name for interval. ### Discretisation helps handl...
github_jupyter
This baseline has reached Top %11 with rank of #457/4540 Teams at Private Leader Board (missed Bronze with only 2 places) ``` import numpy as np import pandas as pd import sys import gc from scipy.signal import hilbert from scipy.signal import hann from scipy.signal import convolve pd.options.display.precision = 15...
github_jupyter
# Exercise 4 - Optimizing Model Training In [the previous exercise](./03%20-%20Compute%20Contexts.ipynb), you created cloud-based compute and used it when running a model training experiment. The benefit of cloud compute is that it offers a cost-effective way to scale out your experiment workflow and try different alg...
github_jupyter
# Numpy实现浅层神经网络 实践部分将搭建神经网络,包含一个隐藏层,实验将会展现出与Logistic回归的不同之处。 实验将使用两层神经网络实现对“花”型图案的分类,如图所示,图中的点包含红点(y=0)和蓝点(y=1)还有点的坐标信息,实验将通过以下步骤完成对两种点的分类,使用Numpy实现。 - 输入样本; - 搭建神经网络; - 初始化参数; - 训练,包括前向传播与后向传播(即BP算法); - 得出训练后的参数; - 根据训练所得参数,绘制两类点边界曲线。 <img src="image/data.png" style="width:400px;height:300px;"> 该实验将使用Python...
github_jupyter
# What's this TensorFlow business? You've written a lot of code in this assignment to provide a whole host of neural network functionality. Dropout, Batch Norm, and 2D convolutions are some of the workhorses of deep learning in computer vision. You've also worked hard to make your code efficient and vectorized. For t...
github_jupyter
# Trump Tweets at the Internet Archive So Trump's Twitter account is gone. At least at twitter.com. But (fortunately for history) there has probably never been a more heavily archived social media account at the Internet Archive and elsewhere on the web. There are also a plethora of online "archives" like [The Trump A...
github_jupyter
## Profiling sequential code I profiled the sequential code `count_spacers_with_ED.py` using the `cProfile` Python package. I ran `count_spacers_with_ED.py` with a control file of 100 sequences (*Genome-Pos-3T3-Unsorted_100_seqs.txt*) and an experimental file of 100 sequences (*Genome-Pos-3T3-Bot10_100_seqs.txt*). Eac...
github_jupyter
## Bayesian Optimization with Scikit-Optimize In this notebook, we will perform **Bayesian Optimization** with Gaussian Processes in Parallel, utilizing various CPUs, to speed up the search. This is useful to reduce search times. https://scikit-optimize.github.io/stable/auto_examples/parallel-optimization.html#exam...
github_jupyter
## Control Flow Generally, a program is executed sequentially and once executed it is not repeated again. There may be a situation when you need to execute a piece of code n number of times, or maybe even execute certain piece of code based on a particular condition.. this is where the control flow statements come in. ...
github_jupyter
# Smart Queue Monitoring System - Retail Scenario ## Overview Now that you have your Python script and job submission script, you're ready to request an **IEI Tank-870** edge node and run inference on the different hardware types (CPU, GPU, VPU, FPGA). After the inference is completed, the output video and stats file...
github_jupyter
## MatrixTable Tutorial If you've gotten this far, you're probably thinking: - "Can't I do all of this in `pandas` or `R`?" - "What does this have to do with biology?" The two crucial features that Hail adds are _scalability_ and the _domain-specific primitives_ needed to work easily with biological data. Fear not!...
github_jupyter
``` # 1. Loading Libraries # Importing NumPy and Panda import pandas as pd import numpy as np # ---------Import libraries & modules for data visualizaiton from pandas.plotting import scatter_matrix from matplotlib import pyplot # Importing scit-learn module to split the dataset into train/test sub-datasets from skle...
github_jupyter
# COCO Reader Reader operator that reads a COCO dataset (or subset of COCO), which consists of an annotation file and the images directory. `DALI_EXTRA_PATH` environment variable should point to the place where data from [DALI extra repository](https://github.com/NVIDIA/DALI_extra) is downloaded. Please make sure tha...
github_jupyter
``` import numpy as np np.random.seed(123) import os from keras.models import Model from keras.layers import Input, Convolution2D, MaxPooling2D, BatchNormalization from keras.layers import Flatten, Dense, Dropout, ZeroPadding2D, Reshape, UpSampling2D from keras.layers.local import LocallyConnected1D from keras.layers....
github_jupyter
![Callysto.ca Banner](https://github.com/callysto/curriculum-notebooks/blob/master/callysto-notebook-banner-top.jpg?raw=true) <a href="https://hub.callysto.ca/jupyter/hub/user-redirect/git-pull?repo=https%3A%2F%2Fgithub.com%2Fcallysto%2Fcurriculum-notebooks&branch=master&subPath=Mathematics/PatternsAndRelations/patter...
github_jupyter
# Python code til udregning af data fra ATP ``` #Imports ``` # Udregninger ## Alder for at kunne blive tilbudt tidlig pension ``` #Årgange født i 1955-1960 har adgang til at søge i 2021. #Man skal være fyldt 61 for at søge. print(2021-61, "kan anmode om tidlig pension") #Der indgår personer fra 6 1⁄2 årgange pr...
github_jupyter
# Speed comparison between PyPairs and the R verison - PyPairs Here we ran the sandbag part of the original Pairs method on the oscope dataset for a growing subset of genes. Taking note of the required execution time. Single cored time is taken. For the result please see: [2.3 Differences in code - Python](./2.3%20Dif...
github_jupyter
# Practice Notebook: Methods and Classes The code below defines an *Elevator* class. The elevator has a current floor, it also has a top and a bottom floor that are the minimum and maximum floors it can go to. Fill in the blanks to make the elevator go through the floors requested. ``` class Elevator: def __init_...
github_jupyter
# PTN Template This notebook serves as a template for single dataset PTN experiments It can be run on its own by setting STANDALONE to True (do a find for "STANDALONE" to see where) But it is intended to be executed as part of a *papermill.py script. See any of the experimentes with a papermill script to get sta...
github_jupyter
# Worksheet 0.1.2: Python syntax (`while` loops) <div class="alert alert-block alert-info"> This worksheet will invite you to tinker with the examples, as they are live code cells. Instead of the normal fill-in-the-blank style of notebook, feel free to mess with the code directly. Remember that -- to test things out -...
github_jupyter
# "# backtesting with grid search" > "Easily backtest a grid of parameters in a given trading strategy" - toc: true - branch: master - badges: true - comments: true - author: Jerome de Leon - categories: [grid search, backtest] <a href="https://colab.research.google.com/github/enzoampil/fastquant/blob/master/examples...
github_jupyter
## Preprocessing ``` # Import our dependencies from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler import pandas as pd import tensorflow as tf # Import and read the charity_data.csv. import pandas as pd application_df = pd.read_csv("Resources/charity_data.csv") appl...
github_jupyter
# Tabular Q-Learning From Scratch ### Custom Environment to train our model on ``` import gym from gym import spaces import numpy as np import random from copy import deepcopy class gridworld_custom(gym.Env): """Custom Environment that follows gym interface""" metadata = {'render.modes': ['human']} d...
github_jupyter
# Abstractive Summarization ### Loading Pre-processed Dataset The Data is preprocessed in [Data_Pre-Processing.ipynb](https://github.com/JRC1995/Abstractive-Summarization/blob/master/Data_Pre-Processing.ipynb) Dataset source: https://www.kaggle.com/snap/amazon-fine-food-reviews ``` import json with open('Processed...
github_jupyter
``` import pandas as pd import numpy as np import lightgbm as lgb from collections import OrderedDict from sklearn.metrics import roc_auc_score from tqdm import tqdm from copy import deepcopy from autowoe import ReportDeco, AutoWoE ``` ### Чтение и подготовка обучающей выборки ``` train = pd.read_csv("./example_dat...
github_jupyter
Discussion Analysis === Notebook for analysis of discussion done in Evidence and Reconsider tasks via the annotation web client. ``` import os import re import pandas as pd import numpy as np import sklearn import sklearn.metrics from collections import Counter import itertools import sqlite3 import sys sys.path.appe...
github_jupyter
_Lambda School Data Science, Unit 2_ # Regression 2 Sprint Challenge: Predict drugstore sales 🏥 For your Sprint Challenge, you'll use real-world sales data from a German drugstore chain, from Jan 2, 2013 — July 31, 2015. You are given three dataframes: - `train`: historical sales data for 100 stores - `test`: his...
github_jupyter
<a href="https://colab.research.google.com/github/olgOk/QCircuit/blob/master/tutorials/Deutsch_Algorithm.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Deutsch Algorithm by Olga Okrut Install frameworks, and import libraries ``` !pip install t...
github_jupyter
<h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#Stop-Reinventing-Pandas" data-toc-modified-id="Stop-Reinventing-Pandas-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>Stop Reinventing Pandas</a></span></li><li><span><a href="#First-Hacks!" data-toc-mod...
github_jupyter
# Interacting with ProtoDash In this notebook we'll combine the ProtoDash and the Partial Effects to obtain feature importances on the digits classifications task. ProtoDash was proposed in _Gurumoorthy, Karthik & Dhurandhar, Amit & Cecchi, Guillermo & Aggarwal, Charu. (2019). Efficient Data Representation by Selecti...
github_jupyter
<h2> 6. Bayes Classification </h2> This notebook has the code for the charts in Chapter 6 ### Install BigQuery module You don't need this on AI Platform, but you need this on plain-old JupyterLab ``` !pip install google-cloud-bigquery %load_ext google.cloud.bigquery ``` ### Setup ``` import os PROJECT = 'data-sci...
github_jupyter
``` import pandas as pd from datetime import timedelta, date import matplotlib.pyplot as plt def append_it(date, amount,treasury,Agency,MBS, duration): append_data = {'Date':[date], 'Amount':[amount], 'Duration':[duration],'Treasury':[treasury],'Agency':[Agency], 'MBS':[MBS]} append_df = pd.DataFrame(append_da...
github_jupyter
# Time series analysis (Pandas) Nikolay Koldunov koldunovn@gmail.com ================ Here I am going to show just some basic [pandas](http://pandas.pydata.org/) stuff for time series analysis, as I think for the Earth Scientists it's the most interesting topic. If you find this small tutorial useful, I encourage y...
github_jupyter
<i>Copyright (c) Microsoft Corporation.</i> <i>Licensed under the MIT License.</i> # LightGBM: A Highly Efficient Gradient Boosting Decision Tree This notebook gives an example of how to perform multiple rounds of training and testing of LightGBM models to generate point forecasts of product sales in retail. We will...
github_jupyter
# External Validation of SWAST Forecasting Model ## Overall results summary. This notebook generates the overall results summary for the MASE, and prediction intervals for LAS, YAS and WAST. ``` print('******************Summary of External validation results*****************\n\n') import numpy as np import pandas as ...
github_jupyter
# Bayesian Regression - Inference Algorithms (Part 2) In [Part I](bayesian_regression.ipynb), we looked at how to perform inference on a simple Bayesian linear regression model using SVI. In this tutorial, we'll explore more expressive guides as well as exact inference techniques. We'll use the same dataset as befor...
github_jupyter
## 1. Google Play Store apps and reviews <p>Mobile apps are everywhere. They are easy to create and can be lucrative. Because of these two factors, more and more apps are being developed. In this notebook, we will do a comprehensive analysis of the Android app market by comparing over ten thousand apps in Google Play a...
github_jupyter
<a href="https://colab.research.google.com/github/ksetdekov/HSE_DS/blob/master/07%20NLP/kaggle%20hw/solution.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` # !pip3 install kaggle from google.colab import files files.upload() !mkdir ~/.kaggle !c...
github_jupyter
# Satellite sea surface temperatures along the West Coast of the United States # during the 2014–2016 northeast Pacific marine heat wave In 2016 we published a [paper](https://agupubs.onlinelibrary.wiley.com/doi/10.1002/2016GL071039) on the heat wave in the ocean off the California coast This analysis was the last t...
github_jupyter
# Minimal end-to-end causal analysis with ```cause2e``` This notebook shows a minimal example of how ```cause2e``` can be used as a standalone package for end-to-end causal analysis. It illustrates how we can proceed in stringing together many causal techniques that have previously required fitting together various alg...
github_jupyter
The data and the description: https://archive.ics.uci.edu/ml/datasets/APS+Failure+at+Scania+Trucks Abstract: The datasets' positive class consists of component failures for a specific component of the APS system. The negative class consists of trucks with failures for components not related to the APS. ``` import num...
github_jupyter
## stripplot() and swarmplot() Many datasets have categorical data and Seaborn supports several useful plot types for this data. In this example, we will continue to look at the 2010 School Improvement data and segment the data by the types of school improvement models used. As a refresher, here is the KDE distributi...
github_jupyter
<a href="https://colab.research.google.com/github/elcoreano/DS-Unit-1-Sprint-1-Dealing-With-Data/blob/master/module1-afirstlookatdata/LS_DSPT3_111_A_First_Look_at_Data.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Lambda School Data Science - A ...
github_jupyter
# Training Keyword Spotting This notebook builds on the Colab in which we used the pre-trained [micro_speech](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/micro/examples/micro_speech) example as well as the HarvardX [3_5_18_TrainingKeywordSpotting.ipynb](https://github.com/tinyMLx/colabs) and [4...
github_jupyter
``` !pip install scikit-optimize ``` Based on this: * https://scikit-optimize.github.io/stable/auto_examples/bayesian-optimization.html#sphx-glr-auto-examples-bayesian-optimization-py ``` import numpy as np np.random.seed(1234) import matplotlib.pyplot as plt from skopt.plots import plot_gaussian_process from skop...
github_jupyter
``` import pandas as pd import numpy as np import seaborn as sns %matplotlib inline cc = pd.read_csv('./posts_ccompare_raw.csv', index_col=0, encoding='utf-8') cc['Timestamp'] = pd.to_datetime(cc['Timestamp']) ``` # Reaction features ``` features_reactions = pd.DataFrame(index=cc.index) features_reactions['n_up'] = c...
github_jupyter
``` import os import json import pandas as pd from tqdm import tqdm_notebook df_larval = pd.read_csv(os.path.join('..', 'data', 'breeding-sites', 'larval-survey-en.csv')) df_larval.head() ``` ## Shapefile ``` with open(os.path.join('..', 'data','shapefiles','Nakhon-Si-Thammarat.geojson')) as f: data = json.load(...
github_jupyter
``` # Les imports pour l'exercice import pandas as pd import numpy as np import matplotlib.pyplot as plt import string import random from collections import deque ``` ## Partie 1 : Code de César ### Implementation Le code suivant contient deux fonctions principales : `encryptMessage` et `decryptMessage`. Ces fonct...
github_jupyter
``` # Run in python console import nltk; nltk.download('stopwords') ``` Import Packages ``` import re import numpy as np import pandas as pd from pprint import pprint # Gensim import gensim import gensim.corpora as corpora from gensim.utils import simple_preprocess from gensim.models import CoherenceModel # spacy ...
github_jupyter
# Evaluate AminoAcids Prediction ``` %matplotlib inline import pylab pylab.rcParams['figure.figsize'] = (15.0, 12.0) import os import sys import numpy as np from shutil import copyfile from src.python.aa_predict import * import src.python.aa_predict as AA checkpoint_path = "../../data/trained/aapred_cnn_lates...
github_jupyter
``` import os import numpy as np import torch torch.manual_seed(29) from torch import nn import torch.backends.cudnn as cudnn import torch.nn.parallel cudnn.benchmark = True import torch.nn.functional as F from PIL import Image, ImageFile ImageFile.LOAD_TRUNCATED_IMAGES = True from glob import glob from PIL.PngImage...
github_jupyter
# Create a Learner for inference ``` from fastai import * from fastai.gen_doc.nbdoc import * ``` In this tutorial, we'll see how the same API allows you to create an empty [`DataBunch`](/basic_data.html#DataBunch) for a [`Learner`](/basic_train.html#Learner) at inference time (once you have trained your model) and ho...
github_jupyter