text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
# CNTK 201A Part A: CIFAR-10 Data Loader This tutorial will show how to prepare image data sets for use with deep learning algorithms in CNTK. The CIFAR-10 dataset (http://www.cs.toronto.edu/~kriz/cifar.html) is a popular dataset for image classification, collected by Alex Krizhevsky, Vinod Nair, and Geoffrey Hinton. ...
github_jupyter
``` #|hide #|skip ! [ -e /content ] && pip install -Uqq fastai # upgrade fastai on colab ``` # Tabular training > How to use the tabular application in fastai To illustrate the tabular application, we will use the example of the [Adult dataset](https://archive.ics.uci.edu/ml/datasets/Adult) where we have to predict...
github_jupyter
# Enron email data set exploration ``` # Get better looking pictures %config InlineBackend.figure_format = 'retina' df = pd.read_feather('enron.feather') df = df.sort_values(['Date']) df.tail(5) ``` ## Email traffic over time Group the data set by `Date` and `MailID`, which will get you an index that collects all of...
github_jupyter
# ONNX Runtime: Tutorial for STVM execution provider This notebook shows a simple example for model inference with STVM EP. #### Tutorial Roadmap: 1. Prerequistes 2. Accuracy check for STVM EP 3. Configuration options ## 1. Prerequistes Make sure that you have installed all the necessary dependencies described in ...
github_jupyter
# Wave (.wav) to Zero Crossing. This is an attempt to produce synthetic ZC (Zero Crossing) from FS (Full Scan) files. All parts are calculated in the time domain to mimic true ZC. FFT is not used (maybe with the exception of the internal implementation of the Butterworth filter). Current status: Seems to work well fo...
github_jupyter
# Binned Likelihood Tutorial The detection, flux determination, and spectral modeling of Fermi LAT sources is accomplished by a maximum likelihood optimization technique as described in the [Cicerone](https://fermi.gsfc.nasa.gov/ssc/data/analysis/documentation/Cicerone/Cicerone_Likelihood/) (see also, e.g., [Abdo, A. ...
github_jupyter
``` from collections import Counter import numpy as np from csv import DictReader from keras.preprocessing.sequence import pad_sequences from keras.utils import np_utils from keras.models import Sequential, Model, load_model from keras.layers import concatenate, Embedding, Dense, Dropout, Activation, LSTM, CuDNNLSTM, C...
github_jupyter
``` ##### Copyright 2021 The Cirq Developers #@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 agree...
github_jupyter
<i>Copyright (c) Microsoft Corporation. All rights reserved.</i> <i>Licensed under the MIT License.</i> # Hard Negative Sampling for Object Detection You built an object detection model, evaluated it on a test set, and are happy with its accuracy. Now you deploy the model in a real-world application and you may find...
github_jupyter
``` import os os.environ['CUDA_VISIBLE_DEVICES'] = '' os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = 'prepare/mesolitica-tpu.json' b2_application_key_id = os.environ['b2_application_key_id'] b2_application_key = os.environ['b2_application_key'] from google.cloud import storage client = storage.Client() bucket = client...
github_jupyter
<a href="https://colab.research.google.com/github/cxbxmxcx/EatNoEat/blob/master/Chapter_9_Build_Nutritionist.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> Imports ``` import tensorflow as tf import matplotlib.pyplot as plt import numpy as np imp...
github_jupyter
#Build a regression model: Get started with R and Tidymodels for regression models ## Introduction to Regression - Lesson 1 #### Putting it into perspective ✅ There are many types of regression methods, and which one you pick depends on the answer you're looking for. If you want to predict the probable height for a ...
github_jupyter
``` # Code based on souce from https://machinelearningmastery.com/how-to-develop-a-pix2pix-gan-for-image-to-image-translation/ # Required imports for dataset import, preprocessing and compression """ GAN analysis file. Takes in trained .h5 files created while training the network. Generates test files from testing sy...
github_jupyter
# Load and preprocess 2012 data We will, over time, look over other years. Our current goal is to explore the features of a single year. --- ``` %pylab --no-import-all inline import pandas as pd ``` ## Load the data. --- If this fails, be sure that you've saved your own data in the prescribed location, then retry...
github_jupyter
# Molecular Hydrogen H<sub>2</sub> Ground State Figure 7.1 from Chapter 7 of *Interstellar and Intergalactic Medium* by Ryden & Pogge, 2021, Cambridge University Press. Plot the ground state potential of the H<sub>2</sub> molecule (E vs R) and the bound vibration levels. Uses files with the H<sub>2</sub> potential ...
github_jupyter
``` %matplotlib inline import numpy as np import sygma import matplotlib.pyplot as plt from galaxy_analysis.plot.plot_styles import * import galaxy_analysis.utilities.convert_abundances as ca def plot_settings(): fsize = 21 rc('text',usetex=False) rc('font',size=fsize) return sygma.sygma? s = {} meta...
github_jupyter
``` import tensorflow as tf import numpy as np import keras import pandas as pd import matplotlib.pyplot as plt from sklearn.utils import shuffle import os import cv2 import random import keras.backend as K import sklearn from tensorflow.keras.models import Sequential, Model from tensorflow.keras.preprocessing.image im...
github_jupyter
# Reinterpreting Tensors Sometimes the data in tensors needs to be interpreted as if it had different type or shape. For example, reading a binary file into memory produces a flat tensor of byte-valued data, which the application code may want to interpret as an array of data of specific shape and possibly different t...
github_jupyter
<img src='./img/LogoWekeo_Copernicus_RGB_0.png' align='right' width='20%'></img> # Tutorial on basic land applications (data processing) Version 2 In this tutorial we will use the WEkEO Jupyterhub to access and analyse data from the Copernicus Sentinel-2 and products from the [Copernicus Land Monitoring Service (CLMS...
github_jupyter
``` import numpy as np import pandas as pd from pathlib import Path # visualization import matplotlib.pyplot as plt from wordcloud import WordCloud, STOPWORDS, ImageColorGenerator ``` ## Read and clean datasets ``` def clean_Cohen_datasets(path): """Read local raw datasets and clean them""" # read datas...
github_jupyter
``` %matplotlib inline import numpy as np import matplotlib.pyplot as plt from astropy.time import Time import astropy.units as u from rms import Planet times, spotted_lc, spotless_lc = np.loadtxt('ring.txt', unpack=True) d = Planet(per=4.049959, inc=90, a=39.68, t0=0, rp=(0.3566/100)**0.5, lam=0, ecc=0, w...
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
# Nonlinear Equations We want to find a root of the nonlinear function $f$ using different methods. 1. Bisection method 2. Newton method 3. Chord method 4. Secant method 5. Fixed point iterations ``` %matplotlib inline from numpy import * from matplotlib.pyplot import * import sympy as sym t = sym.symbols('t') f_sy...
github_jupyter
<center> <img src="https://cf-courses-data.s3.us.cloud-object-storage.appdomain.cloud/IBMDeveloperSkillsNetwork-PY0101EN-SkillsNetwork/IDSNlogo.png" width="300" alt="cognitiveclass.ai logo" /> </center> # **Exception Handling** Estimated time needed: **15** minutes ## Objectives After completing this lab you w...
github_jupyter
``` import matplotlib as mpl import matplotlib.pyplot as plt from agglio_lib import * #-------------------------------Data Generation section---------------------------# n = 1000 d = 50 sigma=0.5 w_radius = 10 wAst = np.random.randn(d,1) X = getData(0, 1, n, d)/np.sqrt(d) w0 =w_radius*np.random.randn(d,1)/np.sqrt(d) ip...
github_jupyter
Lambda School Data Science *Unit 2, Sprint 3, Module 2* --- # Permutation & Boosting You will use your portfolio project dataset for all assignments this sprint. ## Assignment Complete these tasks for your project, and document your work. - [ ] If you haven't completed assignment #1, please do so first. - [ ] C...
github_jupyter
``` from tsfresh.feature_extraction import extract_features from tsfresh.feature_extraction.settings import ComprehensiveFCParameters, MinimalFCParameters, EfficientFCParameters from tsfresh.feature_extraction.settings import from_columns import numpy as np import pandas as pd ``` This notebooks illustrates the `"fc_...
github_jupyter
## External Compton ![EC scheme](jetset_EC_scheme.png) ### Broad Line Region ``` import jetset print('tested on jetset',jetset.__version__) from jetset.jet_model import Jet my_jet=Jet(name='EC_example',electron_distribution='bkn',beaming_expr='bulk_theta') my_jet.add_EC_component(['EC_BLR','EC_Disk'],disk_type='BB')...
github_jupyter
<a href="https://colab.research.google.com/github/dafrie/fin-disclosures-nlp/blob/master/Multi_class_classification_with_Transformers.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Multi-Class classification with Transformers # Setup ``` # Load...
github_jupyter
``` # default_exp models.XResNet1dPlus ``` # XResNet1dPlus > This is a modified version of fastai's XResNet model in github. Changes include: * API is modified to match the default timeseriesAI's API. * (Optional) Uber's CoordConv 1d ``` #export from tsai.imports import * from tsai.models.layers import * from tsai.m...
github_jupyter
Simulation Demonstration ===================== ``` import matplotlib.pyplot as plt import pandas as pd import numpy as np import soepy ``` In this notebook we present descriptive statistics of a series of simulated samples with the soepy toy model. soepy is closely aligned to the model in Blundell et. al. (2016). Y...
github_jupyter
# Quickstart In this tutorial, we will show how to solve a famous optimization problem, minimizing the Rosenbrock function, in simplenlopt. First, let's define the Rosenbrock function and plot it: $$ f(x, y) = (1-x)^2+100(y-x^2)^2 $$ ``` import numpy as np def rosenbrock(pos): x, y = pos return (1-x)**...
github_jupyter
# <img style="float: left; padding-right: 10px; width: 45px" src="https://raw.githubusercontent.com/Harvard-IACS/2018-CS109A/master/content/styles/iacs.png"> CS109B Data Science 2: Advanced Topics in Data Science ## Lecture 5.5 - Smoothers and Generalized Additive Models - Model Fitting <div class="discussion"><b>JUS...
github_jupyter
``` from gridworld import * % matplotlib inline # create the gridworld as a specific MDP gridworld=GridMDP([[-0.04,-0.04,-0.04,1],[-0.04,None, -0.04, -1], [-0.04, -0.04, -0.04, -0.04]], terminals=[(3,2), (3,1)], gamma=1.) example_pi = {(0,0): (0,1), (0,1): (0,1), (0,2): (1,0), (1,0): (1,0), (1,2): (1,0), (2,0): (0,1)...
github_jupyter
<h2>Quadratic Regression Dataset - Linear Regression vs XGBoost</h2> Model is trained with XGBoost installed in notebook instance In the later examples, we will train using SageMaker's XGBoost algorithm. Training on SageMaker takes several minutes (even for simple dataset). If algorithm is supported on Python, we...
github_jupyter
# Table of Contents <div class="toc" style="margin-top: 1em;"><ul class="toc-item" id="toc-level0"><li><span><a href="http://localhost:8888/notebooks/work/bisdev/phenology-baps/spring-indices/annual-indices-of-spring.ipynb#Purpose" data-toc-modified-id="Purpose-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>Purpose...
github_jupyter
# Analyse data with Python Pandas Welcome to this Jupyter Notebook! Today you'll learn how to import a CSV file into a Jupyter Notebook, and how to analyse already cleaned data. This notebook is part of the course Python for Journalists at [datajournalism.com](https://datajournalism.com/watch/python-for-journalist...
github_jupyter
# Example File: In this package, we show three examples: <ol> <li>4 site XY model</li> <li>4 site Transverse Field XY model with random coefficients</li> <li><b> Custom Hamiltonian from OpenFermion </b> </li> </ol> ## Clone and Install The Repo via command line: ``` git clone https://github.com/ke...
github_jupyter
``` import requests import simplejson as json import pandas as pd import numpy as np import os import json import math from openpyxl import load_workbook df={"mapping":{ "Afferent / Efferent Arteriole Endothelial": "Afferent Arteriole Endothelial Cell", "Ascending Thin Limb": "Ascending Thin Limb Cell", "Ascending V...
github_jupyter
Single-channel CSC (Constrained Data Fidelity) ============================================== This example demonstrates solving a constrained convolutional sparse coding problem with a greyscale signal $$\mathrm{argmin}_\mathbf{x} \sum_m \| \mathbf{x}_m \|_1 \; \text{such that} \; \left\| \sum_m \mathbf{d}_m * \ma...
github_jupyter
# 六軸史都華平台模擬 ``` import numpy as np import pandas as pd from sympy import * init_printing(use_unicode=True) import matplotlib as mpl import matplotlib.pyplot as plt from mpl_toolkits import mplot3d import seaborn as sns sns.set() %matplotlib inline ``` ### Stewart Func ``` α, β, γ = symbols('α β γ') x, y, z = symbols...
github_jupyter
<a href="https://colab.research.google.com/github/davidnoone/PHYS332_FluidExamples/blob/main/04_ColloidViscosity_SOLUTION.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Colloids and no-constant viscosity (1d case) Colloids are a group of materia...
github_jupyter
``` import warnings warnings.filterwarnings('ignore') import pandas as pd from plotnine import * %ls test = pd.read_csv('shoppingmall_info_template.csv', encoding='cp949') test.shape test.head() test.columns test.head() test['Category'] = test['Name'].str.extract(r'^(스타필드|롯데몰)\s.*') test import folium geo_df = test ma...
github_jupyter
<h3>Implementation Of Doubly Linked List in Python</h3> <p> It is similar to Single Linked List but the only Difference lies that it where in Single Linked List we had a link to the next data element ,In Doubly Linked List we also have the link to previous data element with addition to next link</p> <ul> <b>It has thre...
github_jupyter
``` #import libraries import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns sns.set(font_scale = 1.2, style = 'darkgrid') %matplotlib inline import warnings warnings.filterwarnings("ignore") #change display into using full screen from IPython.core.display import display, HTML di...
github_jupyter
# Along isopycnal spice gradients Here we consider the properties of spice gradients along isopycnals. We do this using the 2 point differences and their distributions. This is similar (generalization) to the spice gradients that Klymak et al 2015 considered. ``` import numpy as np import xarray as xr import glide...
github_jupyter
``` import pandas as pd from influxdb import DataFrameClient user = 'root' password = 'root' dbname = 'base47' host='localhost' port=32768 # Temporarily avoid line protocol time conversion issues #412, #426, #431. protocol = 'json' client = DataFrameClient(host, port, user, password, dbname) print("Create pandas DataFr...
github_jupyter
``` import numpy as np import tensorflow as tf import collections def build_dataset(words, n_words): count = [['GO', 0], ['PAD', 1], ['EOS', 2], ['UNK', 3]] count.extend(collections.Counter(words).most_common(n_words - 1)) dictionary = dict() for word, _ in count: dictionary[word] = len(dictiona...
github_jupyter
# Regularization with SciKit-Learn ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns df = pd.read_csv('Data/Advertising.csv') df.head() X = df.drop('sales', axis=1) y = df['sales'] ``` ### Polynomial Conversion ``` from sklearn.preprocessing import PolynomialFeatures po...
github_jupyter
``` # -- coding: utf-8 -- # This code is part of Qiskit. # # (C) Copyright IBM 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modi...
github_jupyter
``` from datascience import * path_data = '../../data/' import matplotlib matplotlib.use('Agg', warn=False) %matplotlib inline import matplotlib.pyplot as plots plots.style.use('fivethirtyeight') import numpy as np ``` ### The Monty Hall Problem ### This [problem](https://en.wikipedia.org/wiki/Monty_Hall_problem) has...
github_jupyter
# Ungraded Lab Part 2 - Consuming a Machine Learning Model Welcome to the second part of this ungraded lab! **Before going forward check that the server from part 1 is still running.** In this notebook you will code a minimal client that uses Python's `requests` library to interact with your running server. ``` imp...
github_jupyter
TSG028 - Restart node manager on all storage pool nodes ======================================================= Description ----------- ### Parameters ``` container='hadoop' command=f'supervisorctl restart nodemanager' ``` ### Instantiate Kubernetes client ``` # Instantiate the Python Kubernetes client into 'api' ...
github_jupyter
# ASTE Release 1: Accessing the output with xmitgcm's llcreader module The Arctic Subpolar gyre sTate Estimate (ASTE) is a medium resolution, dynamically consistent, data constrained simulation of the ocean and sea ice state in the Arctic and subpolar gyre, spanning 2002-2017. See details on Release 1 in [Nguyen et al...
github_jupyter
# Location and the deviation survey Most wells are vertical, but many are not. All modern wells have a deviation survey, which is converted into a position log, giving the 3D position of the well in space. `welly` has a simple way to add a position log in a specific format, and computes a position log from it. You c...
github_jupyter
# <span style="color:Maroon">Trade Strategy __Summary:__ <span style="color:Blue">In this code we shall test the results of given model ``` # Import required libraries import pandas as pd import numpy as np import matplotlib.pyplot as plt import os np.random.seed(0) import warnings warnings.filterwarnings('ignore') #...
github_jupyter
``` !pip install -Uq catalyst gym ``` # Seminar. RL, DDPG. Hi! It's a second part of the seminar. Here we are going to introduce another way to train bot how to play games. A new algorithm will help bot to work in enviroments with continuos actinon spaces. However, the algorithm have no small changes in bot-envirome...
github_jupyter
``` # Importing the libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd import cv2 # Using glob to read all pokemon images at once # Don't forget to change the path when copying this project import glob images = [cv2.imread(file) for file in glob.glob("C:/Users/Rahul/Desktop/data/Pikachu...
github_jupyter
# Notebook used to visualize the daily distribution of electrical events, as depicted in the data descriptor ## Load packages and basic dataset information ``` import numpy as np import matplotlib.pyplot as plt import matplotlib.dates as mdates from sklearn.preprocessing import MinMaxScaler from matplotlib import pa...
github_jupyter
``` #@title Clone MelGAN-VC Repository ! git clone https://github.com/moiseshorta/MelGAN-VC.git #@title Mount your Google Drive #Mount your Google Drive account from google.colab import drive drive.mount('/content/drive') #Get Example Datasets %cd /content/ #Target Audio = Antonio Zepeda - Templo Mayor !wget --load-...
github_jupyter
# VQE for Unitary Coupled Cluster using tket In this tutorial, we will focus on:<br> - building parameterised ansätze for variational algorithms;<br> - compilation tools for UCC-style ansätze. This example assumes the reader is familiar with the Variational Quantum Eigensolver and its application to electronic struct...
github_jupyter
![seQuencing logo](../images/sequencing-logo.svg) # Sequences In some cases, one may want to intersperse ideal unitary gates within a sequence of time-dependent operations. This is possible using an object called a [Sequence](../api/classes.rst#Sequence). A `Sequence` is essentially a list containing [PulseSequences]...
github_jupyter
``` import pandas as pd import numpy as np import os from collections import Counter from tqdm import tqdm ``` # Data Analysis ``` data = pd.read_csv("test.csv",engine = 'python') data.tail() colum = data.columns for i in colum: print(f'{len(set(data[i]))} different values in the {i} column') print(f"\ntotal numb...
github_jupyter
# recreating the paper with tiny imagenet First we're going to take a stab at the most basic version of DeViSE: learning a mapping between image feature vectors and their corresponding labels' word vectors for imagenet classes. Doing this with the entirety of imagenet feels like overkill, so we'll start with tiny image...
github_jupyter
# Тест. Практика проверки гипотез По данным опроса, 75% работников ресторанов утверждают, что испытывают на работе существенный стресс, оказывающий негативное влияние на их личную жизнь. Крупная ресторанная сеть опрашивает 100 своих работников, чтобы выяснить, отличается ли уровень стресса работников в их ресторанах о...
github_jupyter
``` import os md_dir = os.path.join(os.getcwd(), 'mds') md_filenames = [os.path.join(os.getcwd(), 'mds', filename) for filename in os.listdir(md_dir)] print(md_filenames) from collections import namedtuple LineStat = namedtuple('LineStat', 'source cleaned line_num total_lines_in_text is_header') lines = [] for f in...
github_jupyter
Internet Resources: [Python Programming.net - machine learning episodes 39-42](https://pythonprogramming.net/hierarchical-clustering-mean-shift-machine-learning-tutorial/) ``` import matplotlib.pyplot as plt from matplotlib import style style.use('ggplot') import numpy as np from sklearn.datasets import make_blobs X...
github_jupyter
#Plotting Velocities and Tracers on Vertical Planes This notebook contains discussion, examples, and best practices for plotting velocity field and tracer results from NEMO on vertical planes. Topics include: * Plotting colour meshes of velocity on vertical sections through the domain * Using `nc_tools.timestamp()` t...
github_jupyter
**This notebook is an exercise in the [Natural Language Processing](https://www.kaggle.com/learn/natural-language-processing) course. You can reference the tutorial at [this link](https://www.kaggle.com/matleonard/word-vectors).** --- # Vectorizing Language Embeddings are both conceptually clever and practically ef...
github_jupyter
# EDA Case Study: House Price ### Task Description House Prices is a classical Kaggle competition. The task is to predicts final price of each house. For more detail, refer to https://www.kaggle.com/c/house-prices-advanced-regression-techniques/. ### Goal of this notebook As it is a famous competition, there exists l...
github_jupyter
# Keyword Spotting Dataset Curation [![Open In Colab <](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/ShawnHymel/ei-keyword-spotting/blob/master/ei-audio-dataset-curation.ipynb) Use this tool to download the Google Speech Commands Dataset, combine it with your own...
github_jupyter
<img src="../img/logo_white_bkg_small.png" align="right" /> # Worksheet 3: Detecting Domain Generation Algorithm (DGA) Domains against DNS This worksheet covers concepts covered in the second half of Module 6 - Hunting with Data Science. It should take no more than 20-30 minutes to complete. Please raise your hand...
github_jupyter
``` import pandas as pds import numpy as np import matplotlib.pyplot as plt method_dict = {"vi": "D-CODE", "diff": "SR-T", "spline": "SR-S", "gp": "SR-G"} val_dict = { "noise": "sigma", "freq": "del_t", "n": "n", } ode_list = ["GompertzODE", "LogisticODE"] def plot_df(df, x_val="sigma"): for method in m...
github_jupyter
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. # Tutorial: Train a classification model with automated machine learning In this tutorial, you'll learn how to generate a machine learning model using automated machine learning (automated ML). Azure Machine Learning can perf...
github_jupyter
# Natural Language Processing ## Importing the libraries ``` import numpy as np import matplotlib.pyplot as plt import pandas as pd ``` ## Importing the dataset ``` dataset = pd.read_csv('Restaurant_Reviews.tsv', delimiter = '\t', quoting = 3) ``` ## Cleaning the texts ``` import re import nltk nltk.download('sto...
github_jupyter
# Ungraded Lab: Mask R-CNN Image Segmentation Demo In this lab, you will see how to use a [Mask R-CNN](https://arxiv.org/abs/1703.06870) model from Tensorflow Hub for object detection and instance segmentation. This means that aside from the bounding boxes, the model is also able to predict segmentation masks for each...
github_jupyter
<a href="https://colab.research.google.com/github/AI4Finance-Foundation/FinRL/blob/master/FinRL_Ensemble_StockTrading_ICAIF_2020.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Deep Reinforcement Learning for Stock Trading from Scratch: Multiple S...
github_jupyter
# Chaper 8 - Intrinsic Curiosity Module #### Deep Reinforcement Learning *in Action* ##### Listing 8.1 ``` import gym from nes_py.wrappers import BinarySpaceToDiscreteSpaceEnv #A import gym_super_mario_bros from gym_super_mario_bros.actions import SIMPLE_MOVEMENT, COMPLEX_MOVEMENT #B env = gym_super_mario_bros.make('...
github_jupyter
# Fuzzing with Grammars In the chapter on ["Mutation-Based Fuzzing"](MutationFuzzer.ipynb), we have seen how to use extra hints – such as sample input files – to speed up test generation. In this chapter, we take this idea one step further, by providing a _specification_ of the legal inputs to a program. Specifying ...
github_jupyter
``` import requests import json import re # Setting the base URL for the ARAX reasoner and its endpoint endpoint_url = 'https://arax.rtx.ai/api/rtx/v1/query' # Given we have some chemical substances which are linked to asthma exacerbations for a certain cohort of patients, # we want to find what diseases are associate...
github_jupyter
# Tensor Manipulation: Psi4 and NumPy manipulation routines Contracting tensors together forms the core of the Psi4NumPy project. First let us consider the popluar [Einstein Summation Notation](https://en.wikipedia.org/wiki/Einstein_notation) which allows for very succinct descriptions of a given tensor contraction. F...
github_jupyter
# Joint Probability This notebook is part of [Bite Size Bayes](https://allendowney.github.io/BiteSizeBayes/), an introduction to probability and Bayesian statistics using Python. Copyright 2020 Allen B. Downey License: [Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)](https://creativecommons...
github_jupyter
# KNN Here we use K Nearest Neighbors algorithm to perform classification and regression ``` import numpy as np import matplotlib.pyplot as plt import sys import pandas as pd from sklearn.metrics import mean_squared_error from sklearn.model_selection import train_test_split from rdkit import Chem, DataStructs from sk...
github_jupyter
# Dispersion relations in a micropolar medium We are interested in computing the dispersion relations in a homogeneous micropolar solid. ## Wave propagation in micropolar solids The equations of motion for a micropolar solid are given by [[1, 2]](#References) \begin{align} &c_1^2 \nabla\nabla\cdot\mathbf{u}- c_2^2\...
github_jupyter
# UNSEEN-open In this project, the aim is to build an open, reproducible, and transferable workflow for UNSEEN. <!-- -- an increasingly popular method that exploits seasonal prediction systems to assess and anticipate climate extremes beyond the observed record. The approach uses pooled forecasts as plausible alternat...
github_jupyter
``` # default_exp utils ``` # Utils > Collection of useful functions. ``` #hide from nbdev.showdoc import * #export import os import numpy as np from typing import Iterable, TypeVar, Generator from plum import dispatch from pathlib import Path from functools import reduce function = type(lambda: ()) T = TypeVar('T...
github_jupyter
# Generate Region of Interests (ROI) labeled arrays for simple shapes This example notebook explain the use of analysis module "skbeam/core/roi" https://github.com/scikit-beam/scikit-beam/blob/master/skbeam/core/roi.py ``` import skbeam.core.roi as roi import skbeam.core.correlation as corr import numpy as np import...
github_jupyter
<p align="center"> <img src="http://www.di.uoa.gr/themes/corporate_lite/logo_el.png" title="Department of Informatics and Telecommunications - University of Athens"/> </p> --- <h1 align="center"> Artificial Intelligence </h1> <h1 align="center" > Deep Learning for Natural Language Processing </h1> --- <h2 alig...
github_jupyter
# Setup Before attending the workshp you should set up a scientific Python computing environment using the [Anaconda python distribution by Continuum Analytics](https://www.continuum.io/downloads). This page describes how. If this doesn't work, let [me](mailto:neal.caren@gmail.com) know and I will set you up with a vi...
github_jupyter
### Distributed MCMC Retrieval This notebook runs the MCMC retrievals on a local cluster using `ipyparallel`. ``` import ipyparallel as ipp c = ipp.Client(profile='gold') lview = c.load_balanced_view() ``` ## Retrieval Setup ``` %%px %env ARTS_BUILD_PATH=/home/simonpf/build/arts %env ARTS_INCLUDE_PATH=/home/simonpf...
github_jupyter
# Introduction ![alt text](https://techcrunch.com/wp-content/uploads/2017/08/anti-hate.jpg) This notebook provides a demo to use the methods used in the paper with new data. If new to collaboratory ,please check the following [link](https://medium.com/lean-in-women-in-tech-india/google-colab-the-beginners-guide-5ad...
github_jupyter
``` import logging from gensim.models import ldaseqmodel from gensim.corpora import Dictionary, bleicorpus, textcorpus import numpy as np from gensim.matutils import hellinger import time import pickle import pyLDAvis import matplotlib.pyplot as plt from scipy.stats import entropy import pandas as pd from numpy.linalg ...
github_jupyter
""" This file was created with the purpose of developing a random forest classifier to identify market squeeze This squeeze classification depends of the comparison of 2 indicators: 2 std of a 20 period bollinger bands and 2 atr of a 20 period keltner channel our definition of squeeze: when the upper bollinger band ...
github_jupyter
## Outline * Recap of data * Feedforward network with Pytorch tensors and autograd * Using Pytorch's NN -> Functional, Linear, Sequential & Pytorch's Optim * Moving things to CUDA ``` import numpy as np import math import matplotlib.pyplot as plt import matplotlib.colors import pandas as pd from sklearn.model_selecti...
github_jupyter
# Grid algorithm for the beta-binomial hierarchical model [Bayesian Inference with PyMC](https://allendowney.github.io/BayesianInferencePyMC) 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/) ``` # I...
github_jupyter
``` from datascience import * import numpy as np %matplotlib inline import pandas as pd import matplotlib.pyplot as plt plt.style.use('seaborn') from scipy import stats from scipy.stats import norm import matplotlib matplotlib.__version__ import seaborn as sns sns.set(color_codes = True) #Data or Fe-based, Cuprates,...
github_jupyter
# BB84 Quantum Key Distribution (QKD) Protocol using Qiskit This notebook is a _demonstration_ of the BB84 Protocol for QKD using Qiskit. BB84 is a quantum key distribution scheme developed by Charles Bennett and Gilles Brassard in 1984 ([paper]). The first three sections of the paper are readable and should give you...
github_jupyter
**[Back to Fan's Intro Stat Table of Content](https://fanwangecon.github.io/Stat4Econ/)** # Rescaling Standard Deviation and Covariance We have various tools at our disposal to summarize variables and the relationship between variables. Imagine that we have multiple toolboxes. This is the first one. There are two lev...
github_jupyter
Iterations, in programming, let coders repeat a set of instructions until a condition is met. Think about this as being stuck in a loop that will continue until something tells you to break out. ## While loop The `while` loop is one of two iteration types you'll learn about. In this loop, you must specify a condition...
github_jupyter
My family know I like puzzles so they gave me this one recently: ![Boxed Snake Puzzle](snake-puzzle-boxed.jpg "Boxed Snake Puzzle") When you take it out the box it looks like this: ![Solved Snake Puzzle](snake-puzzle-solved.jpg "Solved Snake Puzzle") And very soon after it looked like this (which explains why I've ...
github_jupyter