text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt # TODO Read in weight_loss.csv # Assign variables to columns mean_group_a = np.mean(weight_lost_a) mean_group_b = np.mean(weight_lost_b) plt.hist(weight_lost_a) plt.show() plt.hist(weight_lost_b) plt.show() mean_difference = mean_group_b - me...
github_jupyter
``` import numpy as np docs = ["I enjoy playing TT", "I like playing TT"] docs[0][0].split() from sklearn.feature_extraction.text import CountVectorizer vectorizer = CountVectorizer(min_df=0, token_pattern=r"\b\w+\b") vectorizer.fit(docs) print(vectorizer.vocabulary_) # encode document vector = vectorizer.transform(do...
github_jupyter
# Video Super Resolution with OpenVINO Super Resolution is the process of enhancing the quality of an image by increasing the pixel count using deep learning. This notebook applies Single Image Super Resolution (SISR) to frames in a 360p (480×360) video in 360p resolution. We use a model called [single-image-super-reso...
github_jupyter
**Reinforcement Learning with TensorFlow & TRFL: Q Learning** * This notebook shows how to apply the classic Reinforcement Learning (RL) idea of Q learning with TRFL. * In TD learning we estimated state values: V(s). In Q learning we estimate action values: Q(s,a). Here we'll go over Q learning in the simple tabular ca...
github_jupyter
# Tensorboard example ``` import time from collections import namedtuple import numpy as np import tensorflow as tf with open('anna.txt', 'r') as f: text=f.read() vocab = set(text) vocab_to_int = {c: i for i, c in enumerate(vocab)} int_to_vocab = dict(enumerate(vocab)) encoded = np.array([vocab_to_int[c] for c in ...
github_jupyter
# The Python ecosystem - The pandas library The [pandas library](https://pandas.pydata.org/) was created by [Wes McKinney](http://wesmckinney.com/) in 2010. pandas provides **data structures** and **functions** for manipulating, processing, cleaning and crunching data. In the Python ecosystem pandas is the state-of-t...
github_jupyter
# Run AwareDX ad-hoc on any drug and adverse event ``` from os import path from collections import Counter, defaultdict from tqdm.notebook import tqdm import numpy as np import pandas as pd import feather import scipy.stats from scipy import stats import pymysql import pymysql.cursors from database import Database f...
github_jupyter
[View in Colaboratory](https://colab.research.google.com/github/nishi1612/SC374-Computational-and-Numerical-Methods/blob/master/Set_3.ipynb) Set 3 --- **Finding roots of polynomial by bisection method** ``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import math from google.colab import fi...
github_jupyter
# Compiling and running C programs As in [the example](https://github.com/tweag/funflow/tree/v1.5.0/funflow-examples/compile-and-run-c-files) in funflow version 1, we can construct a `Flow` which compiles and executes a C program. As in the older versions of this example, we will use the `gcc` Docker image to run our ...
github_jupyter
## Basic Training UC Berkeley Python Bootcamp ``` print("Hello, world.") ``` # Calculator # > there are `int` and `float` (but not doubles) ``` print(2 + 2) 2 + 2 print(2.1 + 2) 2.1 + 2 == 4.0999999999999996 %run talktools ``` - Python stores floats as their byte representation so is limited by the same 16-bit p...
github_jupyter
# 1millionwomentotech SummerOfCode ## Intro to AI: Week 4 Day 3 ``` print(baby_train[50000]['reviewText']) from nltk.sentiment.vader import SentimentIntensityAnalyzer sia = SentimentIntensityAnalyzer() text = baby_train[50000]['reviewText'] for s in sent_tokenize(text): print(s) print(sia.polarity_scores(s)) ...
github_jupyter
# 自动求导的相关设置 - Tensor的属性: - requires_grad=True - 是否用来求导 - is_leaf: - 叶子节点必须是计算的结果; - 用户创建的Tensor的is_leaf=True(尽管requires_grad=True,也is_leaf=True); - requires_grad=False的Tensor的is_leaf=True; - grad_fn: - 用来指定求导函数; - grad - 用来返回导数; - dtype ...
github_jupyter
``` import numpy as np import os from PIL import Image from sklearn.preprocessing import LabelBinarizer import sys import glob import argparse import matplotlib.pyplot as plt import pickle as pkl from keras.applications.inception_v3 import InceptionV3, preprocess_input, decode_predictions from keras.models import Model...
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
<h2> Basics of Python: Lists </h2> We review using Lists in Python here. Please run each cell and check the results. A list (or array) is a collection of objects (variables) separated by comma. The order is important, and we can access each element in the list with its index starting from 0. ``` # here is a list...
github_jupyter
# lab2 Logisitic Regression ``` %matplotlib inline import numpy as np import matplotlib import pandas as pd import matplotlib.pyplot as plt import scipy.optimize as op ``` ## 1. Load Data ``` data = pd.read_csv('ex2data1.txt') X = np.array(data.iloc[:,0:2]) y = np.array(data.iloc[:,2]) print('X.shape = ' + str(X.sha...
github_jupyter
# Inference This notebook is dedicated to testing and visualizing results for both the wiki and podcast datasets Note: Apologies for the gratuitous warnings. Tensorflow is aware of these issues and has rectified them in later versions of TensorFlow. Unfortunately, they persist for version 1.13. ``` from src.SliceNet...
github_jupyter
# "The Role of Wide Baseline Stereo in the Deep Learning World" > "Short history of wide baseline stereo in computer vision" - toc: false - image: images/doll_wbs_300.png - branch: master - badges: true - comments: true - hide: false - search_exclude: false ## Rise of Wide Multiple Baseline Stereo The *wide multiple ...
github_jupyter
# Plotting with [cartopy](https://scitools.org.uk/cartopy/docs/latest/) From Cartopy website: * Cartopy is a Python package designed for geospatial data processing in order to produce maps and other geospatial data analyses. * Cartopy makes use of the powerful PROJ.4, NumPy and Shapely libraries and includes a progr...
github_jupyter
# Gazebo proxy The Gazebo proxy is an implementation of interfaces with all services provided by the `gazebo_ros_pkgs`. It allows easy use and from of the simulation through Python. It can be configured for different `ROS_MASTER_URI` and `GAZEBO_MASTER_URI` environment variables to access instances of Gazebo running...
github_jupyter
``` import tensorflow as tf import numpy as np from copy import deepcopy epoch = 20 batch_size = 64 size_layer = 64 dropout_rate = 0.5 n_hops = 2 class BaseDataLoader(): def __init__(self): self.data = { 'size': None, 'val':{ 'inputs': None, 'questions...
github_jupyter
#### 通过RNN使用imdb数据集完成情感分类任务 ``` from __future__ import absolute_import,print_function,division,unicode_literals import tensorflow as tf import tensorflow.keras as keras import numpy as np import os tf.__version__ tf.random.set_seed(22) np.random.seed(22) os.environ['TF_CPP_LOG_LEVEL'] = '2' # 超参数 vocab_size = 10000 m...
github_jupyter
``` from plot_helpers import * from source_files_extended import load_sfm_depth, load_aso_depth, load_classifier_data figure_style= dict(figsize=(8, 6)) aso_snow_depth_values = load_aso_depth() sfm_snow_depth_values = load_sfm_depth(aso_snow_depth_values.mask) ``` ## SfM snow depth distribution ``` data = [ { ...
github_jupyter
# **Numba** ### Numba is a JIT Compiler and uses LLVM internally - No compilation required ! ![](./img/numba_flowchart.png) ``` import time def get_time_taken(func, *args): res = func(*args) start = time.time() func(*args) end = time.time() time_taken = end - start print(f"Total time - {time...
github_jupyter
# Recommender Systems ### Reverse-engeneering users needs/desires Recommender systems have been in the heart of ML. Mostly that in order to get insigths on large populations it was necessary to understand how users behave, but this can only be done from the historical behaviour. Let's fix some setting that we use fo...
github_jupyter
# 1. Import libraries ``` #----------------------------Reproducible---------------------------------------------------------------------------------------- import numpy as np import random as rn import os seed=0 os.environ['PYTHONHASHSEED'] = str(seed) np.random.seed(seed) rn.seed(seed) #---------------------------...
github_jupyter
<img src="./pictures/DroneApp_logo.png" style="float:right; max-width: 180px; display: inline" alt="INSA" /></a> <img src="./pictures/logo_sizinglab.png" style="float:right; max-width: 100px; display: inline" alt="INSA" /></a> # Frame design The objective of this study, is to optimize the overall design in terms of m...
github_jupyter
# Customizing visual appearance HoloViews elements like the `Scatter` points illustrated in the [Introduction](1-Introduction.ipynb) contain two types of information: - **Your data**, in as close to its original form as possible, so that it can be analyzed and accessed as you see fit. - **Metadata specifying what y...
github_jupyter
<a href="https://colab.research.google.com/github/cxbxmxcx/EatNoEat/blob/master/Chapter_9_EatNoEat_Training.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import tensorflow as tf import numpy as np import random import matplotlib import matplot...
github_jupyter
# Recurrent Neural Networks (RNN) with Keras ## Learning Objectives 1. Add built-in RNN layers. 2. Build bidirectional RNNs. 3. Using CuDNN kernels when available. 4. Build a RNN model with nested input/output. ## Introduction Recurrent neural networks (RNN) are a class of neural networks that is powerful for model...
github_jupyter
# Pretrained GPT2 Model Deployment Example In this notebook, we will run an example of text generation using GPT2 model exported from HuggingFace and deployed with Seldon's Triton pre-packed server. the example also covers converting the model to ONNX format. The implemented example below is of the Greedy approach f...
github_jupyter
# Naive forecasting ## Setup ``` import numpy as np import matplotlib.pyplot as plt def plot_series(time, series, format="-", start=0, end=None, label=None): plt.plot(time[start:end], series[start:end], format, label=label) plt.xlabel("Time") plt.ylabel("Value") if label: plt.legend(fontsize=1...
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
<a href="https://colab.research.google.com/github/claytonchagas/intpy_prod/blob/main/9_4_automatic_evaluation_dataone_Digital_RADs_ast_only_files.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` !sudo apt-get update !sudo apt-get install python3....
github_jupyter
<a href="https://colab.research.google.com/github/ghost331/Recurrent-Neural-Network/blob/main/Covid_19_Analysis_using_RNN_with_LSTM.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` #Data: https://github.com/CSSEGISandData/COVID-19/blob/master/css...
github_jupyter
### Installation ``` pip install -q tensorflow tensorflow-datasets ``` #### Imports ``` import tensorflow as tf import matplotlib.pyplot as plt import numpy as np from tensorflow import keras import tensorflow_datasets as tfds ``` ### Checking datasets ``` print(tfds.list_builders()) ``` ### Getting data Infomati...
github_jupyter
### Test spatial distribution of molecular clusters: 1) to determine the spatiall distribution of molecular cell types (a.k.a. whether they are clustered, dispersed or uniformly distributed), we compared the cell types with a CSR (complete spatial randomness) process and performed a monte carlo test of CSR (Cressie; ...
github_jupyter
``` %pylab inline #%matplotlib qt from __future__ import division # use so 1/2 = 0.5, etc. import sk_dsp_comm.sigsys as ss import sk_dsp_comm.iir_design_helper as iir_d import sk_dsp_comm.pyaudio_helper as pah import scipy.signal as signal import time import sys import imp # for module development and reload() from IPy...
github_jupyter
<a href="https://colab.research.google.com/github/skimotv/SkimoTextSummarizer/blob/master/Multiple_Summarizer_Tests.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` !pip install -U git+https://github.com/huggingface/transformers.git import torch ...
github_jupyter
``` import numpy as np import astropy.units as u from astropy.time import Time from astropy.table import Table from sbpy.data import Ephem, Phys from sbpy.activity import (Haser, LTE, NonLTE, photo_timescale, einstein_coeff, intensity_conversion, beta_factor, total_number, from_Haser) import matplotlib.pyplot as plt i...
github_jupyter
## Product Sentiment Data Data (public domain): https://data.world/crowdflower/brands-and-product-emotions Notebook code based on IMDB notebook from bert-sklearn/other_examples ``` import numpy as np import pandas as pd import os import sys import csv import re from sklearn import metrics from sklearn.metrics import...
github_jupyter
``` from google.colab import drive drive.mount('/content/gdrive') import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import math ``` # Getting Data ``` data=pd.read_csv("/content/gdrive/MyDrive/kag_risk_factors_cervical_cancer.csv",dtype='object') data.head() ``` # Checking ...
github_jupyter
# Before we begin * Github (Github Education) * Bitbucket * Kaggle # Introduction In this week, we want to implement an Ant Colony Optimization Algorithm to solve Travelling Sales Man problem. ``` import random import math import operator import matplotlib.pyplot as plt ``` # Content * Travelling Sales Man Problem ...
github_jupyter
``` %pylab inline ``` # Drawing random numbers in Python ## 1. Drawing using the rectangular distribution The prerequisite for drawing from a probability distribution is the ability to draw randomly from the rectangular or uniform distribution on $(0,1)$. For any other distribution, draws can be generated by 1) ...
github_jupyter
``` import numpy as np import pandas as pd import seaborn as sns %matplotlib notebook import matplotlib.pyplot as plt import matplotlib matplotlib.style.use('ggplot') ``` import data and drop NAs, calculate metascore/10 and rating*10 ``` imdb = pd.read_csv("C:\\Users\\Adam\\Google Drive\\School\\ComputerScience\\int...
github_jupyter
# Assignment 1: Bandits and Exploration/Exploitation Welcome to Assignment 1. This notebook will: - Help you create your first bandit algorithm - Help you understand the effect of epsilon on exploration and learn about the exploration/exploitation tradeoff - Introduce you to some of the reinforcement learning software...
github_jupyter
# Adau1761_0 IP This notebook serves as a quick demonstration of the audio codec being used in the **PYNQ-Z2 board**. A new IP has been introduced to make use of the codec. Before starting with this notebook please ensure you have the following: * Added the new audio.py file in the board * Added the new pl.py file i...
github_jupyter
<!--BOOK_INFORMATION--> <img align="left" style="padding-right:10px;" src="figures/PDSH-cover-small.png"> *This notebook contains an excerpt from the [Python Data Science Handbook](http://shop.oreilly.com/product/0636920034919.do) by Jake VanderPlas; the content is available [on GitHub](https://github.com/jakevdp/Pyth...
github_jupyter
<a href="https://colab.research.google.com/github/butchland/fastai_nb_explorations/blob/master/CollectRealFingersData.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Data Exploration notebooks for Fingers datasets ### Run using a CPU Runtime (no ...
github_jupyter
``` import random import pandas as pd import geopandas as gpd import matplotlib.pyplot as plt import esda import libpysal.weights as weights from esda.moran import Moran from shapely.geometry import Point, MultiPoint, LineString, Polygon, shape import json import pylab import libpysal import numpy as np from sklearn.me...
github_jupyter
# Training of the model for Thumb Classification The goal of this notebook is to train a classification model that can detect thumb up and thumb down in video stream This notebook has been run on Google Colab to take advantage of the GPU. ``` import numpy as np import os import shutil from sklearn.model_selection...
github_jupyter
# Neuromorphic Computing Course ## 0. Example Code ### Download the program and move it up one directory. ``` # Delete everything in the content (current) directory on google colab !rm -rf /content/* || echo rm -rf /content/* failed # Clone git repo, change the branch and move it up by one level in the folder hiera...
github_jupyter
# RadarCOVID-Report ## Data Extraction ``` import datetime import json import logging import os import shutil import tempfile import textwrap import uuid import matplotlib.pyplot as plt import matplotlib.ticker import numpy as np import pandas as pd import pycountry import retry import seaborn as sns %matplotlib in...
github_jupyter
# Classifying cancer from 32 parameters Data is taken from https://archive.ics.uci.edu/ml/datasets/Breast+Cancer+Wisconsin+%28Diagnostic%29 We simply read all the data, drop the patient ID and place the label into an array of it's own. ``` import csv import numpy with open('data_Cancer.csv') as input_file: text...
github_jupyter
## Loading an HCA matrix into scanpy This vignette illustrates requesting an expression matrix from the HCA matrix service and loading it into scanpy. First, install and import some dependencies: ``` import sys !{sys.executable} -m pip install python-igraph loompy louvain pandas requests scanpy import json, os, req...
github_jupyter
Tutorial on computational modeling and statistical model fitting part of the *IBL Computational Neuroscience Course* organized by the [International Brain Laboratory](https://www.internationalbrainlab.com/) (April 2020). **Lecturer:** [Luigi Acerbi](http://luigiacerbi.com/). **Instructions:** - To run the tutorial, y...
github_jupyter
``` # bem: triangulation and fmm/bem electrostatics tools # # Copyright (C) 2011-2012 Robert Jordens <jordens@gmail.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either versi...
github_jupyter
# Running cell2location on NanostringWTA data In this notebook we we map fetal brain cell types to regions of interest (ROIs) profiled with the NanostringWTA technology, using a version of our cell2location method recommended for probe based spatial transcriptomics data. This notebook should be read after looking at th...
github_jupyter
``` # hide %load_ext autoreload from nbdev import * # default_exp annotate ``` # Annotate > Tools to support creating and process annotation for samples of Newspaper Navigator data using Label Studio ``` # hide from nbdev.showdoc import * # export from nnanno.core import * # export from tqdm.notebook import trange, ...
github_jupyter
# Scikits DAE solver In this notebook, we show some examples of solving a DAE model using the Scikits DAE solver, which interfaces with the [SUNDIALS](https://computation.llnl.gov/projects/sundials) library via the [scikits-odes](https://scikits-odes.readthedocs.io/en/latest/) Python interface ``` # Setup import pyba...
github_jupyter
# This notebook plots metrics throughout training (Supplementary Fig. 3) ``` import os import numpy as np from six.moves import cPickle import matplotlib.pyplot as plt %matplotlib inline from tensorflow import keras import helper from tfomics import utils, explain, metrics num_trials = 10 model_names = ['cnn-deep', 'c...
github_jupyter
# Batch processing with Argo Worfklows In this notebook we will dive into how you can run batch processing with Argo Workflows and Seldon Core. Dependencies: * Seldon core installed as per the docs with an ingress * Minio running in your cluster to use as local (s3) object storage * Argo Workfklows installed in clus...
github_jupyter
# Transformer Network Application: Named-Entity Recognition Welcome to Week 4's first ungraded lab. In this notebook you'll explore one application of the transformer architecture that you built in the previous assignment. **After this assignment you'll be able to**: * Use tokenizers and pre-trained models from the ...
github_jupyter
The tutorials use PyTorch. You will need to load the following dependencies. ``` # This specific version of torchvision is needed to download the mnist set !pip install torchvision==0.9.1 torch==1.8.0 import random import PIL import imageio import matplotlib.pyplot as plt import numpy as np import skimage.transform ...
github_jupyter
<a href="https://colab.research.google.com/github/NeuromatchAcademy/course-content/blob/master/tutorials/W2D1_BayesianStatistics/W2D1_Tutorial2.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Neuromatch Academy: Week 2, Day 1, Tutorial 1 # Causal ...
github_jupyter
## Compute a Monte Carlo integral for any specified function. ``` %matplotlib inline import numpy as np import matplotlib.pyplot as plt import math ``` Riofa-Gean Fernandez ID: 1396498 ``` N = 500 # Number of points a = 0 #x-axis min to replace b = 1.75 #x-axis max to replace def f(x): return np.cos(x) ...
github_jupyter
``` import pandas as pd import numpy as np import os import matplotlib.pylab as plt import seaborn as sns np.random.seed(500) types_names = {90:'Ia', 67: '91bg', 52:'Iax', 42:'II', 62:'Ibc', 95: 'SLSN', 15:'TDE', 64:'KN', 88:'AGN', 92:'RRL', 65:'M-dwarf', 16:'EB',53:'Mira', 6:'MicroL', 9...
github_jupyter
## PmodOLED Example ## Contents * [Introduction](#Introduction) * [Setup the board and PmodOLED](#Setup-the-board-and-PmodOLED,-and-load-the-overlay) * [Write to the PmodOLED](#Write-to-the-PmodOLED) * [Draw some patterns](#Draw-some-patterns) * [Create a new Python function](#Create-a-new-Python-function) * [Putting...
github_jupyter
# A Brief Intro to pydeck pydeck is made for visualizing data points in 2D or 3D maps. Specifically, it handles - rendering large (>1M points) data sets, like LIDAR point clouds or GPS pings - large-scale updates to data points, like plotting points with motion - making beautiful maps Under the hood, it's powered by...
github_jupyter
# Tutorial 4: Scattering calculations with Tully's models ``` import sys import cmath import math import os import time import h5py import matplotlib.pyplot as plt # plots import numpy as np #from matplotlib.mlab import griddata %matplotlib inline if sys.platform=="cygwin": from cyglibra_core import * elif sy...
github_jupyter
``` import numpy as np import pandas as pd from sklearn.metrics import roc_auc_score import tensorflow as tf from sklearn.feature_extraction.text import CountVectorizer from keras.preprocessing.text import Tokenizer from keras.preprocessing.sequence import pad_sequences from keras.models import Sequential from keras....
github_jupyter
# Training fine flow prediction Assuming source image $I_s$ and target image $I_t$ are already coarsely aligned, this notebook will try to predict a fine flow $F_{s\rightarrow t}$ between them. TODO describe objective functions used in this project ``` %load_ext autoreload %autoreload 2 ``` We assume you already ha...
github_jupyter
# Model-Based RL In this exercise you will implement a policy and model network which work in tandem to solve the CartPole reinforcement learning problem. What is a model and why would we want to use one? In this case, a model is going to be a neural network that attempts to learn the dynamics of the real environment....
github_jupyter
<a href="https://colab.research.google.com/github/forest1988/colaboratory/blob/main/prophetnet_seq2seqtrainer.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import torch torch.__version__ !git clone https://github.com/huggingface/transformers.g...
github_jupyter
# Classification of quantum states with high dimensional entanglement ## Circuits and computations Version compatible with 1st and 2d pilot studies ``` import numpy as np import copy from qiskit import QuantumRegister, QuantumCircuit, ClassicalRegister, Aer, execute, transpile, assemble from qiskit.tools.visualizatio...
github_jupyter
# The Quarterly Japanese Economic Model (Q-JEM) This workbook implement the "The Quarterly Japanese Economic Model (Q-JEM): 2019 version". At http://www.boj.or.jp/en/research/wps_rev/wps_2019/wp19e07.htm/ you will find the working paper describing the model and a zipfile containing all the relevant information neede...
github_jupyter
<a href="https://colab.research.google.com/github/madhavjk/cricket_analytics/blob/main/Impact_of_toss.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # IMPACT OF TOSS ON OUTCOME OF A MATCH <br>In this notebook, we will be analysing the impact of to...
github_jupyter
# Temporal Difference: On-policy n-Tuple Expected Sarsa, Stochastic ``` import numpy as np ``` ## Create environment ``` def create_environment_states(): """Creates environment states. Returns: num_states: int, number of states. num_terminal_states: int, number of terminal states. nu...
github_jupyter
This is an example showing the prediction latency of various scikit-learn estimators. The goal is to measure the latency one can expect when doing predictions either in bulk or atomic (i.e. one by one) mode. The plots represent the distribution of the prediction latency as a boxplot. #### New to Plotly? Plotly's Pyt...
github_jupyter
# Better Long-Term Stock Forecasts by [Magnus Erik Hvass Pedersen](http://www.hvass-labs.org/) / [GitHub](https://github.com/Hvass-Labs/FinanceOps) / [Videos on YouTube](https://www.youtube.com/playlist?list=PL9Hr9sNUjfsmlHaWuVxIA0pKL1yjryR0Z) ## Introduction The [previous paper](https://github.com/Hvass-Labs/Financ...
github_jupyter
``` %load_ext autoreload %autoreload 2 %aimport utils_1_1 import pandas as pd import numpy as np import altair as alt from altair_saver import save import datetime import dateutil.parser from os.path import join from constants_1_1 import SITE_FILE_TYPES from utils_1_1 import ( read_loinc_df, get_site_file_pat...
github_jupyter
# PASTIS matrix from E-fields This notebook calculates PASTIS matrices for the low, mid, and high order modes from single-mode E-fields in the focal plane. It also calculates matrices on the low order wavefront sensor (LOWFS) and out of band wavefront sensor (OBWFS). ``` import os import time from shutil import cop...
github_jupyter
# Image analysis with fMRI 3D images imported with LORIS API This is a tutorial to show how to use Loris' API to download MRI images. It also contains a few examples of how the data can be used to run basic data analysis. This tutorial is also available as a Google colab notebook so you can run it directly from your...
github_jupyter
# Checking stimuli for balance This notebook helps to ensure that the generated stimuli are roughly balanced between positive and negative trials. ``` import os import numpy as np from PIL import Image import pandas as pd import json import pymongo as pm from glob import glob from IPython.display import clear_output i...
github_jupyter
<a href="https://colab.research.google.com/github/zahraDehghanian97/Poetry_Generator/blob/master/Word_Poem_generator.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import tensorflow as tf from tensorflow import keras import numpy as np import p...
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
# 第0章 そもそも量子コンピュータとは? 近年、マスコミでも「量子コンピュータ」というワードを耳にすることが多い。「名前だけは聞いたことあるけど、どんなものかはよくわからない…」そんな方のために、この章では、量子コンピュータの概要を説明する。 (なお、「量子」コンピュータの業界では、現在のコンピュータを「古典」コンピュータと呼んでおり、Qunatum Native Dojoでもそれに従う。) ## 量子コンピュータというアイディア 量子コンピュータのアイディア自体は古く、エッセイ「ご冗談でしょう、ファインマンさん」でも有名な物理学者リチャード・ファインマンが、1982年に「自然をシミュレーションしたければ、量子力学の原理...
github_jupyter
``` # #colabを使う方はこちらを使用ください。 # !pip install torch==0.4.1 # !pip install torchvision==0.2.1 # !pip install numpy==1.14.6 # !pip install matplotlib==2.1.2 # !pip install pillow==5.0.0 # !pip install opencv-python==3.4.3.18 # !pip install torchtext==0.3.1 import torch import torch.nn as nn import torch.nn.init as init imp...
github_jupyter
# Top coding, bottom coding and zero coding ## Outliers An outlier is a data point which is significantly different from the remaining data. “An outlier is an observation which deviates so much from the other observations as to arouse suspicions that it was generated by a different mechanism.” [D. Hawkins. Identifica...
github_jupyter
``` import numpy as np import pandas as pd from matplotlib import pyplot as plt titanic = pd.read_csv('./titanic.csv') titanic.head(3) ``` ## Summary statistics ### Summarizing numerical data - .mean() - .median() - .min() - .maxx() - .var() - .std() - .sum() - .quantile() ``` titanic['Age'].mean() titanic['Age'].mo...
github_jupyter
<a href="https://colab.research.google.com/github/u-masao/YutaroOgawa_pytorch_advanced/blob/master/1_image_classification/1-3_transfer_learning.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # はじめに 『つくりながら学ぶ! PyTorchによる発展ディープラーニング』 のサンプルコードを Googl...
github_jupyter
# EnKF Assumption Experiments ### Keiran Suchak Assumptions to test: * Normality of prior * Normality of likelihood * Subsequent normality of posterior This notebook will make use of the `multivariate_normality()` function from the `pingouin` package to perform multidimensional normality tests. ## Imports ``` impo...
github_jupyter
# BHPToolkit Spring 2020 Workshop: EMRISur1dq1e4 Proejct Tutorial Some portions of this notebook are also found in the notebook [EMRISur1dq1e4.ipynb](https://github.com/BlackHolePerturbationToolkit/EMRISurrogate/blob/master/EMRISur1dq1e4.ipynb). The waveform model is described in [arXiv:1910.10473](https://arxiv.org/a...
github_jupyter
# What’s New In Python 3.10 > **See also:** > > * [What’s New In Python 3.10](https://docs.python.org/3.10/whatsnew/3.10.html) ``` import sys assert sys.version_info[:2] >= (3, 10) ``` ## Better error messages ### Syntax Errors * When parsing code that contains unclosed parentheses or brackets the interpreter now...
github_jupyter
##### Copyright 2018 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
<a href="https://colab.research.google.com/github/krmiddlebrook/intro_to_deep_learning/blob/master/machine_learning/lesson%202%20-%20logistic%20regression/challenges/logistic-regression-pokemon.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Logis...
github_jupyter
``` #necessary imports import numpy as np import scipy from scipy.special import gamma, factorial import scipy.special as sc import mpmath as mp import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D #for 3D surface plots import math from cmath import phase from scipy.ndimage.filters import gaussian_f...
github_jupyter
## IBM Quantum Challenge Fall 2021 # Challenge 2: OLED 분자들의 밴드갭 계산 <div id='problem'></div> <div class="alert alert-block alert-info"> 최고의 경험을 위해 오른쪽 상단의 계정 메뉴에서 **light** 워크스페이스 테마로 전환하는 것을 추천합니다. ## 소개 유기 발광 다이오드(Organic Light Emitting Diode) 또는 OLED는 전류를 인가하면 빛을 내는, 얇고 유연한 TV 및 휴대폰 디스플레이 제조의 기초 소자로 최근 몇 년 동안...
github_jupyter
``` import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.utils.data import DataLoader from torch.utils.data import sampler import skorch import torchvision.datasets as dset import torchvision.transforms as T import torchvision.models as models import collections fro...
github_jupyter
# Tutorial: Computing with shapes of landmarks in Kendall shape spaces Lead author: Nina Miolane. In this tutorial, we show how to use geomstats to perform a shape data analysis. Specifically, we aim to study the difference between two groups of data: - optical nerve heads that correspond to normal eyes, - optical ne...
github_jupyter