text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
<img src="../../images/banners/python-basics.png" width="600"/> # <img src="../../images/logos/python.png" width="23"/> Python Program Lexical Structure You have now covered Python variables, operators, and data types in depth, and you’ve seen quite a bit of example code. Up to now, the code has consisted of short i...
github_jupyter
# Load Data From Snowflake ![Snowflake Logo](https://saturn-public-assets.s3.us-east-2.amazonaws.com/example-resources/snowflake.png "doc-image") ## Overview <a href="https://www.snowflake.com/" target='_blank' rel='noopener'>Snowflake</a> is a data platform built for the cloud that allows for fast SQL queries. This ...
github_jupyter
<a href="https://colab.research.google.com/github/PyTorchLightning/lightning-flash/blob/master/flash_notebooks/image_classification.ipynb" target="_parent"> <img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/> </a> In this notebook, we'll go over the basics of lightning Flash b...
github_jupyter
# Symbolic Regression This example combines neural differential equations with regularised evolution to discover the equations $\frac{\mathrm{d} x}{\mathrm{d} t}(t) = \frac{y(t)}{1 + y(t)}$ $\frac{\mathrm{d} y}{\mathrm{d} t}(t) = \frac{-x(t)}{1 + x(t)}$ directly from data. **References:** This example appears as ...
github_jupyter
``` # %cd /Users/Kunal/Projects/TCH_CardiacSignals_F20/ from numpy.random import seed seed(1) import numpy as np import os import matplotlib.pyplot as plt import tensorflow tensorflow.random.set_seed(2) from tensorflow import keras from tensorflow.keras.callbacks import EarlyStopping from tensorflow.keras.regularizers ...
github_jupyter
# Web Data Extraction (1) by Dr Liang Jin - Step 1: access crawler.idx files from SEC EDGAR - Step 2: re-write crawler data to csv files - Step 3: retrieve 10K filing information including URLs - Step 4: read text from html ## Step 0: Setup... ``` # import packages as usual import os, requests, csv, webbrowser from ...
github_jupyter
``` %load_ext autoreload %autoreload 2 import numpy as np import matplotlib.pyplot as plt from astropy import units as u from astroduet.bbmag import bb_abmag_fluence from astroduet.image_utils import construct_image, find from astroduet.config import Telescope from astroduet.background import background_pixel_rate fr...
github_jupyter
``` # Copyright 2020 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 writi...
github_jupyter
<a href="https://colab.research.google.com/github/txusser/Master_IA_Sanidad/blob/main/Modulo_2/2_3_3_Extraccion_de_caracteristicas.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Extracción de características ## Análisis de la componente principa...
github_jupyter
# Multi-linear regression: how many variables? [![Latest release](https://badgen.net/github/release/Naereen/Strapdown.js)](https://github.com/eabarnes1010/course_objective_analysis/tree/main/code) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/eabar...
github_jupyter
## Keras implementation of https://phillipi.github.io/pix2pix ``` import os os.environ['KERAS_BACKEND']='theano' # can choose theano, tensorflow, cntk os.environ['THEANO_FLAGS']='floatX=float32,device=cuda,optimizer=fast_run,dnn.library_path=/usr/lib' #os.environ['THEANO_FLAGS']='floatX=float32,device=cuda,optimizer=f...
github_jupyter
``` import gc import matplotlib.pyplot as plt import numpy as np import os import pandas as pd import torch import torch.nn as nn import torchvision # To view tensorboard metrics # tensorboard --logdir=logs --port=6006 --bind_all from torch.utils.tensorboard import SummaryWriter from functools import partial from evol...
github_jupyter
# Exploring Data with Python A significant part of a a data scientist's role is to explore, analyze, and visualize data. There's a wide range of tools and programming languages that they can use to do this; and of of the most popular approaches is to use Jupyter notebooks (like this one) and Python. Python is a flexi...
github_jupyter
<a href="https://colab.research.google.com/github/mohd-faizy/CAREER-TRACK-Data-Scientist-with-Python/blob/main/Police_Activity_data_for_analysis.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> --- <strong> <h1 align='center'>Preparing the Po...
github_jupyter
# Workshop: Deep Learning 3 Outline 1. Regularization 2. Hand-Written Digits with Convolutional Neural Networks 3. Advanced Image Classification with Convolutional Neural Networks Source: Deep Learning With Python, Part 1 - Chapter 4 ## 1. Regularization To prevent a model from learning misleading or irrelevant ...
github_jupyter
# ORF MLP Trying to fix bugs. NEURONS=128 and K={1,2,3}. ``` import time def show_time(): t = time.time() print(time.strftime('%Y-%m-%d %H:%M:%S %Z', time.localtime(t))) show_time() PC_TRAINS=8000 NC_TRAINS=8000 PC_TESTS=8000 NC_TESTS=8000 RNA_LEN=1000 MAX_K = 3 INPUT_SHAPE=(None,84) # 4^3 + 4^2 + 4...
github_jupyter
``` import google.datalab.bigquery as bq import numpy as np from sklearn.metrics import mean_squared_error, mean_absolute_error import pandas as pd import matplotlib.pyplot as plt import tensorflow as tf #training price data training = bq.Query(''' Select date_utc,price from Energy.MarketPT where date_utc between '2015...
github_jupyter
# Inter-annotator agreement between the first 10 annotators of WS-353 Measured in Kappa and Rho: - against the gold standard which is the mean of all annotators, as described in Hill et al 2014 (footnote 6) - against each other Using Kohen's kappa, which is binary, so I average across pairs of annotators. ``` %cd...
github_jupyter
# Using AI planning to explore data science pipelines ``` from __future__ import print_function import sys import os import types sys.path.append(os.path.abspath(os.path.join(os.getcwd(), "../grammar2lale"))) # Clean output directory where we store planning and result files os.system('rm -rf ../output') os.system('m...
github_jupyter
This Jupyter notebook details theoretically the architecture and the mechanism of the Convolutional Neural Network (ConvNet) step by step. Then, we implement the CNN code for multi-class classification task using pytorch. <br> The notebook was implemented by <i>Nada Chaari</i>, PhD student at Istanbul Technical Univer...
github_jupyter
# Read in catalog information from a text file and plot some parameters ## Authors Adrian Price-Whelan, Kelle Cruz, Stephanie T. Douglas ## Learning Goals * Read an ASCII file using `astropy.io` * Convert between representations of coordinate components using `astropy.coordinates` (hours to degrees) * Make a spherica...
github_jupyter
``` import os import cv2 import numpy as np #import layers import matplotlib.pyplot as plt # credits to https://towardsdatascience.com/lines-detection-with-hough-transform-84020b3b1549 import matplotlib.lines as mlines # ist a,b == m, c def line_detection_non_vectorized(image, edge_image, num_rhos=100, num_thetas=10...
github_jupyter
# Activity 02 ``` import pandas as pd import numpy as np from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler from keras.models import Sequential from keras.layers import Dense from tensorflow import random import matplotlib.pyplot as plt import matplotlib %matplotlib ...
github_jupyter
# Autoregressions This notebook introduces autoregression modeling using the `AutoReg` model. It also covers aspects of `ar_select_order` assists in selecting models that minimize an information criteria such as the AIC. An autoregressive model has dynamics given by $$ y_t = \delta + \phi_1 y_{t-1} + \ldots + \phi_...
github_jupyter
``` import os import pandas as pd import math import nltk import numpy as np import matplotlib import matplotlib.pyplot as plt %matplotlib inline import re from nltk.tokenize import WordPunctTokenizer import pickle def load_csv_as_df(file_name, sub_directories, col_name=None): ''' Load any csv as a pandas dat...
github_jupyter
# Example: CanvasXpress bubble Chart No. 4 This example page demonstrates how to, using the Python package, create a chart that matches the CanvasXpress online example located at: https://www.canvasxpress.org/examples/bubble-4.html This example is generated using the reproducible JSON obtained from the above page an...
github_jupyter
## Imports ``` import os import sys %env CUDA_VISIBLE_DEVICES=0 %matplotlib inline import pickle import numpy as np import matplotlib import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec from matplotlib.ticker import FormatStrFormatter import tensorflow as tf root_path = os.path.dirname(os.path.dirn...
github_jupyter
# Data description & Problem statement: This dataset is originally from the National Institute of Diabetes and Digestive and Kidney Diseases. The objective of the dataset is to diagnostically predict whether or not a patient has diabetes, based on certain diagnostic measurements included in the dataset. Several constr...
github_jupyter
``` # Select TensorFlow 2.0 environment (works only on Colab) %tensorflow_version 2.x # Install wandb (ignore if already done) !pip install wandb # Authorize wandb !wandb login # Imports from tensorflow.keras.models import * from tensorflow.keras.layers import * from wandb.keras import WandbCallback import tensorflow a...
github_jupyter
# Integrate 3rd party transforms into MONAI program This tutorial shows how to integrate 3rd party transforms into MONAI program. Mainly shows transforms from `BatchGenerator`, `TorchIO`, `Rising` and `ITK`. ``` ! pip install batchgenerators==0.20.1 ! pip install torchio==0.16.21 ! pip install rising==0.2.0 ! pip i...
github_jupyter
``` import matplotlib,aplpy from astropy.io import fits from general_functions import * import matplotlib.pyplot as plt font = {'size' : 14, 'family' : 'serif', 'serif' : 'cm'} plt.rc('font', **font) plt.rcParams['image.interpolation'] = 'nearest' plt.rcParams['lines.linewidth'] = 1 plt.rcParams['axes.linewidth'] = 1...
github_jupyter
# Global Segment Overflow - recall function pointers are pointers that store addresses of functions/code - see [Function-Pointers notebook](./Function-Pointers.ipynb) for a review - function pointers can be overwritten using overflow techniques to point to different code/function ## Lucky 7 game - various luck-ba...
github_jupyter
##### Copyright 2019 The TensorFlow Authors. ``` #@title Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
github_jupyter
# Deep Learning with PyTorch Step-by-Step: A Beginner's Guide # Chapter 1 ``` try: import google.colab import requests url = 'https://raw.githubusercontent.com/dvgodoy/PyTorchStepByStep/master/config.py' r = requests.get(url, allow_redirects=True) open('config.py', 'wb').write(r.content) excep...
github_jupyter
# Transfer Learning ## Imports and Version Selection ``` # TensorFlow ≥2.0 is required for this notebook import tensorflow as tf from tensorflow import keras assert tf.__version__ >= "2.0" # check if GPU is available as this notebook will be very slow without GPU if not tf.test.is_gpu_available(): print("No GPU w...
github_jupyter
# Example of simple use of active learning API Compare 3 query strategies: random sampling, uncertainty sampling, and active search. Observe how we trade off between finding targets and accuracy. # Imports ``` import warnings warnings.filterwarnings(action='ignore', category=RuntimeWarning) from matplotlib import py...
github_jupyter
<a href="https://colab.research.google.com/github/aruanalucena/Car-Price-Prediction-Machine-Learning/blob/main/Car_Price_Prediction_.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # **Car Price Prediction with python**. # **Previsão de carrro com P...
github_jupyter
``` import seaborn as sns import matplotlib.pyplot as plt sns.set(style="ticks") %matplotlib inline import numpy as np np.random.seed(sum(map(ord, "axis_grids"))) ``` ``` tips = sns.load_dataset("tips") g = sns.FacetGrid(tips, col="time") ``` ``` g = sns.FacetGrid(tips, col="time") g.map(plt.hist, "tip"); ``` ``` g ...
github_jupyter
**handson用資料としての注意点** 普通、同じセル上で何度も試行錯誤するので、最終的に上手くいったセルしか残らず、失敗したセルは残りませんし、わざわざ残しません。 今回はhandson用に 試行・思考過程を残したいと思い、エラーやミスが出ても下のセルに進んで処理を実行するようにしています。 notebookのセル単位の実行ができるからこそのやり方かもしれません。良い。 (下のセルから文は常体で書きます。) kunai (@jdgthjdg) --- # ここまでの処理を整理して、2008〜2019のデータを繋いでみる ## xls,xlsxファイルを漁る ``` from pathlib import Pa...
github_jupyter
**Outline of Steps** + Initialization + Download COCO detection data from http://cocodataset.org/#download + http://images.cocodataset.org/zips/train2014.zip <= train images + http://images.cocodataset.org/zips/val2014.zip <= validation images + http://images.cocodataset....
github_jupyter
## Launching Spark Spark's Python console can be launched directly from the command line by `pyspark`. SparkSession can be found by calling `spark` object. The Spark SQL console can be launced by `spark-sql`. We will experiment with these in the upcoming sessions. If we have `pyspark` and other required packages inst...
github_jupyter
2018-10-26 실용주의 파이썬 101 - Part 2 [김영호](https://www.linkedin.com/in/danielyounghokim/) 난이도 ● ● ◐ ○ ○ # Data Structures - Immutable vs. Mutable - Immutable: `tuple` - Mutable: `list`, `set`, `dict` - Mutable Container 설명 순서 - 초기화 - 추가/삭제 - 특정 값 접근(access) - 정렬 ## `tuple` ### 초기화 ``` seq = () t...
github_jupyter
<a href="https://colab.research.google.com/github/mmoghadam11/ReDet/blob/master/train_UCAS_AOD.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') #باشد tesla t4 باید #اگر نبود در بخش ران ...
github_jupyter
## Importing the library ``` import numpy as np ``` ## Data Types ### Scalars ``` # creating a scalar, we use the 'array' in order to create any type of data type e.g. scalar, vector, matrix s = np.array(5) # visualizing the shape of a scalar, in the example below it returns an empty tuple which is normal # a scala...
github_jupyter
``` #Load dependencies import numpy as np import pandas as pd pd.options.display.float_format = '{:,.1e}'.format import sys sys.path.insert(0, '../../statistics_helper') from CI_helper import * from excel_utils import * ``` # Estimating the total biomass of marine deep subsurface archaea and bacteria We use our best ...
github_jupyter
# Probabilistic Matrix Factorization for Making Personalized Recommendations ``` %matplotlib inline import numpy as np import pandas as pd import pymc3 as pm from matplotlib import pyplot as plt plt.style.use("seaborn-darkgrid") print(f"Running on PyMC3 v{pm.__version__}") ``` ## Motivation So you are browsing for...
github_jupyter
<a href="https://colab.research.google.com/github/josearangos/PDI/blob/Colab/Colab_Class/binarySegmentation.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import cv2 import numpy as np import matplotlib.pyplot as plt from google.colab.patches i...
github_jupyter
# Housing economy, home prices and affordibility Alan Greenspan in 2014 pointed out that there was never a recovery from recession without improvements in housing construction. Here we examine some relevant data, including the Case-Shiller series, and derive an insightful measure of the housing economy, **hscore**,...
github_jupyter
<table class="ee-notebook-buttons" align="left"> <td><a target="_blank" href="https://github.com/giswqs/earthengine-py-notebooks/tree/master/Tutorials/Keiko/glad_alert.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td> <td><a target="_blank" h...
github_jupyter
# Convert verse ranges of genres to TF verse node features ``` import collections import pandas as pd from tf.fabric import Fabric from tf.compose import modify from tf.app import use A = use('bhsa', hoist=globals()) genre_ranges = pd.read_csv('genre_ranges.csv') genre_ranges ``` # Compile data & sanity checks ``` #...
github_jupyter
## 1. Importing the required libraries for EDA ``` import pandas as pd import numpy as np # For mathematical calculations import seaborn as sns # For data visualization import matplotlib.pyplot as plt # For plotting graphs %matplotlib inline sns.set(color_codes=True) im...
github_jupyter
<a href="https://colab.research.google.com/github/jeffheaton/t81_558_deep_learning/blob/master/t81_558_class_08_4_bayesian_hyperparameter_opt.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 8:...
github_jupyter
``` name = '2015-12-11-meeting-summary' title = 'Introducing Git' tags = 'git, github, version control' author = 'Denis Sergeev' from nb_tools import connect_notebook_to_post from IPython.core.display import HTML html = connect_notebook_to_post(name, title, tags, author) ``` Today we talked about git and its function...
github_jupyter
# Basic Bayesian Linear Regression Implementation ``` # Pandas and numpy for data manipulation import pandas as pd import numpy as np # Matplotlib and seaborn for visualization import matplotlib.pyplot as plt %matplotlib inline import seaborn as sns # Linear Regression to verify implementation from sklearn.linear_...
github_jupyter
# Text recognition We have a set of water meter images. We need to get each water meter’s readings. We ask performers to look at the images and write down the digits on each water meter. To get acquainted with Toloka tools for free, you can use the promo code **TOLOKAKIT1** on $20 on your [profile page](https://toloka...
github_jupyter
# Multi-Layer Perceptron, MNIST --- In this notebook, we will train an MLP to classify images from the [MNIST database](http://yann.lecun.com/exdb/mnist/) hand-written digit database. The process will be broken down into the following steps: >1. Load and visualize the data 2. Define a neural network 3. Train the model...
github_jupyter
# 붓꽃(Iris) 품종 데이터 예측하기 <h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#DataFrame" data-toc-modified-id="DataFrame-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>DataFrame</a></span></li><li><span><a href="#Train/Test-데이터-나누어-학습하기" data-toc-modified-i...
github_jupyter
# Density estimation demo Here we demonstrate how to use the ``inference.pdf`` module for estimating univariate probability density functions from sample data. ``` from numpy import linspace, zeros, exp, log, sqrt, pi from numpy.random import normal, exponential from scipy.special import erfc import matplotlib.pyplot...
github_jupyter
# Assignment 3: RTRL Implement an RNN with RTRL. The ds/dw partial derivative is 2D hidden x (self.n_hidden * self.n_input) instead of 3d. ``` %matplotlib inline import numpy as np import matplotlib.pyplot as plt class RNN(object): def __init__(self, n_input, n_hidden, n_output): # init weights and biases...
github_jupyter
``` from gtts import gTTS LANG_PATH = '../lang/{0}/speech/{1}.mp3' tts = gTTS(text='Se ha detectado más de una persona, inténtelo de nuevo con una persona sólo por favor', lang='es', slow=False) tts.save(LANG_PATH.format('es', 'more_than_one_face')) tts = gTTS(text='There appears to be more than one person, try again ...
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"> # Getting Started with Qiskit Here, we provide an overview of working with Qiskit. Qiskit provides the basic building blocks necessary...
github_jupyter
____ __Universidad Tecnológica Nacional, Buenos Aires__\ __Ingeniería Industrial__\ __Cátedra de Investigación Operativa__\ __Autor: Martín Palazzo__ (Mpalazzo@frba.utn.edu.ar) y __Rodrigo Maranzana__ (Rmaranzana@frba.utn.edu.ar) ____ # Simulación con distribución Exponencial <h1>Índice<span class="tocSkip"></span></...
github_jupyter
<p><font size="6"><b>Visualization - Matplotlib</b></font></p> > *DS Data manipulation, analysis and visualization in Python* > *May/June, 2021* > > *© 2021, Joris Van den Bossche and Stijn Van Hoey (<mailto:jorisvandenbossche@gmail.com>, <mailto:stijnvanhoey@gmail.com>). Licensed under [CC BY 4.0 Creative Commons]...
github_jupyter
#### The purpose of this notebook is to compare D-REPR with other methods such as KR2RML and R2RML in term of performance ``` import re, numpy as np import matplotlib.pyplot as plt from tqdm import tqdm_notebook as tqdm %matplotlib inline plt.rcParams["figure.figsize"] = (10.0, 8.0) # set default size of plots plt.rc...
github_jupyter
``` #Importing necessary libraries import keras import numpy as np import pandas as pd from keras.applications import VGG16, inception_v3, resnet50, mobilenet from keras import models from keras import layers from keras import optimizers from sklearn.metrics import classification_report, confusion_matrix import matplo...
github_jupyter
``` %matplotlib inline ``` # Tuning a scikit-learn estimator with `skopt` Gilles Louppe, July 2016 Katie Malone, August 2016 Reformatted by Holger Nahrstaedt 2020 .. currentmodule:: skopt If you are looking for a :obj:`sklearn.model_selection.GridSearchCV` replacement checkout `sphx_glr_auto_examples_sklearn-grids...
github_jupyter
# <center>MobileNet - Pytorch # Step 1: Prepare data ``` # MobileNet-Pytorch import argparse import torch import numpy as np import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.optim.lr_scheduler import StepLR from torchvision import datasets, transforms from torch.autograd i...
github_jupyter
``` from database.market import Market from database.strategy import Strategy from extractor.tiingo_extractor import TiingoExtractor from preprocessor.model_preprocessor import ModelPreprocessor from preprocessor.predictor_preprocessor import PredictorPreprocessor from modeler.modeler import Modeler from datetime impor...
github_jupyter
<a href="https://colab.research.google.com/github/katie-chiang/ARMultiDoodle/blob/master/Copy_of_Welcome_To_Colaboratory.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> <p><img alt="Colaboratory logo" height="45px" src="/img/colab_favicon.ico" align...
github_jupyter
# Visulizing spatial information - California Housing This demo shows a simple workflow when working with geospatial data: * Obtaining a dataset which includes geospatial references. * Obtaining a desired geometries (boundaries etc.) * Visualisation In this example we will make a simple **proportional symbols m...
github_jupyter
# Build sentence/paragraph level QA application from python with Vespa > Retrieve paragraph and sentence level information with sparse and dense ranking features We will walk through the steps necessary to create a question answering (QA) application that can retrieve sentence or paragraph level answers based on a co...
github_jupyter
# Quadtrees iterating on pairs of neighbouring items A quadtree is a tree data structure in which each node has exactly four children. It is a particularly efficient way to store elements when you need to quickly find them according to their x-y coordinates. A common problem with elements in quadtrees is to detect pa...
github_jupyter
``` import sys import os # path_to_script = os.path.dirname(os.path.abspath(__file__)) path_to_imcut = os.path.abspath("..") sys.path.insert(0, path_to_imcut) path_to_imcut import imcut imcut.__file__ import numpy as np import scipy import scipy.ndimage # import sed3 import matplotlib.pyplot as plt ``` ## Input da...
github_jupyter
``` from edahelper import * import sklearn.naive_bayes as NB import sklearn.linear_model from sklearn.model_selection import train_test_split from sklearn.feature_extraction.text import CountVectorizer from sklearn.feature_extraction.text import TfidfTransformer from sklearn.pipeline import Pipeline from sklearn.linear...
github_jupyter
## Sleep analysis, using Passive Infrared (PIR) data, in 10sec bins from a single central PIR, at 200-220mm above the cage floor. Previously EEG-telemetered animals allow direct comparison of sleep scored by direct and non-invasive methods. ### 1st setup analysis environment: ``` import numpy as np # calculations i...
github_jupyter
### What is Matplotlib? Matplotlib is a plotting library for the Python, Pyplot is a matplotlib module which provides a MATLAB-like interface. Matplotlib is designed to be as usable as MATLAB, with the ability to use Python, and the advantage of being free and open-source. #### What does Matplotlib Pyplot do? Matplot...
github_jupyter
##### Copyright 2019 The TensorFlow Authors. ``` #@title Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
github_jupyter
This script is based on instructions given in [this lesson](https://github.com/HeardLibrary/digital-scholarship/blob/master/code/scrape/pylesson/lesson2-api.ipynb). ## Import libraries and load API key from file The API key should be the only item in a text file called `flickr_api_key.txt` located in the user's home...
github_jupyter
``` import matplotlib.pyplot as plt import torch import gpytorch import time import numpy as np %matplotlib inline import pickle import finite_ntk %pdb class ExactGPModel(gpytorch.models.ExactGP): # exact RBF Gaussian process class def __init__(self, train_x, train_y, likelihood, model, use_linearstrategy=Fals...
github_jupyter
Precipitation Metrics (consecutive dry days, rolling 5-day precip accumulation, return period) ``` ! pip install xclim %matplotlib inline import xarray as xr import numpy as np import matplotlib.pyplot as plt import os import pandas as pd from datetime import datetime, timedelta, date import dask import dask.array a...
github_jupyter
# IElixir - Elixir kernel for Jupyter Project <img src="logo.png" title="Hosted by imgur.com" style="margin: 0 0;"/> --- ## Google Summer of Code 2015 > Developed by [Piotr Przetacznik](https://twitter.com/pprzetacznik) > Mentored by [José Valim](https://twitter.com/josevalim) --- ## References * [Elixir language...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt A = np.random.randn(4,3) B = np.sum(A, axis = 1, keepdims = True) B.shape ``` # Data Loading ``` data = pd.read_csv("ner_dataset.csv", encoding="latin1") data = data.drop(['POS'], axis =1) data.head() plt.style.use("ggplot") data = pd.read_csv...
github_jupyter
# Logistic Regression Notebook version: 2.0 (Nov 21, 2017) 2.1 (Oct 19, 2018) Author: Jesús Cid Sueiro (jcid@tsc.uc3m.es) Jerónimo Arenas García (jarenas@tsc.uc3m.es) Changes: v.1.0 - First version v.1.1 - Typo correction. Prepared for slide presentation ...
github_jupyter
TSG086 - Run `top` in all containers ==================================== Steps ----- ### Instantiate Kubernetes client ``` # Instantiate the Python Kubernetes client into 'api' variable import os from IPython.display import Markdown try: from kubernetes import client, config from kubernetes.stream import ...
github_jupyter
### Irrigation model input file prep This code prepares the final input file to the irrigation (agrodem) model. It extracts all necessary attributes to crop locations. It also applies some name fixes as needed for the model to run smoothly.The output dataframe is exported as csv and ready to be used in the irrigation ...
github_jupyter
<a href="https://colab.research.google.com/github/KristynaPijackova/Radio-Modulation-Recognition-Networks/blob/main/Radio_Modulation_Recognition_Networks.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Radio Modulation Recognition Networks --- *...
github_jupyter
# Comparison FFTConv & SpatialConv In this notebook, we compare the speed and the error of utilizing fft and spatial convolutions. In particular, we will: * Perform a forward and backward pass on a small network utilizing different types of convolution. * Analyze their speed and their error response w.r.t. spatial c...
github_jupyter
##### Copyright 2019 The TensorFlow Authors. ``` #@title Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
github_jupyter
## [Experiments] Uncertainty Sampling with a 1D Gaussian Process as model First, we define a prior probablility for a model. The GaussianRegressor approximates this model using an optimization method (probably similar to EM) for a given data input. The resulting model has a mean and a certainty. We use these to determ...
github_jupyter
# Probability Distribution: In [probability theory](https://en.wikipedia.org/wiki/Probability_theory) and [statistics](https://en.wikipedia.org/wiki/statistics), a probability distribution is a [mathematical function](https://en.wikipedia.org/wiki/Function_(mathematics)) that, stated in simple terms, can be thought o...
github_jupyter
<h1>02 Pandas</h1> $\newcommand{\Set}[1]{\{#1\}}$ $\newcommand{\Tuple}[1]{\langle#1\rangle}$ $\newcommand{\v}[1]{\pmb{#1}}$ $\newcommand{\cv}[1]{\begin{bmatrix}#1\end{bmatrix}}$ $\newcommand{\rv}[1]{[#1]}$ $\DeclareMathOperator{\argmax}{arg\,max}$ $\DeclareMathOperator{\argmin}{arg\,min}$ $\DeclareMathOperator{\...
github_jupyter
# Tutorial 01: Running Sumo Simulations This tutorial walks through the process of running non-RL traffic simulations in Flow. Simulations of this form act as non-autonomous baselines and depict the behavior of human dynamics on a network. Similar simulations may also be used to evaluate the performance of hand-design...
github_jupyter
### Data Frame Plots documentation: http://pandas.pydata.org/pandas-docs/stable/visualization.html ``` import pandas as pd import numpy as np import matplotlib.pyplot as plt plt.style.use('ggplot') ``` The plot method on Series and DataFrame is just a simple wrapper around plt.plot() If the index consists of dates, ...
github_jupyter
<a href="http://landlab.github.io"><img style="float: left" src="../media/landlab_header.png"></a> # The deAlmeida Overland Flow Component <hr> <small>For more Landlab tutorials, click here: <a href="https://landlab.readthedocs.io/en/latest/user_guide/tutorials.html">https://landlab.readthedocs.io/en/latest/user_guid...
github_jupyter
# Modes of the Ball-Channel Pendulum Linear Model ``` import numpy as np import numpy.linalg as la import matplotlib.pyplot as plt from resonance.linear_systems import BallChannelPendulumSystem %matplotlib widget ``` A (almost) premade system is available in `resonance`. The only thing missing is the function that ca...
github_jupyter
Steane code fault tolerance encoding scheme b ======================================= 1. Set up two logical zero for Steane code based on the parity matrix in the book by Nielsen MA, Chuang IL. Quantum Computation and Quantum Information, 10th Anniversary Edition. Cambridge University Press; 2016. p. 474 2. Set up ...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt %matplotlib inline from datetime import time import geopandas as gpd from shapely.geometry import Point, LineString, shape ``` ## Load Data ``` df = pd.read_csv(r'..\data\processed\trips_custom_variables.csv', dtype = {'VORIHORAINI':str, 'VDE...
github_jupyter
# U.S. Border Patrol Nationwide Apprehensions by Citizenship and Sector **Data Source:** [CBP Apprehensions](https://www.cbp.gov/sites/default/files/assets/documents/2021-Aug/USBORD~3.PDF) <br> **Download the Output:** [here](../data/extracted_data/) ## Overview The source PDF is a large and complex PDF with varying...
github_jupyter
# FAQs for Regression, MAP and MLE * So far we have focused on regression. We began with the polynomial regression example where we have training data $\mathbf{X}$ and associated training labels $\mathbf{t}$ and we use these to estimate weights, $\mathbf{w}$ to fit a polynomial curve through the data: \begin{equatio...
github_jupyter
# 7. Overfitting Prevention ## Why do we need to solve overfitting? - To increase the generalization ability of our deep learning algorithms - Able to make predictions well for out-of-sample data ## Overfitting and Underfitting: Examples ![](./images/overfitting.png) - **_This is an example from scikit-learn's webs...
github_jupyter