text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
``` ## Python for Earth Scientists: Lesson 5 # Run this cell in order to create the variables below. These variables will be used in the # lesson. If for any reason you change one of these variables by mistake, you can re-run # this cell in order to reset the variables. We will refer to this cell as the "first variable...
github_jupyter
# Experiment Background In computing, the least significant bit(LSB) is the bit position in a binary integer giving the units value, that is, determining whether the number is even or odd. The LSB is sometimes referred to as the right-most bit, due to the convention in positional notation of writing less significant...
github_jupyter
# Machine Learning Housing Corp This is an End to End project to practice concepts of Machine Learning over the Californina Housing Proect. The format followed is in sync with the Chapter 2 of Hands on Machine Learning with Scikt-Learn & TensorFlow. This is a practice hands-on proect ## Setup Setting up project dir...
github_jupyter
``` import pandas as pd import numpy as np pd.set_option('display.max_rows', 500) pd.set_option('display.max_columns', 500) historical_costs = pd.read_csv('/Users/b1017579/Documents/PhD/Projects/10. ELECSIM/data/raw/power_plants_costs/historical_costs/historical_data_for_costs.csv') historical_costs = pd.read_csv('/Use...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt import MorseGen morse_gen = MorseGen.Morse() Fs = 8000 samples_per_dit = morse_gen.nb_samples_per_dit(Fs, 13) phrase = "VVV DE F4EXB VVV DE F4EXB VVV DE F4EXB VVV DE F4EXB VVV DE F4EXB VVV DE F4EXB VVV DE F4EXB VVV DE F4EXB VVV DE F4EXB VVV DE F4EXB VVV DE F4EXB "...
github_jupyter
``` %matplotlib inline import gym import math import random import numpy as np import matplotlib import matplotlib.pyplot as plt from collections import namedtuple from itertools import count from PIL import Image import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F import torc...
github_jupyter
# Climate modeling with Keras This notebook illustrates the process of creating simple neural network models using the Keras framework, processing data for input to the models for training and prediction, using a scikit-learn Pipeline, and the use of numpy and xarray for data wrangling and I/O with datasets contained w...
github_jupyter
# Extending ImageJ: Ops This notebook illustrates how to create new `Op` plugins, and run them with ImageJ's `OpService`. The plugins are in Groovy cells, but coded in Java style. ``` #@ImageJ ij // Behind a firewall? Configure your proxy settings here. //System.setProperty("http.proxyHost","myproxy.domain") //Syst...
github_jupyter
# Automatic Patent Classification ``` import os import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap plt.style.use("classic") sns.set() from time import time ``` ## Pre-processing... ### Importing data into pandas.DataFrame ``` ###...
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
``` import numpy as np import pandas as pd pd.set_option('float_format', '{:.2f}'.format) # leave out the last line to display the default decimal points df = pd.read_csv('./course-data/tips.csv') df.head() # we want to grad the last in number of digits of the 'CC Number' # problem int object in not subscriptable, i.e....
github_jupyter
# INTRODUCTION NYC has long struggled with public schools meeting state and federal expectations (New York Times, 2019). The state is consistently having to close schools that are not meeting state standards. Using the results from this research teachers, educators, policy makers, etc. will have a starting point to i...
github_jupyter
# Final Project - TicTacToe ## Exercise 1 Open the file `tictactoe.py`. Look for the method `get_row_col_from_pixels`. On this exercise you will need to implement this method. The expected behavior is described on the method docstring. If you have some doubts, please refer to the Learning Notebook, you have a section ...
github_jupyter
# File I/O So far we discussed how to process data, how to build, train and test deep learning models. However, at some point we are likely happy with what we obtained and we want to save the results for later use and distribution. Likewise, when running a long training process it is best practice to save intermediate...
github_jupyter
## Run TCAV with Keras with code from https://gist.github.com/Gareth001/e600d2fbc09e690c4333388ec5f06587 ``` tcav = None from keras.applications.inception_v3 import InceptionV3 from keras.applications.inception_v3 import decode_predictions from keras.models import Model, load_model import keras.backend as K import m...
github_jupyter
``` %env CUDA_VISIBLE_DEVICES=1 import os import numpy as np import matplotlib.pyplot as plt import cv2 from PIL import Image import tensorflow as tf from tensorflow.keras.models import Model,Sequential, load_model,model_from_json %matplotlib inline from tensorflow.compat.v1.keras.backend import set_session config = ...
github_jupyter
# T81-558: Applications of Deep Neural Networks **Module 13: Advanced/Other Topics** * Instructor: [Jeff Heaton](https://sites.wustl.edu/jeffheaton/), McKelvey School of Engineering, [Washington University in St. Louis](https://engineering.wustl.edu/Programs/Pages/default.aspx) * For more information visit the [class w...
github_jupyter
# Setup Once we have a virtual environment set up with ```conda create --name ghostipy python=3.6```, we can install the relevant packages: 1. ```pip install nelpy``` 2. ```pip install ghostipy``` ``` import nelpy as nel import ghostipy as gsp import numpy as np import h5py as h5 import tqdm import scipy.signal as si...
github_jupyter
# Exercise Notebook (DS) ` Make sure to finish DAY-4 of WEEK-1 before continuing here!!!` ``` # this code conceals irrelevant warning messages import warnings warnings.simplefilter('ignore', FutureWarning) ``` ## Exercise 1: Numpy ### Numpy NumPy, which stands for Numerical Python, is a library consisting of mult...
github_jupyter
# Image Analysis for datasets This example notebook shows how to use datasetinsights to do image analysis on datasets ## Variance of Laplacian ``` import seaborn as sns import matplotlib.pyplot as plt from tqdm import tqdm import numpy as np import os from pycocotools.coco import COCO from datasetinsights.stats.imag...
github_jupyter
<table class="ee-notebook-buttons" align="left"> <td><a target="_blank" href="https://github.com/giswqs/earthengine-py-notebooks/tree/master/Datasets/Terrain/alos_global_dsm.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td> <td><a target="_bla...
github_jupyter
# In Depth: Linear Regression ``` %matplotlib inline import matplotlib.pyplot as plt import seaborn as sns; sns.set() import numpy as np rng = np.random.RandomState(1) x = 10 * rng.rand(50) y = 2 * x - 5 + rng.randn(50) plt.scatter(x, y); from sklearn.linear_model import LinearRegression model = LinearRegression(fit_i...
github_jupyter
``` import syft as sy import torch as th ``` # Step 0: Local data science (pre-Duet Work) do some local data science experiments with local data sets and models - prep and clean small dataset (some kind of processing pipeline => chain of pure functions / transformations usually) - try a few different models classes ...
github_jupyter
``` from collections import defaultdict import re import pandas as pd with open('inputs/input20_test.txt') as f: example_tiles = f.read().strip().split('\n\n') with open('inputs/input20.txt') as f: real_tiles = f.read().strip().split('\n\n') len(real_tiles) # returns a list of 2 dicts: edge adjacencies, a...
github_jupyter
``` import pandas as pd import matplotlib.pyplot as plt import numpy as np from wordcloud import WordCloud, STOPWORDS import nltk nltk.download('stopwords') from nltk.corpus import stopwords from collections import Counter, OrderedDict df = pd.read_csv('cvpr_2019_poster.csv') df.shape df.head(10) df['Primary Subject A...
github_jupyter
``` import os import gym import time import pickle import matplotlib.pyplot as plt import numpy as np import ppaquette_gym_doom # Create a classic Doom environment with Gym env = gym.make('ppaquette/DoomDefendCenter-v0') # Computer vision utils %matplotlib inline from PIL import Image from scipy.stats import threshold ...
github_jupyter
Monthly Nighttime Lights ene.004 https://ngdc.noaa.gov/eog/viirs/download_dnb_composites.html Import libraries ``` # Libraries for downloading data from remote server (may be ftp) import requests from urllib.request import urlopen from contextlib import closing import shutil # Library for uploading/downloading data ...
github_jupyter
# 1. Introduction --- 1.1에는 우리가 보통 고급언어(high-level language)라고 부르는 언어들이 대략 어떤 부류가 있는지 컴퓨터 관련 학과에서 풍월로 들었을 만한 이야기를 소개한다. 범용(general-purpose) 프로그래밍 언어의 대표적인 4가지 유형은 명령형(imperative), 함수형(functional), 논리(logic), 객체지향(object-oriented)이다. 참고로 책의 1장에 굳이 언급되지 않았지만 사족을 달자면, 최근에는 두 가지 이상의 유형을 (특히 객체지향과 함수형을) 같이 잘 지원하겠다는 범용 프로그...
github_jupyter
``` import os import os.path import random import time import tensorflow as tf from IPython.display import HTML from tensorflow.python.platform import gfile from tensorflow.python.platform import tf_logging as logging from google.protobuf import text_format from syntaxnet.ops import gen_parser_ops from syntaxnet imp...
github_jupyter
# Dependency ``` !sudo /anaconda/envs/py35/bin/python -m pip install --upgrade pip !sudo /anaconda/envs/py35/bin/python -m pip install git+https://github.com/xiaoyongzhu/keras-contrib.git # may need to use this repo instead: https://github.com/xiaoyongzhu/keras-contrib.git !sudo /anaconda/envs/py35/bin/python -m pip i...
github_jupyter
# The Emitter-Detector Problem Think Bayes, Second Edition Copyright 2021 Allen B. Downey License: [Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)](https://creativecommons.org/licenses/by-nc-sa/4.0/) ``` # If we're running on Colab, install empiricaldist # https://pypi.org/project/empirica...
github_jupyter
# Using Our Margin-MSE trained Bert_Dot (or BERT Dense Retrieval) Checkpoint We provide a fully retrieval trained (with Margin-MSE using a 3 teacher Bert_Cat Ensemble on MSMARCO-Passage) DistilBert-based instance on the HuggingFace model hub here: https://huggingface.co/sebastian-hofstaetter/distilbert-dot-margin_ms...
github_jupyter
``` !nvidia-smi -L ###### from PIL import Image import imageio ###### from sklearn.model_selection import train_test_split ###### import torch import torch.nn as nn import torchvision.transforms as T import torchvision.transforms.functional as TF ###### from tqdm.notebook import tqdm import os ###### import time impor...
github_jupyter
``` import os os.environ['CUDA_VISIBLE_DEVICES'] = '1' import tensorflow as tf import json with open('pair.json') as fopen: data = json.load(fopen) class Model: def __init__(self, size_layer, num_layers, embedded_size, dict_size, learning_rate, dropout): def cells(size, reuse=F...
github_jupyter
# Random Forests Multi-node, Multi-GPU demo The experimental cuML multi-node, multi-GPU (MNMG) implementation of random forests leverages Dask to do embarrassingly-parallel model fitting. For a random forest with `N` trees being fit by `W` workers, each worker will build `N / W` trees. During inference, predictions fr...
github_jupyter
## Pré-processamento Na fase de criação do dataset uma parte do pré-processamento já foi feita, foi o passo de transformar todas as letras em minúsculas. Na fase atual, inicialmente, tivemos a ideia de remover as stopwords que englobam conectivos como conjunções (e, como, ou, ...). Caso fossem removidas os versos pode...
github_jupyter
# T026 · Kinase similarity: Interaction fingerprints **Note:** This talktorial is a part of TeachOpenCADD, a platform that aims to teach domain-specific skills and to provide pipeline templates as starting points for research projects. Authors: - Dominique Sydow, 2021, [Volkamer lab, Charité](https://volkamerlab.org...
github_jupyter
# Deploy the PowerSkill to Azure Search * The first step is to upload the data files in the data folder to a container in Azure blob storage and get the connection values to create the ACS data source. * You will need various properties, such as your [ACS API Key](https://docs.microsoft.com/en-us/azure/search/search-s...
github_jupyter
``` import sys import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from statistics import mean from sklearn.metrics import ndcg_score from typing import List, Tuple sys.path.append('..') from src.data import load_qa_format_source ls ../data/input/synthetic/ synthetic = load_qa_...
github_jupyter
# Meta-Labeling for bet side and size Implementation of Triple-barrier method for determining side and Meta-labeling for size of the bet. Meta-labeling is a technique introduced by Marco Lopez De Prado in Advances to Financial machine learning. ## Imports ``` %load_ext autoreload %autoreload 2 # standard imports fr...
github_jupyter
# Booleans Python has a type of variable called `bool`. It has two possible values: `True` and `False`. ``` x = True print(x) print(type(x)) ``` Rather than putting `True` or `False` directly in our code, we usually get boolean values from **boolean operators**. These are operators that answer yes/no questions. We'l...
github_jupyter
# Text classification process using Toloka running at Prefect Toloka offers a library of Prefect-integrated functions to facilitate crowdsourcing. This example illustrates how one can build the whole project using these blocks. This library provide Prefect tasks for Toloka. You can connect tasks by passing one task's...
github_jupyter
``` import numpy as np import cv2 as cv import pandas as pd from sklearn.cluster import KMeans, k_means from scipy.optimize import linear_sum_assignment from scipy.spatial import distance_matrix from os.path import join from itertools import count from functools import partial import matplotlib.pyplot as plt def con...
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
``` import os import pandas as pd import caselawnet # imports inputpath = '/media/sf_VBox_Shared/CaseLaw/graphs/lido/' cases = pd.read_csv(os.path.join(inputpath, 'hr_enriched_nodes_2.csv')) case_to_leg = pd.read_csv(os.path.join(inputpath, 'hr_simple_legislation_links.csv')) cases_links = pd.read_csv(os.path.join(inpu...
github_jupyter
# How to write a training loop in Chainer In this tutorial section, we will learn how to train a deep neural network to classify images of hand-written digits in the popular MNIST dataset. This dataset contains 50,000 training examples and 10,000 test examples. Each example is a set of a 28 x 28 greyscale image and a ...
github_jupyter
``` import numpy as np import pandas as pd from matplotlib import pyplot as plt import math as m %matplotlib inline import torch import torchvision import torchvision.transforms as transforms import torch.nn as nn import torch.optim as optim import torch.nn.functional as F import random from torch.utils.data import...
github_jupyter
## Dependencies ``` import os import sys import cv2 import shutil import random import warnings import numpy as np import pandas as pd import seaborn as sns import multiprocessing as mp import matplotlib.pyplot as plt from tensorflow import set_random_seed from sklearn.utils import class_weight from sklearn.model_sele...
github_jupyter
# BernoulliNB with MaxAbsScaler and PowerTransformer This code template is facilitates to solve the problem of classification problem using Bernoulli Naive Bayes Algorithm using MaxAbsScaler technique and PowerTransformer. ### Required Packages ``` import warnings import numpy as np import pandas as pd import matp...
github_jupyter
Some packages we'll need below - make sure you have them installed! If you use `conda`: conda install numpy matplotlib scikit-learn scipy astropy If you use `pip`: pip install numpy matplotlib scikit-learn scipy astropy ``` import astropy.coordinates as coord from astropy.table import Table import astropy...
github_jupyter
# GPU ``` gpu_info = !nvidia-smi gpu_info = '\n'.join(gpu_info) print(gpu_info) ``` # CFG ``` CONFIG_NAME = 'config31.yml' debug = False from google.colab import drive, auth # ドライブのマウント drive.mount('/content/drive') # Google Cloudの権限設定 auth.authenticate_user() def get_github_secret(): import json ...
github_jupyter
``` import os os.environ['CUDA_VISIBLE_DEVICES']='0' from deoldify.visualize import * plt.style.use('dark_background') #Adjust render_factor (int) if image doesn't look quite right (max 64 on 11GB GPU). The default here works for most photos. #It literally just is a number multiplied by 16 to get the square render r...
github_jupyter
``` import json #raw data from Andy actor_code ={ "IGO" : "International inter-governmental organization", "IMG" : "International Militarized Group", "INT" : "International or transnational actors who cannot be further specified", "MNC" : "Multi-national corporations", "NGM" : "Non-governmental movements", "NGO" :...
github_jupyter
# IMDB This notebook was adopted from the Fast.ai github repository: https://github.com/fastai/course-v3 on 11/4/2019. Licensed under the Apache Version 2.0 https://github.com/fastai/course-v3/blob/master/LICENSE ``` %reload_ext autoreload %autoreload 2 %matplotlib inline from fastai.text import * ``` ## Preparing...
github_jupyter
# <center> Creación de Complex class en Python <center> <center> John Erick Cabrera Ramirez <center> ## Ejemplo inicial: ``` import numpy as np # import inspect # import threading # from threading import Thread class Persona: def __init__(self,nombre,apellido):#Definimos atributos de la clase self.nombre...
github_jupyter
<img alt="QuantRocket logo" src="https://www.quantrocket.com/assets/img/notebook-header-logo.png"> © Copyright Quantopian Inc.<br> © Modifications Copyright QuantRocket LLC<br> Licensed under the [Creative Commons Attribution 4.0](https://creativecommons.org/licenses/by/4.0/legalcode). <a href="https://www.quantrocke...
github_jupyter
``` import tensorflow as tf import pandas as pd import numpy as np from sklearn.model_selection import train_test_split from sklearn.preprocessing import RobustScaler import matplotlib.pyplot as plt import time import os import pickle os.listdir('./Data/TestData/Test13Feb') with open('./ScalersFromTraining/ScalerX.pkl'...
github_jupyter
<p style="font-family: Arial; font-size:3.75em;color:purple; font-style:bold"><br> Introduction to numpy: </p><br> <p style="font-family: Arial; font-size:1.25em;color:#2462C0; font-style:bold"><br> Package for scientific computing with Python </p><br> Numerical Python, or "Numpy" for short, is a foundational package...
github_jupyter
# Prelab: An introduction to the tidyverse In this module, we will be learning the basics of a cluster of R packages collectively known as the ["tidyverse"](https://www.tidyverse.org/). This is a set of tools that makes data manipulation and visualization in R easier and more flexible than in the basic R language. Spe...
github_jupyter
# Numbers, Strings, and Lists Python supports a number of built-in types and operations. This section covers the most common types, but information about additional types is available [here](https://docs.python.org/3/library/stdtypes.html). ## Basic numeric types The basic data numeric types are similar to those fou...
github_jupyter
# ONNX Runtime: Tutorial for TVM execution provider This notebook shows a simple example for model inference with TVM EP. #### Tutorial Roadmap: 1. Prerequistes 2. Accuracy check for TVM EP 3. Configuration options ## 1. Prerequistes Make sure that you have installed all the necessary dependencies described in the...
github_jupyter
# Patient Online - Geographic Analysis #### Developed by: Mary Amanuel #### Contact: mary.amanuel@nhsx.nhs.uk #### Last Updated: 25th September 2021 ``` import pandas as pd import os import plotly import plotly.graph_objects as go import plotly.express as px import plotly.offline as pyo import numpy as np import datet...
github_jupyter
#### New to Plotly? Plotly's Python library is free and open source! [Get started](https://plot.ly/python/getting-started/) by dowloading the client and [reading the primer](https://plot.ly/python/getting-started/). <br>You can set up Plotly to work in [online](https://plot.ly/python/getting-started/#initialization-for...
github_jupyter
<a href="https://colab.research.google.com/github/felipeescallon/MIT6S191/blob/main/Lab3/Copia_de_RL.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> <table align="center"> <td align="center"><a target="_blank" href="http://introtodeeplearning.com"...
github_jupyter
論文 https://arxiv.org/abs/2101.02702v2 GitHub https://github.com/timmeinhardt/trackformer <a href="https://colab.research.google.com/github/kaz12tech/ai_demos/blob/master/TrackFormer_demo.ipynb" target="_blank"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> #...
github_jupyter
``` from collections import namedtuple import csv import matplotlib.pyplot as plt %matplotlib inline tableau20 = [(31, 119, 180), (174, 199, 232), (255, 127, 14), (255, 187, 120), (44, 160, 44), (152, 223, 138), (214, 39, 40), (255, 152, 150), (148, 103, 189), (197, 176, 213), (140, 86...
github_jupyter
``` #Simulation of leaky Integrate-and-fire neuron %matplotlib inline import numpy as np import matplotlib.pyplot as plt import ipywidgets as widgets def ext_change(riext=15): # parameters of the model dt=0.1 #integration time step [ms] tau=10 #time constant [ms] E_L=-65 #resting potentia...
github_jupyter
``` import tensorflow as tf import tsp_env import numpy as np import itertools import Q_function_graph_model import matplotlib.pyplot as plt %matplotlib inline n_cities = 5 T = 4 n_mlp_layers = 2 p = 64 n_dagger_steps = 10; max_steps_per_rollout = 10; n_rollouts = 50; n_gradient_steps = 20 learning_rate = 1e-2 obs_ph ...
github_jupyter
# Simulating DESI Spectra The goal of this notebook is to demonstrate how to generate some simple DESI spectra using the `quickgen` utility. For simplicity we will only generate 1D spectra and skip the more computationally intensive (yet still instructive!) step of extracting 1D spectra from simulated 2D spectra (i.e...
github_jupyter
# Un Bloc Note pour expérimenter MicroPython sur BBC micro:bit > Tout est dans le titre, il s'agit ici de découvrir l'ordinateur à carte unique (SBC, Single Board Computer) qu'est le BBC micro:bit et sa programmation en MicroPython, une adaptation de Python3 pour la programmation de certains microcontrôleurs... > Mai...
github_jupyter
# Generating simplified geometries for administrative boundaries This Jupyter notebook can be used to generate simplified geometries of administrative areas. **Click on the cell below and click on "Run" to import the necessary libraries.** ``` from functools import partial import math from descartes.patch import Pol...
github_jupyter
# A simple Moon tracker based on mask-RCNN ``` from google.colab import drive drive.mount('/content/drive/') ``` #### Customized by : Praveen Vijayan #### Inspired from : https://towardsdatascience.com/object-detection-using-mask-r-cnn...
github_jupyter
``` from keras.models import Sequential from keras.layers import Dense from keras import regularizers from keras.optimizers import Adam, RMSprop from loss import cemse_loss from keras import losses import numpy as np import tensorflow as tf import matplotlib.pyplot as plt custom_loss = cemse_loss() model = Sequential...
github_jupyter
# Problem 2 - Search in a Rotated Sorted Array ``` def rotated_array_search(input_list, number): """ Find the index by searching in a rotated sorted array Args: input_list(array), number(int): Input array to search and the target Returns: int: Index or -1 """ if not input_li...
github_jupyter
**Chapter 1 – The Machine Learning landscape** **机器学习概览** _This is the code used to generate some of the figures in chapter 1. 这是生成第一章某些图表的代码 # Setup # 设置 First, let's make sure this notebook works well in both python 2 and 3, import a few common modules, ensure MatplotLib plots figures inline and prepare a functi...
github_jupyter
# Parts of Speech Assessment For this assessment we'll be using the short story [The Tale of Peter Rabbit](https://en.wikipedia.org/wiki/The_Tale_of_Peter_Rabbit) by Beatrix Potter (1902). <br>The story is in the public domain; the text file was obtained from [Project Gutenberg](https://www.gutenberg.org/ebooks/14838....
github_jupyter
``` # Environnement de Kaggle qui permet de ne pas utiliser le cpu et la ram de notre machine et qui a deja plusieurs librairies pre-installés import numpy as np import pandas as pd import tensorflow as tf import cv2 import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split from tensorflow...
github_jupyter
**Chapter 18 – Reinforcement Learning** _This notebook contains all the sample code and solutions to the exercises in chapter 18._ <table align="left"> <td> <a href="https://colab.research.google.com/github/ageron/handson-ml3/blob/main/18_reinforcement_learning.ipynb" target="_parent"><img src="https://colab.re...
github_jupyter
# Assignment 1 - TD with State Aggregation Welcome to your Course 3 Programming Assignment 1. In this assignment, you will implement **semi-gradient TD(0) with State Aggregation** in an environment with a large state space. This assignment will focus on the **policy evaluation task** (prediction problem) where the goa...
github_jupyter
# seq2seq模型测试 --- 数据集构建方案不同,使用更复杂的模型。 ``` import os import re from tqdm import tqdm import sys import random import pprint import torch import torch.nn as nn sys.path.insert(0, "/home/team55/notespace/zengbin") import jddc.utils as u import jddc.datasets as d from seq2seq.fields import * from seq2seq.optim import ...
github_jupyter
# Brewery Review NLP Workbook The purpose of this notebook is to discover and demonstrate the NLP pipeline we will use to process brewery reviews into short phrases. ## Examples from Google Maps * Mike Hess Brewing, North Park - Modern, family-friendly hangout featuring a tasting room, board games & brewery views. *...
github_jupyter
## Technical TASK 1 :- Prediction using Supervised ML In this task, we will predict the percentage of marks that a student is expected to score based upon the number of hours they studied. This is a simple linear regression task as it involves just two variables. #### Task Completed for The Sparks Foundation Internship...
github_jupyter
# Object Detection: People, Bikes, and Cars Below we will do the following: 1. Load images of cars, bikes and people and their corresponding bounding boxes. 2. Build an object detection model for identifying the location of cars, bikes and people in images. 3. Convert the model to CoreML and upload it to Skafos. The e...
github_jupyter
# Image features exercise *Complete and hand in this completed worksheet (including its outputs and any supporting code outside of the worksheet) with your assignment submission. For more details see the [assignments page](http://vision.stanford.edu/teaching/cs231n/assignments.html) on the course website.* We have see...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt import sys sys.path.append("../") from IntegratedGradients import * import keras keras.__version__ ``` # Using UCI Iris data ``` X = np.array([[float(j) for j in i.rstrip().split(",")[:-1]] for i in open("iris.data").readlines()][:-1]) Y = np.array([0 for i in r...
github_jupyter
# High-level Theano + Lasagne Example ``` %%writefile ~/.theanorc [global] device = cuda0 force_device= True floatX = float32 warn_float64 = warn import numpy as np import os import sys import theano.tensor as T import theano import lasagne import lasagne.layers as L import lasagne.nonlinearities as nl import lasagne....
github_jupyter
# Splatoon2のシーン分析 ## モチベーション 録画を切り出す際の境界検出ができたらハッピー ``` import sys import os import shutil import random import tensorflow as tf import keras from keras import Sequential from keras.models import Model from keras.layers import Conv2D, MaxPooling2D, Input, Dense, GlobalAveragePooling2D from keras.preprocessing.image ...
github_jupyter
### Denoising Autoencoders And Where To Find Them (5 points) Today we're going to train deep autoencoders and deploy them to faces and search for similar images. Our new test subjects are human faces from the [lfw dataset](http://vis-www.cs.umass.edu/lfw/). ``` import numpy as np from lfw_dataset import fetch_lfw_da...
github_jupyter
# Programming Exercise 5: # Regularized Linear Regression and Bias vs Variance ## Introduction In this exercise, you will implement regularized linear regression and use it to study models with different bias-variance properties. Before starting on the programming exercise, we strongly recommend watching the video le...
github_jupyter
# BST in PyTorch > BST Model Implementation in PyTorch. Main purpose is to get familier with BST model, so only code is available upto trainer module. Inference and dataset runs will be added in future possibly. ### Imports ``` import random import numpy as np import time import torch from torch import nn ``` ### ...
github_jupyter
Steane code encoding fault tolerance =============================== 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 fault tolerance a...
github_jupyter
# DAG Creation and Submission Launch this tutorial in a Jupyter Notebook on Binder: [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/htcondor/htcondor-python-bindings-tutorials/master?urlpath=lab/tree/DAG-Creation-And-Submission.ipynb) In this tutorial, we will learn how to use `htcondor.d...
github_jupyter
# DEMetropolis(Z): Population vs. History efficiency comparison The idea behind `DEMetropolis` is quite simple: Over time, a population of MCMC chains converges to the posterior, therefore the population can be used to inform joint proposals. But just like the most recent positions of an entire population converges, so...
github_jupyter
The best argument against Anova is to show how the analysis will look like if we used parameter estimation instead. With complex experimental design this means that we will use regression. Most psychologists think of linear regression. However, the approach extends to general linear models of the sort $y=f(b_0+b_1\cdot...
github_jupyter
# Soccerstats Predictions v0.4 The changelog from v0.3: * Try to implement the gradient-boosted-tree model. * Try to tune the gradient-boosted-tree model hyper-parameters. ## A. Data Cleaning & Preparation ### 1. Read csv file ``` # load and cache data stat_df = sqlContext.read\ .format("com.databricks.spark.cs...
github_jupyter
<a href="https://colab.research.google.com/github/google-research/tapas/blob/master/notebooks/sqa_predictions.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ##### Copyright 2020 The Google AI Language Team Authors Licensed under the Apache License...
github_jupyter
``` def permutations(input): """Generate all the permutations of the characters of the given input""" def permute(chars): if len(chars) == 0: return '' if len(chars) == 1: return chars[0] bigset = set() for index in range(len(chars)): popped = ...
github_jupyter
## Flood frequency analysis Here we apply concepts learned in the previous two notebooks (importing and exploring data) to a specific task, namely computing flood frequency at out gage site. This process involves the following sub-tasks: * Grouping data by water year and computing annual peak flow * Computing return in...
github_jupyter
# Smart signatures #### 06.1 Writing Smart Contracts ##### Peter Gruber (peter.gruber@usi.ch) 2022-01-12 * Write and deploy smart Signatures ## Setup See notebook 04.1, the lines below will always automatically load functions in `algo_util.py`, the five accounts and the Purestake credentials ``` # Loading shared cod...
github_jupyter
<style>div.container { width: 100% }</style> <img style="float:left; vertical-align:text-bottom;" height="65" width="172" src="../assets/holoviz-logo-unstacked.svg" /> <div style="float:right; vertical-align:text-bottom;"><h2>HoloViz overview</h2></div> <br><br> This notebook is intended to present an overview of Hol...
github_jupyter