text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
# Monte Carlo Simulations with Python (Part 1) [Patrick Hanbury](https://towardsdatascience.com/monte-carlo-simulations-with-python-part-1-f5627b7d60b0) - Notebook author: Israel Oliveira [\[e-mail\]](mailto:'Israel%20Oliveira%20'<prof.israel@gmail.com>) ``` %load_ext watermark import numpy as np import math import r...
github_jupyter
``` import sys; sys.path.append('../rrr') from multilayer_perceptron import * from figure_grid import * from local_linear_explanation import * from toy_colors import generate_dataset, imgshape, ignore_rule1, ignore_rule2, rule1_score, rule2_score import lime import lime.lime_tabular ``` # Toy Color Dataset This is a ...
github_jupyter
``` import os import re import torch import pickle import pandas as pd import numpy as np from tqdm.auto import tqdm tqdm.pandas() ``` # 1. Pre-processing ### Create a combined dataframe > This creates a dataframe containing the image IDs & labels for both original images provided by the Bristol Myers Squibb pharmac...
github_jupyter
``` import functools import pathlib import numpy as np import matplotlib.pyplot as plt import shapely.geometry import skimage.draw import tensorflow as tf import pydicom import pymedphys import pymedphys._dicom.structure as dcm_struct # Put all of the DICOM data here, file structure doesn't matter: data_path_root ...
github_jupyter
``` import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from keras.datasets import mnist (x_train, y_train), _ = mnist.load_data() x_train = x_train / 255.0 x_train = np.expand_dims(x_train, axis=3) print(x_train.shape) print(y_train.shape) num_classes = 10 plt.imshow(np.squeeze(x_train[10])) ...
github_jupyter
## Accessing High Resolution Electricity Access (HREA) data with the Planetary Computer STAC API The HREA project aims to provide open access to new indicators of electricity access and reliability across the world. Leveraging VIIRS satellite imagery with computational methods, these high-resolution data provide new t...
github_jupyter
``` import os os.environ['CUDA_VISIBLE_DEVICES'] = "0" import numpy as np from matplotlib import pyplot as plt import seaborn as sns import pandas as pd from tqdm.auto import tqdm import torch from torch import nn import gin import pickle import io from sparse_causal_model_learner_rl.trainable.gumbel_switch import With...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import sklearn as sk from sklearn import linear_model from sklearn.model_selection import train_test_split from sklearn.metrics import mean_squared_error from sklearn.preprocessing import MinMaxScaler # Набор данных взят с https://www.kaggle.co...
github_jupyter
``` from sklearn.datasets import make_blobs X, y = make_blobs(n_samples=50, centers=2, cluster_std=0.5, random_state=4) y = 2 * y - 1 plt.scatter(X[y == -1, 0], X[y == -1, 1], marker='o', label="-1 class") plt.scatter(X[y == +1, 0], X[y == +1, 1], marker='x', label="+1 class") plt.xlabel("x1") plt.ylabel("x2") plt.leg...
github_jupyter
# LeetCode #804. Unique Morse Code Words ## Question https://leetcode.com/problems/unique-morse-code-words/ International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows: "a" maps to ".-", "b" maps to "-...", "c" maps to "-.-.", and so on. Fo...
github_jupyter
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. # 06. Distributed CNTK using custom docker images In this tutorial, you will train a CNTK model on the [MNIST](http://yann.lecun.com/exdb/mnist/) dataset using a custom docker image and distributed training. ## Prerequisites * ...
github_jupyter
<a href="https://colab.research.google.com/github/skojaku/cidre/blob/second-edit/examples/example.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # About this notebook In this notebook, we apply CIDRE to a network with communities and demonstrate h...
github_jupyter
# Fine-Tuning a BERT Model and Create a Text Classifier In the previous section, we've already performed the Feature Engineering to create BERT embeddings from the `reviews_body` text using the pre-trained BERT model, and split the dataset into train, validation and test files. To optimize for Tensorflow training, we ...
github_jupyter
``` import pandas as pd import numpy as np from tqdm import tqdm import seaborn as sns import matplotlib.pyplot as plt import re from nltk.corpus import stopwords stop = list(set(stopwords.words('english'))) f_train = open('../data/train_14k_split_conll.txt','r',encoding='utf8') line_train = f_train.readlines() f_val...
github_jupyter
# 2-22: Intro to scikit-learn <img src="https://www.cityofberkeley.info/uploadedImages/Public_Works/Level_3_-_Transportation/DSC_0637.JPG" style="width: 500px; height: 275px;" /> --- ** Regression** is useful for predicting a value that varies on a continuous scale from a bunch of features. This lab will introduce th...
github_jupyter
# Author: Faique Ali ## Task 01 : Prediction Using Supervised ML <p> Using Linear Regression, predict the percentage of an student based on his no. of study hours. </p> # Imports ``` import pandas as pd from pandas import DataFrame import matplotlib.pyplot as plt from sklearn.model_selection import train_test_...
github_jupyter
**Chapter 19 – Training and Deploying TensorFlow Models at Scale** _This notebook contains all the sample code in chapter 19._ <table align="left"> <td> <a target="_blank" href="https://colab.research.google.com/github/ageron/handson-ml2/blob/master/19_training_and_deploying_at_scale.ipynb"><img src="https://ww...
github_jupyter
# Longest Palindromic Subsequence In this notebook, you'll be tasked with finding the length of the *Longest Palindromic Subsequence* (LPS) given a string of characters. As an example: * With an input string, `ABBDBCACB` * The LPS is `BCACB`, which has `length = 5` In this notebook, we'll focus on finding an optimal...
github_jupyter
# Centerpartiets budgetmotion 2022 https://www.riksdagen.se/sv/dokument-lagar/dokument/motion/centerpartiets-budgetmotion-2022_H9024121 ``` import pandas as pd import requests pd.options.mode.chained_assignment = None multiplier = 1_000_000 docs = [ {'utgiftsområde': 1, 'dok_id': 'H9024141'}, {'utgiftsområde...
github_jupyter
## Plotting of profile results ``` #!/usr/bin/env python # -*- coding: utf-8 -*- # common import os import os.path as op # pip import numpy as np import pandas as pd import math import xarray as xr import matplotlib.pyplot as plt from matplotlib import gridspec # DEV: override installed teslakit import sys sys.path...
github_jupyter
# Dropout regularization with gluon ``` import mxnet as mx import numpy as np from mxnet import gluon from tqdm import tqdm_notebook as tqdm ``` ## Context ``` ctx = mx.cpu() ``` ## The MNIST Dataset ``` batch_size = 64 num_inputs = 784 num_outputs = 10 def transform(data, label): return data.astype(np.float32...
github_jupyter
# Update rules ``` import numpy as np import matplotlib.pyplot as plt import mpl_toolkits.mplot3d.axes3d as p3 import matplotlib.animation as animation from IPython.display import HTML from matplotlib import cm from matplotlib.colors import LogNorm def sgd(f, df, x0, y0, lr, steps): x = np.zeros(steps + 1) y ...
github_jupyter
# Sorting Objects in Instance Catalogs _Bryce Kalmbach_ This notebook provides a series of commands that take a Twinkles Phosim Instance Catalog and creates different pandas dataframes for different types of objects in the catalog. It first separates the full sets of objects in the Instance Catalogs before picking ou...
github_jupyter
# Cloud-based machine learning || 云端机器学习 Thus far, we have looked at building and fitting ML models “locally.” True, the notebooks have been located in the cloud themselves, but the models with all of their predictive and classification power are stuck in those notebooks. To use these models, you would have to load d...
github_jupyter
# Mumbai House Price Prediction - Supervised Machine Learning-Regression Problem ## Data Preprocessing # The main goal of this project is to Predict the price of the houses in Mumbai using their features. # Import Libraries ``` # importing necessary libraries import pandas as pd import matplotlib.pyplot as plt %ma...
github_jupyter
``` from scipy.stats import ranksums, sem import numpy as np from statannot import add_stat_annotation import copy import os import matplotlib.pyplot as plt import matplotlib save_dir = os.path.join("/analysis/fabiane/documents/publications/patch_individual_filter_layers/MIA_revision") plt.style.use('ggplot') matplotli...
github_jupyter
``` # Import dependencies pandas, # requests, gmaps, census, and finally config's census_key and google_key # Declare a variable "c" and set it to the census with census_key. # https://github.com/datamade/census # We're going to use the default year 2016, however feel free to use another year. # Run a censu...
github_jupyter
# Speech Identity Inference Let's check if the pretrained model can really identify speakers. ``` import os import numpy as np import pandas as pd from sklearn import metrics from tqdm.notebook import tqdm from IPython.display import Audio from matplotlib import pyplot as plt %matplotlib inline import tensorflow as...
github_jupyter
``` import numpy as np import cs_vqe as c import ast import os from openfermion import qubit_operator_sparse import conversion_scripts as conv_scr import scipy as sp from openfermion import qubit_operator_sparse import conversion_scripts as conv_scr from openfermion.ops import QubitOperator # with open("hamiltonians.t...
github_jupyter
> **Note:** In most sessions you will be solving exercises posed in a Jupyter notebook that looks like this one. Because you are cloning a Github repository that only we can push to, you should **NEVER EDIT** any of the files you pull from Github. Instead, what you should do, is either make a new notebook and write you...
github_jupyter
# MASH analysis pipeline with data-driven prior matrices This notebook is a pipeline written in SoS to run `flashr + mashr` for multivariate analysis described in Urbut et al (2019). This pipeline was last applied to analyze GTEx V8 eQTL data, although it can be used as is to perform similar multivariate analysis for ...
github_jupyter
# Visualisation in Python - Matplotlib Here is the sales dataset for an online retailer. The data is collected over a period of three years: 2012 to 2015. It contains the information of sales made by the company. The products captured belong to three categories: Furniture Office Supplies Technology Also, the comp...
github_jupyter
### Set Data Path ``` from pathlib import Path base_dir = Path("data") train_dir = base_dir/Path("train") validation_dir = base_dir/Path("validation") test_dir = base_dir/Path("test") ``` ### Image Transform Function ``` from torchvision import transforms transform = transforms.Compose([ transforms.Resize((22...
github_jupyter
# Partitioning feature space **Make sure to get latest dtreeviz** ``` ! pip install -q -U dtreeviz ! pip install -q graphviz==0.17 # 0.18 deletes the `run` func I need import numpy as np import pandas as pd from sklearn.linear_model import LinearRegression, Ridge, Lasso, LogisticRegression from sklearn.ensemble impo...
github_jupyter
## Dataset The CIFAR-10 dataset (Canadian Institute For Advanced Research) is a collection of images that are commonly used to train machine learning and computer vision algorithms. It is one of the most widely used datasets for machine learning research. The CIFAR-10 dataset contains 60,000 32x32 color images in 10 d...
github_jupyter
# Self Supervised Learning Fastai Extension > Implementation of popular SOTA self-supervised learning algorithms as Fastai Callbacks. You may find documentation [here](https://keremturgutlu.github.io/self_supervised) and github repo [here](https://github.com/keremturgutlu/self_supervised/tree/master/) ## Install `p...
github_jupyter
# Compute norm from function space ``` from dolfin import * import dolfin as df import numpy as np import logging df.set_log_level(logging.INFO) df.set_log_level(WARNING) mesh = RectangleMesh(0, 0, 1, 1, 10, 10) #mesh = Mesh(Rectangle(-10, -10, 10, 10) - Circle(0, 0, 0.1), 10) V = FunctionSpace(m...
github_jupyter
## Create Data ``` import numpy as np import matplotlib.pyplot as plt from patsy import dmatrix from statsmodels.api import GLM, families def simulate_poisson_process(rate, sampling_frequency): return np.random.poisson(rate / sampling_frequency) def plot_model_vs_true(time, spike_train, firing_rate, conditional_...
github_jupyter
``` # Dependencies import pandas as pd import numpy as np import matplotlib.pyplot as plt from datetime import timedelta import time from datetime import date # Import SQL Alchemy from sqlalchemy import create_engine, ForeignKey, func from sqlalchemy.ext.automap import automap_base from sqlalchemy.orm import Session ...
github_jupyter
## Global Air Pollution Measurements * [Air Quality Index - Wiki](https://en.wikipedia.org/wiki/Air_quality_index) * [BigQuery - Wiki](https://en.wikipedia.org/wiki/BigQuery) In this notebook data is extracted from *BigQuery Public Data* assesible exclusively only in *Kaggle*. The BigQurey Helper Object will convert ...
github_jupyter
# Breast Cancer Wisconsin (Diagnostic) Data Set * **[T81-558: Applications of Deep Learning](https://sites.wustl.edu/jeffheaton/t81-558/)** * Dataset provided by [UCI Machine Learning Repository](https://archive.ics.uci.edu/ml/datasets/Breast+Cancer+Wisconsin+%28Diagnostic%29) * [Download Here](https://raw.githubuserco...
github_jupyter
# Digital Signal Processing This collection of [jupyter](https://jupyter.org/) notebooks introduces various topics of [Digital Signal Processing](https://en.wikipedia.org/wiki/Digital_signal_processing). The theory is accompanied by computational examples written in [IPython 3](http://ipython.org/). The sources of the...
github_jupyter
# Downloading GNSS station locations and tropospheric zenith delays **Author**: Simran Sangha, David Bekaert - Jet Propulsion Laboratory This notebook provides an overview of the functionality included in the **`raiderDownloadGNSS.py`** program. Specifically, we outline examples on how to access and store GNSS statio...
github_jupyter
# MACHINE LEARNING LAB - 4 ( Backpropagation Algorithm ) **4. Build an Artificial Neural Network by implementing the Backpropagation algorithm and test the same using appropriate data sets.** ``` import numpy as np X = np.array(([2, 9], [1, 5], [3, 6]), dtype=float) # X = (hours sleeping, hours studying) y = np...
github_jupyter
# VarEmbed Tutorial Varembed is a word embedding model incorporating morphological information, capturing shared sub-word features. Unlike previous work that constructs word embeddings directly from morphemes, varembed combines morphological and distributional information in a unified probabilistic framework. Varembed...
github_jupyter
# FMskill assignment You are working on a project modelling waves in the Southern North Sea. You have done 6 different calibration runs and want to choose the "best". You would also like to see how your best model is performing compared to a third-party model in NetCDF. The data: * SW model results: 6 dfs0 files t...
github_jupyter
## Instalación de numpy ``` ! pip install numpy import numpy as np ``` ### Array creation ``` my_int_list = [1, 2, 3, 4] #create numpy array from original python list my_numpy_arr = np.array(my_int_list) print(my_numpy_arr) # Array of zeros print(np.zeros(10)) # Array of ones with type int print(np.ones(10, dtype...
github_jupyter
# Lets-Plot in 2020 ### Preparation ``` import numpy as np import pandas as pd import colorcet as cc from PIL import Image from lets_plot import * from lets_plot.bistro.corr import * LetsPlot.setup_html() df = pd.read_csv("https://raw.githubusercontent.com/JetBrains/lets-plot-docs/master/data/lets_plot_git_history.c...
github_jupyter
# LSV Data Analysis and Parameter Estimation ##### First, all relevent Python packages are imported ``` import numpy as np import matplotlib.pyplot as plt %matplotlib inline from scipy.optimize import curve_fit from scipy.signal import savgol_filter, find_peaks, find_peaks_cwt import pandas as pd import math import g...
github_jupyter
# Test: Minimum error discrimination In this notebook we are testing the evolution of the error probability with the number of evaluations. ``` import sys sys.path.append('../../') import itertools import numpy as np import matplotlib.pyplot as plt from numpy import pi from qiskit.algorithms.optimizers import SPSA...
github_jupyter
# Terminologies <img src="https://github.com/dorisjlee/remote/blob/master/astroSim-tutorial-img/terminology.jpg?raw=true",width=20%> - __Domain__ (aka Grids): the whole simulation box. - __Block__(aka Zones): group of cells that make up a larger unit so that it is more easily handled. If the code is run in parallel, y...
github_jupyter
# Single layer Neural Network In this notebook, we will code a single neuron and use it as a linear classifier with two inputs. The tuning of the neuron parameters is done by backpropagation using gradient descent. ``` from sklearn.datasets import make_blobs import numpy as np # matplotlib to display the data import...
github_jupyter
# From raw *.ome.tif file to kinetic properties for immobile particles This notebook will run ... * picasso_addon.localize.main() * picasso_addon.autopick.main() * spt.immobile_props.main() ... in a single run to get from the raw data to the fully evaluated data in a single stroke. We therefore: 1. Define the full ...
github_jupyter
# What are Tensors? ``` # -*- coding: utf-8 -*- import numpy as np # N is batch size; D_in is input dimension; # H is hidden dimension; D_out is output dimension. N, D_in, H, D_out = 64, 1000, 100, 10 # Create random input and output data x = np.random.randn(N, D_in) y = np.random.randn(N, D_out) # Randomly initial...
github_jupyter
#### New to Plotly? Plotly's Python library is free and open source! [Get started](https://plot.ly/python/getting-started/) by downloading 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-fo...
github_jupyter
<small><small><i> All the IPython Notebooks in **[Python Seaborn Module](https://github.com/milaan9/12_Python_Seaborn_Module)** lecture series by **[Dr. Milaan Parmar](https://www.linkedin.com/in/milaanparmar/)** are available @ **[GitHub](https://github.com/milaan9)** </i></small></small> <a href="https://colab.resea...
github_jupyter
``` import pandas as pd import numpy as np import mxnet as mx from mxnet import nd, autograd, gluon, init from mxnet.gluon import nn, rnn import gluonnlp as nlp import pkuseg import multiprocessing as mp import time from d2l import try_gpu import itertools import jieba from sklearn.metrics import accuracy_score, f1_sco...
github_jupyter
TSG088 - Hadoop datanode logs ============================= Steps ----- ### Parameters ``` import re tail_lines = 500 pod = None # All container = "hadoop" log_files = [ "/var/log/supervisor/log/datanode*.log" ] expressions_to_analyze = [ re.compile(".{23} WARN "), re.compile(".{23} ERROR ") ] log_analyz...
github_jupyter
## Project 2: Exploring the Uganda's milk imports and exports A country's economy depends, sometimes heavily, on its exports and imports. The United Nations Comtrade database provides data on global trade. It will be used to analyse the Uganda's imports and exports of milk in 2015: * How much does the Uganda export an...
github_jupyter
``` ################# # Preprocessing # ################# # Scores by other composers from the Bach family have been removed beforehand. # Miscellaneous scores like mass pieces have also been removed; the assumption here is that # since different interpretations of the same piece (e.g. Ave Maria, etc) exist, including...
github_jupyter
# Multilayer Perceptron Some say that 9 out of 10 people who use neural networks apply a Multilayer Perceptron (MLP). A MLP is basically a feed-forward network with 3 layers (at least): an input layer, an output layer, and a hidden layer in between. Thus, the MLP has no structural loops: information always flows from ...
github_jupyter
``` from sklearn.datasets import load_iris # iris dataset from sklearn import tree # for fitting model # for the particular visualization used from six import StringIO import pydot import os.path # to display graphs %matplotlib inline import matplotlib.pyplot # get dataset iris = load_iris() iris.keys() import pand...
github_jupyter
## 1. Volatility changes over time <p>What is financial risk? </p> <p>Financial risk has many faces, and we measure it in many ways, but for now, let's agree that it is a measure of the possible loss on an investment. In financial markets, where we measure prices frequently, volatility (which is analogous to <em>standa...
github_jupyter
``` # Copyright 2019 The Kubeflow Authors. All Rights Reserved. # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
github_jupyter
# トークトリアル 4 # リガンドベーススクリーニング:化合物類似性 #### Developed in the CADD seminars 2017 and 2018, AG Volkamer, Charité/FU Berlin Andrea Morger and Franziska Fritz ## このトークトリアルの目的 このトークトリアルでは、化合物をエンコード(記述子、フィンガープリント)し、比較(類似性評価)する様々なアプローチを取り扱います。さらに、バーチャルスクリーニングを実施します。バーチャルスクリーニングは、ChEMBLデータベースから取得し、リピンスキーのルールオブファイブでフィルタリングをか...
github_jupyter
<a href="https://colab.research.google.com/github/adasegroup/ML2021_seminars/blob/master/seminar13/gp.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ## Gaussian Processes (GP) with GPy In this notebook we are going to use GPy library for GP modeli...
github_jupyter
``` %load_ext autoreload %autoreload 2 from __future__ import print_function import argparse import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from importlib import reload from deeprank.dataset import DataLoader, PairGenerator, ListGenerator from deeprank import utils seed =...
github_jupyter
``` from IPython.display import Image ``` This is a follow on from Tutorial 1 where we browsed the Ocean marketplace and downloaded the imagenette dataset. In this tutorial, we will create a model that trains (and overfits) on the small amount of sample data. Once we know that data interface of the input is compatible...
github_jupyter
``` from matplotlib import pyplot as plt import numpy as np import tensorflow as tf import tensorflow_datasets as tfds tf.__version__ model = tf.keras.models.load_model("runs/machine_translation/2") ``` https://www.tensorflow.org/beta/tutorials/text/transformer#evaluate ``` tokenizer_pt = tfds.features.text.SubwordTe...
github_jupyter
``` import os import pandas as pd from bs4 import BeautifulSoup import sys import re from nltk.stem import PorterStemmer from nltk.tokenize import sent_tokenize, word_tokenize ps = PorterStemmer() print os.getcwd(); # if necessary change the directory #os.chdir('c:\\Users\..') data = pd.read_csv("nightlife_sanfrancisco...
github_jupyter
# Tutorial Part 2: Learning MNIST Digit Classifiers In the previous tutorial, we learned some basics of how to load data into DeepChem and how to use the basic DeepChem objects to load and manipulate this data. In this tutorial, you'll put the parts together and learn how to train a basic image classification model in...
github_jupyter
# QST CGAN with thermal noise in the channel (convolution) ``` import numpy as np from qutip import Qobj, fidelity from qutip.wigner import qfunc from qutip.states import thermal_dm from qutip import coherent_dm from qutip.visualization import plot_wigner_fock_distribution import tensorflow_addons as tfa import te...
github_jupyter
# T008 · Protein data acquisition: Protein Data Bank (PDB) Authors: - Anja Georgi, CADD seminar, 2017, Charité/FU Berlin - Majid Vafadar, CADD seminar, 2018, Charité/FU Berlin - Jaime Rodríguez-Guerra, Volkamer lab, Charité - Dominique Sydow, Volkamer lab, Charité __Talktorial T008__: This talktorial is part of the...
github_jupyter
# Image classification training on a DEBIAI project with a dataset generator This tutorial shows how to classify images of flowers after inserting the project contextual into DEBIAI. Based on the tensorflow tutorial : https://www.tensorflow.org/tutorials/images/classification ``` # Import TensorFlow and other librar...
github_jupyter
``` import os import sys import json import tempfile import pandas as pd import numpy as np import datetime from CoolProp.CoolProp import PropsSI from math import exp, factorial, ceil import matplotlib.pyplot as plt %matplotlib inline cwd = os.getcwd() sys.path.append(os.path.normpath(os.path.join(cwd, '..', '..', ...
github_jupyter
``` %load_ext autoreload %autoreload 2 import re import glob import lzma import pickle import pandas as pd import numpy as np import requests as r import seaborn as sns import warnings import matplotlib as mpl import matplotlib.pyplot as plt from joblib import hash from collections import Counter from sklearn.metrics ...
github_jupyter
``` import pandas as pd import matplotlib.pyplot as plt df = pd.read_excel(r'C:\Users\kundi\Moji_radovi\MVanalysis\datasetup\MV_DataFrame.xlsx') df['Sat'] = df['Uplaćeno'].astype(str).str.slice(-8,-6) df['Datum'] = df['Uplaćeno'].astype(str).str.slice(-19,-13) df.info() df df.drop(columns = ['Uplaćeno'], inplace = Tr...
github_jupyter
# Convolutional Neural Network ## Import Dependencies ``` %matplotlib inline from imp import reload import itertools import numpy as np import utils; reload(utils) from utils import * from __future__ import print_function from sklearn.metrics import confusion_matrix, classification_report, f1_score from keras.prepr...
github_jupyter
# Comparison of the data taken with a long adaptation time (c) 2019 Manuel Razo. This work is licensed under a [Creative Commons Attribution License CC-BY 4.0](https://creativecommons.org/licenses/by/4.0/). All code contained herein is licensed under an [MIT license](https://opensource.org/licenses/MIT) --- ``` impo...
github_jupyter
# DCGAN - Create Images from Random Numbers! ### Generative Adversarial Networks Ever since Ian Goodfellow and colleagues [introduced the concept of Generative Adversarial Networks (GANs)](https://arxiv.org/abs/1406.2661), GANs have been a popular topic in the field of AI. GANs are an application of unsupervised lear...
github_jupyter
# Download Patent DB & Adding Similarity Data The similarity data on its own provides data on patent doc2vec vectors, and some pre-calculated similarity scores. However, it is much more useful in conjunction with a dataset containing other patent metadata. To achieve this it is useful to download a patent dataset and ...
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/explain-model/azure-integration/scoring-time/train-explain-model-on-amlcompute-and-deploy.png) # Tra...
github_jupyter
# Reconstructing MNIST images using Autoencoder Now that we have understood how autoencoders reconstruct the inputs, in this section we will learn how autoencoders reconstruct the images of handwritten digits using the MNIST dataset. In this chapter, we use keras API from the tensorflow for building the models. So ...
github_jupyter
``` # default_exp core ``` # Few-shot Learning with GPT-J > API details. ``` # export import os import pandas as pd #hide from nbdev.showdoc import * import toml s = toml.load("../.streamlit/secrets.toml", _dict=dict) ``` Using `GPT_J` model API from [Nlpcloud](https://nlpcloud.io/home/token) ``` import nlpcloud c...
github_jupyter
# Synthetic Images from simulated data ## Authors Yi-Hao Chen, Sebastian Heinz, Kelle Cruz, Stephanie T. Douglas ## Learning Goals - Assign WCS astrometry to an image using ```astropy.wcs``` - Construct a PSF using ```astropy.modeling.model``` - Convolve raw data with PSF using ```astropy.convolution``` - Calculate...
github_jupyter
# Candlestick Upside Gap Two Crows https://www.investopedia.com/terms/u/upside-gap-two-crows.asp ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import talib import warnings warnings.filterwarnings("ignore") # yahoo finance is used to fetch data import yfinance as yf yf.pdr_override() # ...
github_jupyter
# Slope Analysis This project use the change of holding current slope to identify drug responders. ## Analysis Steps The `getBaselineAndMaxDrugSlope` function smoothes the raw data by the moving window decided by `filterSize`, and analyzes the smoothed holding current in an ABF and returns baseline slope and drug sl...
github_jupyter
# TensorFlow Regression Example ## Creating Data ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt %matplotlib inline # 1 Million Points x_data = np.linspace(0.0,10.0,1000000) noise = np.random.randn(len(x_data)) # y = mx + b + noise_levels b = 5 y_true = (0.5 * x_data ) + 5 + noise my_data...
github_jupyter
# Image classification training with image format 1. [Introduction](#Introduction) 2. [Prerequisites and Preprocessing](#Prerequisites-and-Preprocessing) 1. [Permissions and environment variables](#Permissions-and-environment-variables) 2. [Prepare the data](#Prepare-the-data) 3. [Fine-tuning The Image Classificat...
github_jupyter
## PySpark Data Engineering Practice (Sandboxing) ### Olympic Athlete Data This notebook is for data engineering practicing purposes. During this notebook I want to explore data by using and learning PySpark. The data is from: https://www.kaggle.com/mysarahmadbhat/120-years-of-olympic-history ``` ## Imports from pysp...
github_jupyter
## The Golden Standard In the previous session, we saw why and how association is different from causation. We also saw what is required to make association be causation. $ E[Y|T=1] - E[Y|T=0] = \underbrace{E[Y_1 - Y_0|T=1]}_{ATET} + \underbrace{\{ E[Y_0|T=1] - E[Y_0|T=0] \}}_{BIAS} $ To recap, association becomes ...
github_jupyter
``` import matplotlib.pyplot as plt %matplotlib inline import numpy as np from scipy.stats import poisson, norm def compute_scaling_ratio(mu_drain,mu_demand,drift_sd,init_state): drain_time = init_state/(mu_drain-mu_demand) accum_std = drift_sd*np.sqrt(drain_time) ratio = accum_std/init_state retur...
github_jupyter
# Ridge Regressor with StandardScaler ### Required Packages ``` import warnings import numpy as np import pandas as pd import seaborn as se import matplotlib.pyplot as plt from sklearn.linear_model import Ridge from sklearn.pipeline import Pipeline from sklearn.preprocessing import StandardScaler from skl...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt from latency import run_latency, run_latency_changing_topo, run_latency_per_round, run_latency_per_round_changing_topo, nodes_latency import sys sys.path.append('..') from utils import create_mixing_matrix, load_data, run, consensus ``` # Base case ``` # IID ca...
github_jupyter
``` # import customizing_motif_vec import extract_motif import motif_class import __init__ import json_utility from importlib import reload reload(__init__) reload(extract_motif) # reload(customizing_motif_vec) reload(motif_class) import plot_glycan_utilities reload(plot_glycan_utilities) import matplotlib.pyplot as pl...
github_jupyter
``` import matplotlib.pyplot as plt from matplotlib import style import numpy as np %matplotlib inline style.use('ggplot') x = [20,30,50] y = [ 10,50,13] x2 = [4,10,47,] y2= [56,4,30] plt.plot(x, y, 'r', label='line one', linewidth=5) plt.plot(x2, y2, 'c', label ='line two', linewidth=5) plt.title('Interactive plot'...
github_jupyter
# Svenskt Kvinnobiografiskt lexikon part 5 version part 5 - 0.1 Check SKBL women if Alvin has an authority for the women * this [Jupyter Notebook](https://github.com/salgo60/open-data-examples/blob/master/Svenskt%20Kvinnobiografiskt%20lexikon%20part%205.ipynb) * [part 1](https://github.com/salgo60/open-data-exam...
github_jupyter
[[source]](../api/alibi.explainers.shap_wrappers.rst) # Tree SHAP <div class="alert alert-info"> Note To enable SHAP support, you may need to run: ```bash pip install alibi[shap] ``` </div> ## Overview The tree SHAP (**SH**apley **A**dditive ex**P**lanations) algorithm is based on the paper [From local explan...
github_jupyter
# Using PyTorch with TensorRT through ONNX: TensorRT is a great way to take a trained PyTorch model and optimize it to run more efficiently during inference on an NVIDIA GPU. One approach to convert a PyTorch model to TensorRT is to export a PyTorch model to ONNX (an open format exchange for deep learning models) and...
github_jupyter
``` import pandas as pd import utils import matplotlib.pyplot as plt import random import plotly.express as px import numpy as np random.seed(9000) plt.style.use("seaborn-ticks") plt.rcParams["image.cmap"] = "Set1" plt.rcParams['axes.prop_cycle'] = plt.cycler(color=plt.cm.Set1.colors) %matplotlib inline ``` In this ...
github_jupyter