code
stringlengths
2.5k
150k
kind
stringclasses
1 value
# 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
# Ch 2: Supervised Learning 2.1: Classification and regression ---- Code for Chapter 2 by authors can be found here: https://github.com/amueller/introduction_to_ml_with_python/blob/master/02-supervised-learning.ipynb Two major types of supervised learning: * classification: goal is to predict a class label (discr...
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
# Project: Part of Speech Tagging with Hidden Markov Models --- ### Introduction Part of speech tagging is the process of determining the syntactic category of a word from the words in its surrounding context. It is often used to help disambiguate natural language phrases because it can be done quickly with high accu...
github_jupyter
``` import json import itertools import copy import random def filter_lexicon(lexicon): keys_to_hold = "yellow,red,green,cyan,purple,blue,gray,brown".split(",") deleted_keys = set() for k in lexicon.keys(): if k not in keys_to_hold: deleted_keys.add(k) for k in deleted_keys: ...
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
``` %matplotlib inline ``` 단일 머신을 이용한 모델 병렬화 실습 예제 =================================================== **저자** : `Shen Li <https://mrshenli.github.io/>`_ **번역** : `안상준 <https://github.com/Justin-A>`_ 모델 병렬 처리는 분산 학습 기술에 범용적으로 사용되고 있습니다. 이전 튜토리얼들에서는 'DataParallel' `<https://pytorch.org/tutorials/beginner/blitz/data_p...
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
# Summed Likelihood Analysis with Python This sample analysis shows a way of performing joint likelihood on two data selections using the same XML model. This is useful if you want to do the following: * Coanalysis of Front and Back selections (not using the combined IRF) * Coanalysis of separate time intervals * Coa...
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
``` import numpy as np import tensorflow as tf import matplotlib.pyplot as plt num_epochs = 100 total_series_length = 50000 truncated_backprop_length = 15 state_size = 4 num_classes = 2 echo_step = 3 batch_size = 5 num_batches = total_series_length//batch_size//truncated_backprop_length from numpy import * from matplo...
github_jupyter
<!--NOTEBOOK_HEADER--> *This notebook contains course material from [CBE30338](https://jckantor.github.io/CBE30338) by Jeffrey Kantor (jeff at nd.edu); the content is available [on Github](https://github.com/jckantor/CBE30338.git). The text is released under the [CC-BY-NC-ND-4.0 license](https://creativecommons.org/lic...
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
# Passive and active colloidal chemotaxis in a microfluidic channel: mesoscopic and stochastic models **Author:** Pierre de Buyl *Supplemental information to the article by L. Deprez and P. de Buyl* This notebook reports the characterization of the diffusion coefficients for a rigid dimer confined between plates. ...
github_jupyter
# Project for Machine Learning and Statistics - December 2021 ## Submitted by Sinéad Duffy, ID 10016151 *** ## Notebook 2 - Scipy-stats.ipynb ### Brief - write an overview of the SciPy.stats library, outline (using examples) the package and complete an example hypothesis using ANOVA *** ![SciPyStatsLogo.png](atta...
github_jupyter
``` EPOCHS = 40 LR = 3e-4 BATCH_SIZE_TWO = 1 HIDDEN =20 MEMBERS = 3 import pandas as pd import numpy as np import random import torch import torch.nn.functional as F import torch.nn as nn from torchinfo import summary import re import string import torch.optim as optim from torchtext.legacy import data from torch.ut...
github_jupyter
``` import numpy as np import sys class PartyNN(object): def __init__(self, learning_rate=0.1): self.weights_0_1 = np.random.normal(0.0, 2 ** -0.5, (2, 3)) self.weights_1_2 = np.random.normal(0.0, 1, (1, 2)) self.sigmoid_mapper = np.vectorize(self.sigmoid) self.learning_rate = np.ar...
github_jupyter
``` import sqlite3 as sl import pandas as pd # type: ignore COLORS_by_TYPE = { 'fire': 'red', 'water': '#09E1FF', 'normal': '#1DFDA8', 'poison': '#B918FF', 'electric': 'yellow', 'ground': '#FF9C15', 'fairy': '#FF69B4', 'grass': '#34FF5C', 'bug': '#90EE38', 'psychic': '#B71ECF'...
github_jupyter
#### Import Dependencies ``` import os import gc gc.enable() import math import json import time import random import multiprocessing import warnings warnings.filterwarnings("ignore", category=UserWarning) import numpy as np import pandas as pd from tqdm import tqdm, trange from sklearn import model_selection import...
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
# Gas Price Prediction with Recurrent Neural Networks (Hourly, Window 2) This notebook contains the generic RNN model used in the thesis project. The experiment includes two extracted datasets of a predefined gas station. The first dataset contains the daily maximum prices, while the other contains data of hourly gran...
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
Added custom loss function base on @kyakvolev 's work. Credit to the author. The forum post is here: https://www.kaggle.com/c/m5-forecasting-uncertainty/discussion/139515 ``` import pandas as pd import numpy as np import matplotlib.pyplot as plt from tqdm.auto import tqdm as tqdm from ipywidgets import widgets, inte...
github_jupyter
# Analysis of NFL csv data for analysis ``` import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) from math import pi # import seaborn as sns # import matplotlib as plt data_dir = '../seasonData/' ``` use 2009 data as a test set ``` df_2009 = pd.read_csv(data_dir+...
github_jupyter
# Week 3 ## Introduction to Solid State ``` import numpy as np import matplotlib.pyplot as plt import os import subprocess from polypy.read import History from polypy.msd import MSD from polypy import plotting def get_diffusion(file, atom): with open(file) as f: y = False for line in f: ...
github_jupyter
``` import pywt import numpy as np import pandas as pa import sqlite3, os from skimage.restoration import denoise_wavelet import matplotlib.pyplot as plt import warnings import ruptures as rpt from scipy.signal import savgol_filter, medfilt import numpy as np import pylab as pl from scipy.signal import hilbert from sci...
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
# CaseLaw dataset to assist with Law-Research - EDA --- <dl> <dt>Acquiring the dataset</dt> <dd>We initially use dataset of all cases in USA to be able to train it and as a proof of concept.</dd> <dd>The dataset is available in XML format, which we will put in mongodb or firebase format based on how unstructured ...
github_jupyter
## HOWTO estimate parameter-errors using Monte Carlo - an example with python Will Clarkson, Sat March 8th 2014 UPDATED Sun March 14th 2021 with more recent system version and a few other minor style updates (now runs on python 3 and should be backwards-compatible to python 2.7). I have started the process of updat...
github_jupyter
# Fine tuning Marian-NMT en-ru model ## Установка зависимостей ``` !pip install datasets transformers[sentencepiece] !pip install sacrebleu !pip install accelerate !pip install openpyxl !apt install git-lfs !pip install matplotlib # загрузим репозиторий; нужен для предобработки !git clone https://github.com/eleldar/T...
github_jupyter
``` from lenslikelihood.power_spectra import * mass_function_model = 'rodriguezPuebla2016' normalization = 'As' pivot_string = '1' pivot = 1.0 structure_formation_interp_As = load_interpolated_mapping(mass_function_model, pivot_string) import numpy as np import matplotlib.pyplot as plt import matplotlib.cm as cm impo...
github_jupyter
# Training Neural Networks The network we built in the previous part isn't so smart, it doesn't know anything about our handwritten digits. Neural networks with non-linear activations work like universal function approximators. There is some function that maps your input to the output. For example, images of handwritt...
github_jupyter
# Anchor Boxes :label:`sec_anchor` Object detection algorithms usually sample a large number of regions in the input image, determine whether these regions contain objects of interest, and adjust the edges of the regions so as to predict the ground-truth bounding box of the target more accurately. Different models may...
github_jupyter
# "Analise casos de SRAG em crianças e adolecentes" > "Dados dos casos de hospitalizações por SRAG do opendatasus" - toc: true - branch: master - badges: false - comments: false - numbersections: true - categories: [srag] - image: images/some_folder/your_image.png - hide:false - search_exclude: true - metadata_key1: m...
github_jupyter
TSG034 - Livy logs ================== Description ----------- Steps ----- ### Parameters ``` import re tail_lines = 500 pod = None # All container = 'hadoop-livy-sparkhistory' log_files = [ '/var/log/supervisor/log/livy*' ] expressions_to_analyze = [ re.compile(".{17} WARN "), re.compile(".{17} ERROR ") ...
github_jupyter
``` from bs4 import BeautifulSoup import requests from urllib.parse import urljoin import re import numpy as np import pandas as pd import json ``` ## Dataset Generation Stats scraped from basketball reference ``` nba_champion_url = 'https://www.basketball-reference.com/playoffs/' nba_team_stats_url = 'https://www.b...
github_jupyter
# Taxi Price Prediction Competition - Team 40 - Aditya Sidharta ## Overall Pipeline In this Taxi price prediction competition, we were asked to build a model which is able to predict the price of a taxi ride, by predicting the duration and the trajectory length of the taxi ride. Then, we will sum the values of the tw...
github_jupyter
# Training and Evaluating Machine Learning Models in cuML This notebook explores several basic machine learning estimators in cuML, demonstrating how to train them and evaluate them with built-in metrics functions. All of the models are trained on synthetic data, generated by cuML's dataset utilities. 1. Random Fores...
github_jupyter
# Radiative Cores & Convective Envelopes Analysis of how magnetic fields influence the extent of radiative cores and convective envelopes in young, pre-main-sequence stars. Begin with some preliminaries. ``` %matplotlib inline import numpy as np import matplotlib.pyplot as plt from scipy.interpolate import interp1d ...
github_jupyter
DIFAX Replication ================= This example replicates the traditional DIFAX images for upper-level observations. By: Kevin Goebbert Observation data comes from Iowa State Archive, accessed through the Siphon package. Contour data comes from the GFS 0.5 degree analysis. Classic upper-level data of Geopotential ...
github_jupyter
<a href="https://colab.research.google.com/github/Cknowles11/DS-Unit-2-Applied-Modeling/blob/master/Copy_of_LS_DS_233_assignment.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> Lambda School Data Science *Unit 2, Sprint 3, Module 3* --- # Permut...
github_jupyter
``` # Decorator Introduction def func(): return 1 print(func()) print(func) # that means we can assign this function to a variable def hello(): return "Hello" greet = hello print(hello) print(greet()) # Delete hello del hello try: print(hello()) except NameError: print("hello() is not defined") prin...
github_jupyter
# Section 2 - Neural Networks ## Lesson 1 - Introduction to Neural Networks ### 27. The Gradient Descent Algorithm ``` import matplotlib.pyplot as plt import numpy as np import pandas as pd #Some helper functions for plotting and drawing lines def plot_points(X, y): admitted = X[np.argwhere(y==1)] rejected...
github_jupyter
``` import torch import torch.nn as nn import torchvision import torchvision.transforms as transforms import torch.optim as optim import numpy as np import pandas as pd # Hyperparameters input_size = 28 * 28 # 784 num_classes = 10 num_epochs = 5 batch_size = 100 lr = 0.01 # MNIST dataset (images and labels) train_d...
github_jupyter
``` !pip install splinter #Import Dependencies from splinter import Browser from bs4 import BeautifulSoup import requests import re import pandas as pd import pymongo from selenium import webdriver from selenium.webdriver.chrome.service import Service ``` NASA Mars News¶ Scrape the NASA Mars News Site and collect the...
github_jupyter
# Creating a Sentiment Analysis Web App ## Using PyTorch and SageMaker _Deep Learning Nanodegree Program | Deployment_ --- Now that we have a basic understanding of how SageMaker works we will try to use it to construct a complete project from end to end. Our goal will be to have a simple web page which a user can u...
github_jupyter
# Description This notebook contains the interpretation of a cluster (which features/latent variables in the original data are useful to distinguish traits in the cluster). See section [LV analysis](#lv_analysis) below # Modules loading ``` %load_ext autoreload %autoreload 2 import pickle import re from pathlib imp...
github_jupyter
<a href="https://colab.research.google.com/github/z-arabi/notebooks/blob/main/01_introduction.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` # Uncomment and run this cell if you're on Colab or Kaggle !git clone https://github.com/nlp-with-trans...
github_jupyter
# Lecture 55: Adversarial Autoencoder for Classification ## Load Packages ``` %matplotlib inline import os import math import torch import itertools import torch.nn as nn import torch.optim as optim from IPython import display import torch.nn.functional as F import matplotlib.pyplot as plt import torchvision.datasets...
github_jupyter
# LightGBM ## Single Prediction ``` from backend.api.prediction import initialize_pipeline config_path = "/home/joseph/Coding/ml_projects/earthquake_forecasting/backend/config.yml" lgb_pipeline = initialize_pipeline(config_path, "lightgbm") lgb_pipeline import pandas as pd data = { "building_id": ...
github_jupyter
``` from collections import defaultdict import pyspark.sql.types as stypes import operator import math d = sc.textFile("gs://lbanor/dataproc_example/data/2017-11-01").zipW r = (sc.textFile("gs://lbanor/dataproc_example/data/2017-11-01").zipWithIndex() .filter(lambda x: x[1] > 0) .map(lambda x: x[0].split(',')...
github_jupyter
# SQL ``` import psycopg2 import sys, os import numpy as np import pandas as pd import example_psql as creds import pandas.io.sql as psql # Create connection to postgresql import example_psql as creds from sqlalchemy import create_engine engine = create_engine(f'postgresql://{creds.PGUSER}:{creds.PGPASSWORD}@{creds.PG...
github_jupyter
##### Copyright 2021 The TensorFlow Federated 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 applicab...
github_jupyter
<em><sub>This page is available as an executable or viewable <strong>Jupyter Notebook</strong>:</sub></em> <br/><br/> <a href="https://mybinder.org/v2/gh/JetBrains/lets-plot/v1.5.2demos1?filepath=docs%2Fexamples%2Fjupyter-notebooks%2Fmap_titanic.ipynb" target="_parent"> <img align="left" src="https://mybi...
github_jupyter
``` import os import json import tensorflow as tf import numpy as np import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns from matplotlib import cm from tensor2tensor import problems from tensor2tensor import models from tensor2tensor.bin import t2t_decoder # To register the h...
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
# T & T Lab 8 - 27th Jan ## Manish Ranjan Behera - 1828249 ### WAP TO PRINT THIS PATTERN AND TAKE THE NO OF LINES AS INPUT FROM USER ![Screenshot%202021-01-29%20224420.png](attachment:Screenshot%202021-01-29%20224420.png) ``` n=int(input("Enter Size:")) for i in range(n,0,-1): if i==n: print("*"*((2*n)-1...
github_jupyter
# Feature Engineering and Labeling We'll use the price-volume data and generate features that we can feed into a model. We'll use this notebook for all the coding exercises of this lesson, so please open this notebook in a separate tab of your browser. Please run the following code up to and including "Make Factor...
github_jupyter
# Introduction to Linear Algebra This is a tutorial designed to introduce you to the basics of linear algebra. Linear algebra is a branch of mathematics dedicated to studying the properties of matrices and vectors, which are used extensively in quantum computing to represent quantum states and operations on them. This...
github_jupyter
``` import gym import numpy as np import torch import wandb import pandas as pd import argparse import pickle import random import sys sys.path.append('/Users/shiro/research/projects/rl-nlp/can-wikipedia-help-offline-rl/code') from decision_transformer.evaluation.evaluate_episodes import ( evaluate_episode, ...
github_jupyter
Author: Vo, Huynh Quang Nguyen # Acknowledgments The contents of this note are based on the lecture notes and the materials from the sources below. All rights reserved to respective owners. 1. **Deep Learning** textbook by Dr Ian Goodfellow, Prof. Yoshua Bengio, and Prof. Aaron Courville. Available at: [Deep Learnin...
github_jupyter
<a href="https://colab.research.google.com/github/andrewcgaitskell/dmtoolnotes/blob/main/Lists%2C_Arrays%2C_Tensors%2C_Dataframes%2C_and_Datasets.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> https://colab.research.google.com/github/tensorpig/lear...
github_jupyter
# Movie Review Text Classification with Text processing This tutorial: https://www.tensorflow.org/tutorials/keras/text_classification ``` !pip install -q tf-nightly import tensorflow as tf from tensorflow import keras !pip install -q tfds-nightly import tensorflow_datasets as tfds tfds.disable_progress_bar() import ...
github_jupyter
``` import pandas as pd import numpy as np from analysis_utils import * PAREDAO = "paredao13" CAND1_PATH = "data/paredao13/flay.csv" CAND2_PATH = "data/paredao13/thelma.csv" CAND3_PATH = "data/paredao13/babu.csv" DATE = 3 IGNORE_HASHTAGS = ["#bbb20", "#redebbb", "#bbb2020"] candidate1_df = pd.read_csv(CAND1_PATH) candi...
github_jupyter
``` # -*- coding: utf-8 -*- """ Created on Fri Nov 27 23:01:16 2015 @author: yilin """ # useful code: https://www.kaggle.com/cast42/rossmann-store-sales/xgboost-in-python-with-rmspe-v2/code import pandas as pd import numpy as np import re from dateutil.parser import parse import random import matplotlib.pyplot as plt ...
github_jupyter
## Installation ``` !pip install -q --upgrade transformers datasets tokenizers !pip install -q emoji pythainlp sklearn-pycrfsuite seqeval !rm -r thai2transformers thai2transformers_parent !git clone -b dev https://github.com/vistec-AI/thai2transformers/ !mv thai2transformers thai2transformers_parent !mv thai2transfo...
github_jupyter
# Pre-Processing Methods ``` %%capture !pip3 install sparqlwrapper # Common methods to retrieve data from Wikidata import time from SPARQLWrapper import SPARQLWrapper, JSON import pandas as pd import urllib.request as url import json from SPARQLWrapper import SPARQLWrapper wiki_sparql = SPARQLWrapper("https://quer...
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
# Appendix E: Validation of FDR’s control of false positive node proportion This appendix contains RFT and FDR results (Fig.E1) from six experimental datasets and a total of eight different analyses (Table E1) that were conducted but were not included in the main manuscript. The datasets represent a variety of biomec...
github_jupyter
``` import matplotlib.pyplot as plt %matplotlib inline import numpy as np import numexpr as ne from scipy.ndimage import correlate1d from dphutils import scale import scipy.signal from timeit import Timer import pyfftw # test monkey patching (it doesn't work for rfftn) a = pyfftw.empty_aligned((512, 512), dtype='comp...
github_jupyter
# Exploratory Data Analysis Statistical functions can be found here: https://nbviewer.org/github/AllenDowney/empiricaldist/blob/master/empiricaldist/dist_demo.ipynb ``` import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt %matplotlib inline sns.set() ``` ## Question: What's t...
github_jupyter
# Using matplotlib basemap to project California data ``` %matplotlib inline import pandas as pd, numpy as np, matplotlib.pyplot as plt from geopandas import GeoDataFrame from mpl_toolkits.basemap import Basemap from shapely.geometry import Point # define basemap colors land_color = '#F6F6F6' water_color = '#D2F5FF' c...
github_jupyter
## Summarize all common compounds and their percent strong scores ``` suppressPackageStartupMessages(library(dplyr)) suppressPackageStartupMessages(library(ggplot2)) suppressPackageStartupMessages(library(patchwork)) source("viz_themes.R") source("plotting_functions.R") source("data_functions.R") results_dir <- file....
github_jupyter
# Parameter Values In this notebook, we explain how parameter values are set for a model. Information on how to add parameter values is provided in our [online documentation](https://pybamm.readthedocs.io/en/latest/tutorials/add-parameter-values.html) ## Setting up parameter values ``` %pip install pybamm -q # in...
github_jupyter
# Talks markdown generator for academicpages Adapted from generator in academicpages Takes a TSV of talks with metadata and converts them for use with [academicpages.github.io](academicpages.github.io). This is an interactive Jupyter notebook ([see more info here](http://jupyter-notebook-beginner-guide.readthedocs.io...
github_jupyter
# Under and over fitting > Validation and learning curves - toc: true - badges: false - comments: true - author: Cécile Gallioz - categories: [sklearn] # Underfitting vs. Overfitting - Actual vs estimated function [scikit-learn documentation](https://scikit-learn.org/stable/auto_examples/model_selection/plot_underfit...
github_jupyter
# **Spit some [tensor] flow** We need to learn the intricacies of tensorflow to master deep learning `Let's get this over with` ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import tensorflow as tf import cv2 print(tf.__version__) ``` ## A time series is just a TxD matrix right? so in...
github_jupyter
# Classifying Ionosphere structure using K nearest neigbours algorithm <hr> ### Nearest neighbors Amongst the standard machine algorithms, Nearest neighbors is perhaps one of the most intuitive algorithms. To predict the class of a new sample, we look through the training dataset for the samples that are most similar ...
github_jupyter
# Notebook 4: Quantum operations and distance In this notebook we will be taking a closer look at quantum operations, i.e. parts of a quantum circuit that are _not necessarily_ unitary. ``` import numpy as np # Import cirq, install it if it's not installed. try: import cirq except ImportError: print("install...
github_jupyter
``` #load watermark %load_ext watermark %watermark -a 'Gopala KR' -u -d -v -p watermark,numpy,pandas,matplotlib,nltk,sklearn,tensorflow,theano,mxnet,chainer,seaborn,keras,tflearn,bokeh,gensim from preamble import * %matplotlib inline ``` ## Algorithm Chains and Pipelines ``` from sklearn.svm import SVC from sklearn.d...
github_jupyter
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/jfcrenshaw/pzflow/blob/main/examples/marginalization.ipynb) If running in Colab, to switch to GPU, go to the menu and select Runtime -> Change runtime type -> Hardware accelerator -> GPU. In addition,...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt from scipy import ndimage as ndi import os from PIL import Image import PIL.ImageOps from skimage.morphology import watershed from skimage.feature import peak_local_max from skimage.filters import threshold_otsu from skimage.morphology import binary_closing f...
github_jupyter
# Rerank with MonoT5 ``` !nvidia-smi from pygaggle.rerank.base import Query, Text from pygaggle.rerank.transformer import MonoT5 from trectools import TrecRun import ir_datasets monoT5Reranker = MonoT5() DIR='/mnt/ceph/storage/data-in-progress/data-teaching/theses/wstud-thesis-probst/retrievalExperiments/runs-ecir22...
github_jupyter
# Python for Policy Analysts ## Session 0: Setting Up Python Created by: O Downs (odowns@berkeley.edu) Instructor Edition ### Goals: * Getting you started with Python! * Download Anaconda, which will facilitate your Python use * Understand Terminal commands * Learn how to `pip install` * Learn how to start up a J...
github_jupyter
# Hurricane Ike Maximum Water Levels Compute the maximum water level during Hurricane Ike on a 9 million node triangular mesh storm surge model. Plot the results with Datashader. ``` import xarray as xr import numpy as np import pandas as pd import hvplot.xarray import fsspec from dask.distributed import Client, prog...
github_jupyter
# GitHub : Le réseau social des développeurs grâce à Git _Auteur_: Hugo Ducommun _Date_: 30 Mai 2019 _GitHub_ est un plateforme de projets de jeunes développeurs motivés qui souhaient publier leur travail de manière libre (OpenSource). _GitHub_ est connu pour être pratique lorsqu'on travaille en équipe. Il permet à ...
github_jupyter
``` import numpy as np from nose.tools import assert_almost_equal, assert_almost_equals, assert_equal ``` Ответами на задачи являются функции. Они будут проверены автоматическими тестами на стороне сервера. Некоторые тесты выполняются локально для самопроверки. ### Вопросы для самоконтроля Эта часть задания не оце...
github_jupyter
# [Applied Statistics](https://lamastex.github.io/scalable-data-science/as/2019/) ## 1MS926, Spring 2019, Uppsala University &copy;2019 Raazesh Sainudiin. [Attribution 4.0 International (CC BY 4.0)](https://creativecommons.org/licenses/by/4.0/) # 11. Non-parametric Estimation and Testing ### Topics - Non-parametric...
github_jupyter
<a href="https://colab.research.google.com/github/davemcg/scEiaD/blob/master/colab/cell_type_ML_labelling.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Auto Label Retinal Cell Types ## tldr You can take your (retina) scRNA data and fairly qui...
github_jupyter