text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
# Preferential Bayesian Optimization: Multinomial Predictive Entropy Search ``` import numpy as np import gpflow import tensorflow as tf import tensorflow_probability as tfp import matplotlib.pyplot as plt import sys import os import pickle from gpflow.utilities import set_trainable, print_summary gpflow.config.set_d...
github_jupyter
``` from DEVDANmainloop import DEVDANmain, DEVDANmainID from DEVDANbasic import DEVDAN from utilsDEVDAN import dataLoader, plotPerformance import random import numpy as np import torch # random seed control np.random.seed(0) torch.manual_seed(0) random.seed(0) # load data dataStreams = dataLoader('../dataset/rmnist2.ma...
github_jupyter
## COBRA Visualisations This notebook will cover the visulaisation and plotting offered by pycobra. ``` %matplotlib inline import numpy as np from pycobra.cobra import Cobra from pycobra.ewa import Ewa from pycobra.visualisation import Visualisation from pycobra.diagnostics import Diagnostics # setting up our random ...
github_jupyter
First we fetch the data: ``` import shap from sklearn.model_selection import train_test_split X, y = shap.datasets.adult() print("Data fetched") target_feature = "income" y = [1 if y_i else 0 for y_i in y] full_data = X.copy() full_data[target_feature] = y data_train, data_test = train_test_split( full_data, t...
github_jupyter
# Outputting HTML in a notebook ## Display Helpers There are a number of helper methods for writing HTML that are available by default in a .NET notebook. ### HTML If you want to write out a `string` as HTML, you can use the `HTML` method: ``` display(HTML("<b style=\"color:blue\">Hello!</b>")); ``` Displaying HT...
github_jupyter
``` # This Python 3 environment comes with many helpful analytics libraries installed # It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python # For example, here's several helpful packages to load in import numpy as np # linear algebra import pandas as pd # data processing, CSV file...
github_jupyter
# Querying Scalar Quantities Models compute globally averaged quantities that are stored in `ocean_scalars.nc` files. This notebook shows how we do data discovery on scalar quantities and plot them as time series. **Requirements:** The `conda/analysis3-20.01` (or later) module on the VDI (or your own up-to-date cookb...
github_jupyter
# Automated Machine Learning (AutoML) Search ## Background ### Machine Learning [Machine learning](https://en.wikipedia.org/wiki/Machine_learning) (ML) is the process of constructing a mathematical model of a system based on a sample dataset collected from that system. One of the main goals of training an ML model ...
github_jupyter
<a href="https://colab.research.google.com/github/ML-Bioinfo-CEITEC/ECCB2021/blob/main/notebooks/10_Integrated_Gradients_G4.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ## Data ``` import tensorflow as tf from tensorflow.keras import Sequential ...
github_jupyter
## _*Using Algorithm Concatenation in Qiskit Aqua*_ This notebook demonstrates how to use the `Qiskit Aqua` library to realize algorithm concatenation. In particular, we experiment with chaining the executions of VQE and IQPE by first running VQE and then preparing IQPE's initial state using the variational form as pr...
github_jupyter
## _*Using Algorithm Concatenation in Qiskit Aqua*_ This notebook demonstrates how to use the `Qiskit Aqua` library to realize algorithm concatenation. In particular, we experiment with chaining the executions of VQE and IQPE by first running VQE and then preparing IQPE's initial state using the variational form as pr...
github_jupyter
## Aggregate Metrics into Figures of Merit ## **Credit:** Fabio Ragosta (INAF and University of Naples "Federico II") and Xiaolong Li (University of Delaware) Very minor edits and explanatory comments ('###') by Will Clarkson, UM-Dearborn **The notebook presents a function which take as input the bundleDicts from th...
github_jupyter
# Feature Scaling One of the most common transformations to make on continuous data is to scale each feature so that they all share similar ranges. For instance, we can scale each feature so each one has a mean of 0 and a standard deviation of 1. We can also scale each feature so that the minimum is 0 and maximum is 1...
github_jupyter
$\newcommand{\ket}[1]{|#1\rangle}$ ``` from qiskit import QuantumCircuit, execute, Aer, IBMQ from qiskit.compiler import transpile, assemble from qiskit.tools.jupyter import * from qiskit.visualization import * import matplotlib.pyplot as plt from scipy.optimize import curve_fit import numpy as np provider = IBMQ.loa...
github_jupyter
``` from make_animation import make_3d_animation from argon_calculation import * import time as tm # Data processing figure_directory = './exported_figs/' data_directory = './exported_data/' data_name_identifyer = 'N864_Pressure_09rho' # Specify what data is contained data_header = ['N', 'T','T_sim', 'Rho', 'C_v'...
github_jupyter
# GWAS Tutorial This is taken from the [Hail GWAS Tutorial](https://hail.is/docs/0.2/tutorials/01-genome-wide-association-study.html) with adjustments for use with SageMaker Notebook instances and EMR. ### List EMR Master Nodes `~/SageMaker/bin/list-clusters` will output the IP of each master node in your account an...
github_jupyter
# Prepare Dataset by Alejandro Vega & Ian Flores ### Loading Dependencies ``` %matplotlib inline from six.moves import cPickle as pickle import os import shutil from PIL import Image, ImageOps import numpy as np import matplotlib.pyplot as plt from IPython.display import display as disp # conflicting library functio...
github_jupyter
#Fashion Dataset ``` import tensorflow as tf import tensorflow.contrib.eager as tfe import tensorflow.keras as keras import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split %matplotlib inline !pip install ipython-autotime %load_ext autotime ``` #...
github_jupyter
# 📝 Exercise M2.01 The aim of this exercise is to make the following experiments: * train and test a support vector machine classifier through cross-validation; * study the effect of the parameter gamma of this classifier using a validation curve; * study if it would be useful in term of classification if we cou...
github_jupyter
# Preprocess ## Merge In this notebook, it is shown how all seasonal forecasts are loaded into one xarray dataset. For the Siberian heatwave, we have retrieved 105 files (one for each of the 35 years and for each of the three lead times, ([see Retrieve](../1.Download/1.Retrieve.ipynb)). For the UK, we are able to use...
github_jupyter
### Image classification using Fashion MNIST data set #### This notebook investigates whether multiple CNN models can achieve higher classification accuracy than any individual model. Two simple strategies for combining models are examined: > 1. Classification based on the average class probabilities of models > 2....
github_jupyter
``` import json import plotly.plotly as py import plotly.graph_objs as go import math from plotly import tools import copy #data related to the ring cyclide is loaded with open('2381.json') as data_file: fig = json.load(data_file) data_original = fig['data'][0] #this will be trace0 data = copy.deepcopy(fi...
github_jupyter
``` import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets('Data/mnist', one_hot=True) n_classes = 10 input_size = 784 x = tf.placeholder(tf.float32, shape=[None, input_size]) y = tf.placeholder(tf.float32, shape=[None, n_classes]) keep_prob = tf.placeholde...
github_jupyter
<a href="https://colab.research.google.com/github/zerotodeeplearning/ztdl-masterclasses/blob/master/notebooks/Image_Search.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ## Learn with us: www.zerotodeeplearning.com Copyright © 2021: Zero to Deep L...
github_jupyter
# Analyzing Locust Load Testing Results This Notebook demonstrates how to analyze **AI Platform Prediction** load testing runs using metrics captured in **Cloud Monitoring**. This Notebook build on the `02-perf-testing.ipynb` notebook that shows how to configure and run load tests against AI Platform Prediction usin...
github_jupyter
``` import pandas as pd import numpy as np import os import datetime from HMM import unsupervised_HMM from HMM import supervised_HMM from HMM_helper import sample_sentence from dtaidistance import dtw from dtaidistance import clustering from scipy import stats from scipy.cluster.hierarchy import dendrogram, linkage, fc...
github_jupyter
# Instructions The places where you have enter code, to answer the questions, are marked with `# YOUR CODE HERE`. Once you have written your code you should remove the `raise NotImplementedError()` statement. The first two questions are on phase estimation and the rest is about order finding algorithm. ## Question 1...
github_jupyter
# Creating a Siamese model using Trax: Ungraded Lecture Notebook ``` import trax from trax import layers as tl import trax.fastmath.numpy as np import numpy # Setting random seeds trax.supervised.trainer_lib.init_random_number_generators(10) numpy.random.seed(10) ``` ## L2 Normalization Before building the model yo...
github_jupyter
# MNIST Training using PyTorch and deploy it with Elastic Inference ## Contents 1. [Background](#Background) 1. [Setup](#Setup) 1. [Data](#Data) 1. [Train](#Train) 1. [Host](#Host) --- ## Background MNIST is a widely used dataset for handwritten digit classification. It consists of 70,000 labeled 28x28 pixel grays...
github_jupyter
``` try: from dse.cluster import Cluster except ImportError: from cassandra.cluster import Cluster cluster = Cluster(['127.0.0.1', '127.0.0.2', '127.0.0.3']) # provide contact points and port session = cluster.connect('davinci') import pandas as pd #!pip install jupyterthemes !jt -t grade3 from dateutil.pars...
github_jupyter
# Logistic Regression with a Neural Network mindset Welcome to your first (required) programming assignment! You will build a logistic regression classifier to recognize cats. This assignment will step you through how to do this with a Neural Network mindset, and so will also hone your intuitions about deep learning....
github_jupyter
<a href="https://colab.research.google.com/github/Tixonmavrin/Zindi-Zimnat-Insurance-Recommendation-Challenge/blob/master/Baseline1.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ##Zimnat Insurance Recommendation Challenge Can you predict which ins...
github_jupyter
<a href="https://colab.research.google.com/github/Chiebukar/Deep-Learning/blob/main/movie_rating_classification.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # **Binary Classification of movie ratings using IMDB dataset** ## Import required libra...
github_jupyter
![HSV-AI Logo](https://github.com/HSV-AI/hugo-website/blob/master/static/images/logo_v9.png?raw=true) # Implicit Recommendation from ECommerce Data Some of the material for this work is based on [A Gentle Introduction to Recommender Systems with Implicit Feedback](https://jessesw.com/Rec-System/) by Jesse Steinweg Wo...
github_jupyter
<h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#Introduction-and-Statement-of-Intent-" data-toc-modified-id="Introduction-and-Statement-of-Intent--1"><span class="toc-item-num">1&nbsp;&nbsp;</span>Introduction and Statement of Intent <a name="introductio...
github_jupyter
<a href="https://colab.research.google.com/github/Spnetic-5/DSC_ML_Workshop/blob/master/Logistic_regression_(Titanic_dataset).ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` from google.colab import files uploaded = files.upload() import numpy a...
github_jupyter
# Plotting on data-aware grids ``` %matplotlib inline import numpy as np import pandas as pd import seaborn as sns from scipy import stats import matplotlib as mpl import matplotlib.pyplot as plt sns.set(style="ticks") np.random.seed(sum(map(ord, "axis_grids"))) ``` ``` tips = sns.load_dataset("tips") g = sns.FacetGr...
github_jupyter
``` %load_ext autotime %load_ext line_profiler %%capture # get_corpus_path # get_txt_orig_path # get_txt_clean_path %run ../path_manager.ipynb # CorpusCleaner %run ../DataCleanerModule.ipynb ## Jupyter.notebook.save_checkpoint() # respeller_cache.clear(warn=False) def cleaner_test(doc_name='11758940.txt', use_spacy...
github_jupyter
``` #importing libraries import PIL import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.linear_model import LogisticRegression from sklearn import preprocessing from sklearn.model_selection import train_test_split import keras from keras.models import Sequential from keras.layers import...
github_jupyter
# Goal of project - Author: Arun Nemani - Effectively extract features from all 20 categories of the 20-newsgroups dataset - Train and fit a classification model to predict text inputs based on the extracted features - Report the accuracies for each classification models ### Cloned repos as baseline - https://github.c...
github_jupyter
``` import numpy as np import pandas as pd from scipy.stats import linregress import sqlite3 import json import numpy as np import os import pickle import shutil import sqlite3 from collections import defaultdict from datetime import datetime from time import sleep #import query import logzero import requests #import s...
github_jupyter
``` %pylab inline import xarray as xr import numpy as np import cartopy import matplotlib.pyplot as plt from glob import glob from matplotlib.collections import PatchCollection from matplotlib.patches import Rectangle import matplotlib.patches as mpatches galapagos_extent = [-91.8+360, -89+360, -1.4, 0.7] projection = ...
github_jupyter
## Import Required Packages ``` import tensorflow as tf import tensorflow_addons as tfa from tqdm import tqdm import pandas as pd import sklearn from sklearn import metrics import re import numpy as np import pickle as pkl import PIL import datetime import os import random import shutil import statistics import time i...
github_jupyter
# Transform Data to Hand Coordiantes This script shifts the data to the mean of the R-Markers and performs a change of basis to hand coordinates. ``` import pandas as pd import numpy as np import os import pickle from datetime import datetime clean_data_path = 'CleanedData' transformed_data_output_path = 'TransformedD...
github_jupyter
# Welcome to my kernel Skin cancer is the most common human malignancy, is primarily diagnosed visually, beginning with an initial clinical screening and followed potentially by dermoscopic analysis, a biopsy and histopathological examination. Automated classification of skin lesions using images is a challenging task...
github_jupyter
> **Tip**: Welcome to the Investigate a Dataset project! You will find tips in quoted sections like this to help organize your approach to your investigation. Before submitting your project, it will be a good idea to go back through your report and remove these sections to make the presentation of your work as tidy as ...
github_jupyter
# Language Translation In this project, you’re going to take a peek into the realm of neural network machine translation. You’ll be training a sequence to sequence model on a dataset of English and French sentences that can translate new sentences from English to French. ## Get the Data Since translating the whole lan...
github_jupyter
# Load data and library ``` import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.feature_extraction.text import CountVectorizer from sklearn.svm import SVC from sklearn.model_selection import train_test_split from sklearn.model...
github_jupyter
``` # installing packages (if they do not exist) !conda install --yes numpy=1.18.5 !conda install --yes pandas=1.2.0 !conda install --yes scikit-learn=0.23.2 !conda install --yes matplotlib=3.2.2 !conda install --yes seaborn=0.10.1 import numpy as np import pandas as pd import time from sklearn.tree import DecisionTree...
github_jupyter
![JohnSnowLabs](https://nlp.johnsnowlabs.com/assets/images/logo.png) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/JohnSnowLabs/spark-nlp-workshop/blob/master/tutorials/streamlit_notebooks/NER_RU.ipynb) # **Detect entities in Russian language**...
github_jupyter
## Pengantar Numpy Numpy library (module) digunakan hampir semua komputasi numerik yang menggunakan Python. Numpy merupakan library yang menyediakan komputasi performa tinggi untuk komputasi data struktur vector, matrix, atau dimensi lainnya yang lebih tinggi di python. hal ini dikarenakan numpy diimplementasikan mengg...
github_jupyter
# Copying data from Redshift to S3 and back --- --- ## Contents 1. [Introduction](#Introduction) 1. [Reading from Redshift](#Reading-from-Redshift) 1. [Upload to S3](#Upload-to-S3) 1. [Writing back to Redshift](#Writing-back-to-Redshift) ## Introduction In this notebook we illustrate how to copy data from Redshif...
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/google/applied-machine-learning-intensive/blob/master/content/03_regression/08_regression_with_tensorflow/colab.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> #### Copyright 2020 Google LLC. ``` # ...
github_jupyter
``` import numpy as np import itertools import scipy.spatial as spspatial import scipy.cluster.hierarchy as sch from clusim.clustering import Clustering, remap2match import clusim.sim as sim %matplotlib inline import matplotlib as mpl import matplotlib.pylab as plt def fancy_dendrogram(*args, **kwargs): """ ...
github_jupyter
# Mobile Games - A/B Test ### Patrícia do Nascimento <img src='cookiecats.jpg' style=width:400px; align='center'/> # Table of Contents [1. Basic infos](#1.-Basic-infos) [2. Import libraries](#2.-Import-libraries) [3. Load data](#3.-Load-data) [4. Exploratory Data Analysis (EDA)](#4.-Exploratory-Data-Analysis-(EDA...
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
|<img style="float:left;" src="http://pierreproulx.espaceweb.usherbrooke.ca/images/usherb_transp.gif"> |Pierre Proulx, ing, professeur| |:---|:---| |Département de génie chimique et de génie biotechnologique |** GCH200-Phénomènes d'échanges I **| ### Section 10-5 > Voici un problème qui devient très complexe à traite...
github_jupyter
#Data Science Project 2: Exploring Hacker News Posts 1. In this project, we'll work with a data set of submissions to popular technology site Hacker News. 2. Hacker News is a site started by the startup incubator Y Combinator, where user-submitted stories (known as "posts") are voted and commented upon, similar to re...
github_jupyter
``` %matplotlib inline import sys import numpy as np import pandas as pd import matplotlib.pyplot as plt import torch import torch.nn as nn import torch.optim as optim import torch.utils.data from torch.autograd import Variable from torch.utils.data import TensorDataset from torch.utils.data import DataLoader from ...
github_jupyter
# StackOverflow Problems ### Real-world problems to test your skills on! ``` %matplotlib inline import matplotlib.pyplot as plt import numpy as np from skimage import (filters, io, color, exposure, feature, segmentation, morphology, img_as_float) ``` # Parameters of a pill (Based on StackOverfl...
github_jupyter
``` import pandas as pd from wikidata2df import wikidata2df with open("../queries/human_genes.rq", "r") as f: query = f.read() df = wikidata2df(query) markers = pd.read_csv("../data/PanglaoDB_markers_27_Mar_2020.tsv", sep = "\t") human_markers = markers[["Hs" in val for val in markers["species"]]] from matplotli...
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
Previous work ``` # !git clone https://github.com/rosetta-ai/rosetta_recsys2019.git # !git clone https://github.com/recsyschallenge/2019.git # !git clone https://github.com/logicai-io/recsys2019.git # !git clone https://github.com/mustelideos/recsys-challenge-2019.git # !git clone https://github.com/MaurizioFD/recsys-...
github_jupyter
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. ![Impressions](https://PixelServer20190423114238.azurewebsites.net/api/impressions/MachineLearningNotebooks/how-to-use-azureml/automated-machine-learning/regression-car-price-model-explaination-and-featurization/auto-ml-regressi...
github_jupyter
<a href="https://colab.research.google.com/github/Harshra1-ultra/CNN/blob/main/chapter_1_deep_learning_.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import numpy as np from tensorflow.keras.datasets import mnist import matplotlib.pyplot as pl...
github_jupyter
## Bayesian Calibration via a Falling Ball Example To illustrate how to use XXX within YYY we will start with a very simple example of a falling ball example. First, import the main libraries we use for this example. ``` import numpy as np import scipy.stats as sps import sys import os import copy ``` ### Falling ...
github_jupyter
# Autoencoder Building an autoencoder using Keras. ## Update environment ``` !apt-get install graphviz -qq !pip install graphviz -q !pip install pydot -q # restart runtime import numpy as np import matplotlib.pyplot as plt %matplotlib inline from keras.layers import Input, Dense from keras.models import Model from ...
github_jupyter
``` pip install mljar-supervised pip install openml from sklearn.model_selection import train_test_split import pandas as pd df = pd.read_csv("undersample_5.csv") X = df.iloc[:,2:32] y = df.iloc[:,1] from sklearn.preprocessing import LabelEncoder l = LabelEncoder() y = l.fit_transform(y) X_train, X_tmp, y_train, y_tm...
github_jupyter
``` %config InlineBackend.figure_format = 'retina' from matplotlib import rcParams rcParams["savefig.dpi"] = 96 rcParams["figure.dpi"] = 96 ``` # The polynomial decomposition ## Introduction The polynomial decomposition approach was originally proposed by [Keery et al. (2012)]( https://doi.org/10.1190/geo2011-0244....
github_jupyter
# Convolutional Neural Network ``` import os, random import numpy as np from os.path import join, basename from scipy.misc import imresize, imread from datetime import datetime from keras.models import Sequential from keras.layers import...
github_jupyter
``` import pandas as pd import holoviews as hv import numpy as np import geoviews as gv import geoviews.feature as gf import cartopy import cartopy.feature as cf from geoviews import opts from cartopy import crs as ccrs gv.extension('matplotlib', 'bokeh') gv.output(dpi=120, fig='svg') ``` Cartopy and shapely make w...
github_jupyter
# Multi-Node Rendering with Dask-MPI and Dask.Array If you looked at the Array.ipynb example, you saw server-side rendering driven by Jupyter's python kernel, but we can also drive the renderer with Dask. What's more, we can use a cluster of Dask-MPI workers to distribute the rendering across multiple GPUs, or even mul...
github_jupyter
# TomoTwin: A simple digital twin for synchrotron micro-CT ### Author: Aniket Tekawade 1. Phantom with voids and inclusions using Porespy (Label 0 is void, label 1 is material, label 2 is inclusion material) 2. model attenuation / noise with Poisson assumption and data from XOP 3. model phase-contrast with inve...
github_jupyter
<a href="https://colab.research.google.com/github/enakai00/rl_book_solutions/blob/master/Chapter04/Exercise_4_7_(Value_Iteration)_part1.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import numpy as np from scipy.stats import poisson from pand...
github_jupyter
# Лекция 1 ## Типы и объекты Типы данных Язык Python характерен своей неявной динамической типизацией. Это означает, что при задании какой-либо переменной, нам не надо объявлять ее тип (число, строка, и т.д.), как это сделано в языке С. То есть достаточно просто присвоить ей значение и в зависимости от того, какое ...
github_jupyter
# Session 17: Character-based Language Modelling with LSTMs ------------------------------------------------------ *Introduction to Data Science & Machine Learning* *Pablo M. Olmos olmos@tsc.uc3m.es* ------------------------------------------------------ The goal of this notebook is to train a LSTM character predic...
github_jupyter
``` from _util import * import _RL.FQI as FQI import _RL.my_gym as my_gym import _Ohio_Simulator as Ohio import _analyze as analyze import _RL.DQN as DQN import _cartpole as cartpole from coinDice import run_neural_coin_dice as run_coin from coinDice import converter as converter os.environ["OMP_NUM_THREADS"] = "1" o...
github_jupyter
# Short Interest Rate Model Calibration [Goutham Balaraman](http://gouthamanbalaraman.com) I have talked about Hull-White model in my earlier blog posts. The focus of those posts was to see how to use the model classes. The model parameters were assumed to be given. However in practice, the model parameters need to ca...
github_jupyter
``` from pyspark.sql import SparkSession spark = SparkSession.builder \ .master("local") \ .appName("Neural Network Model") \ .config("spark.executor.memory", "6gb") \ .getOrCreate() sc = spark.sparkContext df = spark.createDataFrame([('Male', 67, 150), ('Female', 65, 135), ...
github_jupyter
# Deuxième essai BM25 pour requêter les DPEFs et chercher des sujets spécifiques. ``` %load_ext autoreload %autoreload 2 # general libraries import pandas as pd; pd.set_option('display.max_colwidth', -1) import numpy as np # NLP libraries from spacy.lang.fr import French import spacy # from spacy.cli.download import...
github_jupyter
# Computer Vision Nanodegree ## Project: Image Captioning --- In this notebook, you will train your CNN-RNN model. You are welcome and encouraged to try out many different architectures and hyperparameters when searching for a good model. This does have the potential to make the project quite messy! Before subm...
github_jupyter
# Load Data from Kaggle ![Kaggle Logo](https://saturn-public-assets.s3.us-east-2.amazonaws.com/example-resources/kaggle-logo.png "doc-image") ## Overview [Kaggle](https://www.kaggle.com/), in addition to its competitions and other offerings, has an expansive offering of curated and community submitted datasets. The ...
github_jupyter
# FFMPEG ## Piping numpy arrays into FFMPEG ``` import subprocess as sp command = [ 'ffmpeg', '-f', 'rawvideo', '-vcodec','rawvideo', '-s', '1920x1080', # size of one frame '-pix_fmt', 'rgb24', '-r', '24', # frames per second '-i', '-', # The imput comes from...
github_jupyter
# Scoring experiments # In this notebook we'll run the experiment presented in the paper ... I've run this 5 times with different randomisations of the training/development data sets. First we'll load the data, then set some helper functions, run the scoring optimisations, gather results and finally plot some random...
github_jupyter
``` import numpy as np from sif.kernels import BrownianMotionKernel from sif.samplers import multivariate_normal_sampler import matplotlib.pyplot as plt %matplotlib inline n_grid = 1000 T = np.atleast_2d(np.linspace(1e-6, 1, num=n_grid)).T kernel = BrownianMotionKernel() n_samples = 20000 C = kernel.cov(T) m = np.zeros...
github_jupyter
# Simulation experiment using noisy data Run entire simulation experiment multiple times to generate confidence interval. The simulation experiment can be found in ```functions/pipeline.py``` ``` %load_ext autoreload %autoreload 2 from joblib import Parallel, delayed import multiprocessing import sys import os imp...
github_jupyter
``` import os import time import pickle import numpy as np import pandas as pd from numpy.linalg import norm from tqdm import tqdm, tqdm_notebook from keras.preprocessing import image from keras.applications.resnet50 import ResNet50, preprocess_input #Initialize Model model = ResNet50(weights='imagenet', include_top=Fa...
github_jupyter
# Air in a tank A spherical metal tank stores hot air, initially at 200°C and 350 psi. The tank is made out of stainless steel, with specific heat capacity 471 J/kg-K and density 7902 kg/m$^3$. The tank wall is 0.35 mm thick and initially at 20°C; the inner radius is 10 cm and the outer wall is insulated. Treat the ...
github_jupyter
# Bayesian regression, four ways ``` import pymc3 as pm import numpy as np import pandas as pd import statsmodels.api as sm import seaborn as sns import scipy as sp import matplotlib.pyplot as plt %matplotlib inline ``` ## 1. Univariate normal distribution Let's try to infer the most likely parameters of a normal dis...
github_jupyter
``` %matplotlib inline import gym import itertools import matplotlib import numpy as np import pandas as pd import sys if "../" not in sys.path: sys.path.append("../") from collections import defaultdict from lib.envs.windy_gridworld import WindyGridworldEnv from lib import plotting matplotlib.style.use('ggplot'...
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="http://cocl.us/pytorch_link_top"> <img src="https://s3-api.us-geo.objectstorage.softlayer.net/cf-courses-data/CognitiveClass/DL0110EN/notebook_images%20/Pytochtop.png" width="750" alt="IBM Product " /> </a> <img src="https://s3-api.us-geo.objectstorage.softlayer.net/cf-courses-data/CognitiveClass/DL0110EN...
github_jupyter
## Manipolazione di un file GTF (Gene Transfer Format) attraverso la libreria `Pandas` #### 1) Importare `Pandas` ``` import pandas as pd ``` #### 2) Leggere il file GTF df = pd.read_csv(gtf_file_name, sep='\t', header = None) ``` df = pd.read_csv('./input.gtf', sep='\t', header = None) df ``` **NB**: `read_c...
github_jupyter
# Exploring Sensor Data from Kafka with Structured Streaming The intention of this example is to explore how to consume and produce data with Structured Streaming API. Using the data produced by the Akka ingestion microservice and produced to Kafka, we will: - use the Kafka `source` to consume events from the `sens...
github_jupyter
# Tabular data preprocessing ``` from fastai.gen_doc.nbdoc import * from fastai.tabular import * ``` ## Overview This package contains the basic class to define a transformation for preprocessing dataframes of tabular data, as well as basic [`TabularTransform`](/tabular.transform.html#TabularTransform). Preprocessin...
github_jupyter
# 1 特征提取 * 训练数据只用了前4亿(尽管有的特征全部提取了,但实际只用了4亿) * 一共10种特征(有的特征分成了多个部分) * 除了特征10,其余的训练集特征都是4亿存在一起的,特征10由于一下提取4亿内存会炸,所以分成了前2亿和后两亿 ## 1.1 基础特征 ### 1.1.1 长度相关按行提取特征 按行提取训练集长度相关特征(由于是按行提取的,所以测试集提取代码几乎完全一样所以不再给出) ``` import pandas as pd import numpy as np import random import math import time import gc import os import csv imp...
github_jupyter
# Семинар 6 ## Задачка 1: [камешки](https://leetcode.com/problems/jewels-and-stones/) У Дори в глубинах океана есть кучка камней. Часть камней из этой кучки драгоценные. Недавно она пересчитала все драгоценные и забыла сколько их. Чтобы больше не забывать, Дори решила написать на питоне функцию, которая будет считать...
github_jupyter
## _*Quantum SVM*_ ### Introduction Please refer to [this file](https://github.com/Qiskit/qiskit-tutorials/blob/master/legacy_tutorials/aqua/machine_learning/qsvm_classification.ipynb) for introduction. ``` from matplotlib import pyplot as plt import numpy as np from qiskit.ml.datasets import ad_hoc_data from qiskit...
github_jupyter
# The AnyPath Object PD SDK's `AnyPath` objects are a layer build on top of Python's `pathlib.Path` as well as `S3Path`. As a result, it accepts both local file system paths and s3 addresses. `AnyPath` has most common methods known from `pathlib.Path` implemented and fitted towards also working with s3 addresses, when...
github_jupyter