text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
# Hidden Markov Model Demo A Hidden Markov Model (HMM) is one of the simpler graphical models available in _SSM_. This notebook demonstrates creating and sampling from and HMM using SSM, and fitting an HMM to synthetic data. A full treatment of HMMs is beyond the scope of this notebook, but there are many good resourc...
github_jupyter
--- _You are currently looking at **version 1.0** of this notebook. To download notebooks and datafiles, as well as get help on Jupyter notebooks in the Coursera platform, visit the [Jupyter Notebook FAQ](https://www.coursera.org/learn/python-data-analysis/resources/0dhYG) course resource._ --- # Merging Dataframes ...
github_jupyter
``` %matplotlib inline ``` # Visualizing Part-of-Speech Tagging with Yellowbrick This notebook is a sample of the text visualizations that yellowbrick provides, in particular a feature that enables visual part-of-speech tagging, which can be used to make decisions about text normalization and vectorization. ``` impo...
github_jupyter
##### Copyright 2021 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
``` # for use in tutorial and development; do not include this `sys.path` change in production: import sys ; sys.path.insert(0, "../") ``` # Vector embedding with `gensim` Let's make use of deep learning through a technique called *embedding* – to analyze the relatedness of the labels used for recipe ingredients. Am...
github_jupyter
``` import nltk ``` # 1、Sentences Segment(分句) ``` sent_tokenizer = nltk.data.load('tokenizers/punkt/english.pickle') paragraph = "The first time I heard that song was in Hawaii on radio. I was just a kid, and loved it very much! What a fantastic song!" sentences = sent_tokenizer.tokenize(paragraph) sentences ``` ...
github_jupyter
This notebook shows how to calculate all the angles. There are three major functions for the calculation. The <code>filter_sensor_points_to_cube_id</code> function returns only the sensor points that corresponds to one HSI cube. This significantly increases the efficiency and make the process faster. The second functio...
github_jupyter
<img src="https://drive.google.com/uc?id=1E_GYlzeV8zomWYNBpQk0i00XcZjhoy3S" width="100"/> # DSGT Bootcamp Week 1: Introduction and Environment Setup # Learning Objectives 1. Gain an understanding of Google Colab 2. Introduction to team project 3. Gain an understanding of Kaggle 4. Download and prepare dataset 5. Ins...
github_jupyter
## Figure 12 Similar to [Figure 5](https://github.com/EdwardJKim/astroclass/blob/master/paper/notebooks/figure05/purity_mag_integrated.ipynb) but for the reduced training set. ``` from __future__ import division, print_function, unicode_literals %matplotlib inline import numpy as np from scipy.special import gammaln ...
github_jupyter
``` Copyright 2021 IBM Corporation 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 applicable law or agreed to in writing, softwa...
github_jupyter
## YUV color space Colors in images can be encoded in different ways. Most well known is perhaps the RGB-encoding, in which the image consists of a Red, Green, and Blue channel. However, there are many other encodings, which sometimes have arisen for historical reasons or to better comply with properties of human perce...
github_jupyter
``` a=5 print(a) import numpy as np np.pi import pandas as pd data = pd.read_csv("./data_SNat/BRGM_Mayotte_2018.txt",delimiter = "\t") print(data.head()) import matplotlib.pyplot as plt plt.plot(data['sec'],data['mag']) plt.show() from Codes_Graphes.OmoriUtsu import GraphOmoriUtsu,RegressionOU,RegressionOU_foreshock a,...
github_jupyter
``` import os os.environ['CASTLE_BACKEND'] = 'pytorch' from collections import OrderedDict import warnings import numpy as np import networkx as nx import ges from castle.common import GraphDAG from castle.metrics import MetricsDAG from castle.datasets import IIDSimulation, DAG from castle.algorithms import PC, ICAL...
github_jupyter
# Оценка pi ($\pi$) с использованием квантового алгоритма оценки фазы # Оценка pi ($\pi$) с использованием квантового алгоритма оценки фазы. ## 1. Краткий обзор [квантового алгоритма оценки фазы](https://qiskit.org/textbook/ch-algorithms/quantum-phase-estimation.html) Quantum Phase Estimation (QPE) is a quantum algo...
github_jupyter
``` %pylab inline import numpy as np import seaborn as sns from tqdm import tqdm from laika.lib.coordinates import LocalCoord, ecef2geodetic # A practical way to confirm the accuracy of laika's processing # is by downloading some observation data from a CORS station # and confirming our position estimate to the known p...
github_jupyter
# T81-558: Applications of Deep Neural Networks **Module 6: Convolutional Neural Networks (CNN) for Computer Vision** * Instructor: [Jeff Heaton](https://sites.wustl.edu/jeffheaton/), McKelvey School of Engineering, [Washington University in St. Louis](https://engineering.wustl.edu/Programs/Pages/default.aspx) * For mo...
github_jupyter
# Union and intersection of rankers Let's build a pipeline using union `|` and intersection `&` operators. ``` %load_ext autoreload %autoreload 2 from cherche import data, rank, retrieve from sentence_transformers import SentenceTransformer ``` The first step is to define the corpus on which we will perform the neur...
github_jupyter
## <small> Copyright (c) 2017-21 Andrew Glassner Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, ...
github_jupyter
``` import os from os.path import join, dirname import cv2 import lmdb import pickle import matplotlib.pyplot as plt import numpy as np dataset_name = 'rscd' data_path = join('/home/zhong/Dataset',dataset_name) lmdb_path = join('/home/zhong/Dataset',dataset_name+'_lmdb') for dataset_part in ['train', 'valid', 'test']: ...
github_jupyter
``` #This function gets the raw data and clean it def data_clean(data): print("Data shape before cleaning:" + str(np.shape(data))) #Change the data type of any column if necessary. print("Now it will print only those columns with non-numeric values") print(data.select_dtypes(exclud...
github_jupyter
``` # Copyright 2019 NVIDIA Corporation. 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 applica...
github_jupyter
<!-- :Author: Arthur Goldberg <Arthur.Goldberg@mssm.edu> --> <!-- :Date: 2020-07-13 --> <!-- :Copyright: 2020, Karr Lab --> <!-- :License: MIT --> # DE-Sim tutorial DE-Sim is an open-source, object-oriented, discrete-event simulation (OO DES) tool implemented in Python. DE-Sim makes it easy to build and simulate discr...
github_jupyter
# First Steps with Huggingface ``` from IPython.display import display, Markdown with open('../../doc/env_variables_setup.md', 'r') as fh: content = fh.read() display(Markdown(content)) ``` ## Import Packages Try to avoid 'pip install' in the notebook. This can destroy dependencies in the env. ``` # only runnin...
github_jupyter
# 使用SentimentNet实现情感分类 `GPU` `CPU` `进阶` `自然语言处理` `全流程` [![在线运行](https://gitee.com/mindspore/docs/raw/master/resource/_static/logo_modelarts.png)](https://authoring-modelarts-cnnorth4.huaweicloud.com/console/lab?share-url-b64=aHR0cHM6Ly9taW5kc3BvcmUtd2Vic2l0ZS5vYnMuY24tbm9ydGgtNC5teWh1YXdlaWNsb3VkLmNvbS9ub3RlYm9vay9tY...
github_jupyter
# Datasets to download Here we list a few datasets that might be interesting to explore with vaex. ## New York taxi dataset The very well known dataset containing trip infromation from the iconic Yellow Taxi company in NYC. The raw data is curated by the [Taxi & Limousine Commission (TLC)]( https://www1.nyc.gov/site...
github_jupyter
``` # Setting up a model and a mesh for the MT forward problem import SimPEG as simpeg, sys import numpy as np from SimPEG import NSEM import telluricpy import matplotlib.pyplot as plt %matplotlib inline import copy # Define the area of interest bw, be = 557100, 557580 bs, bn = 7133340, 7133960 bb, bt = 0,480 ``` # Bu...
github_jupyter
## List comprehensions A *list comprehension* is a compact way to construct a new collection by performing operations on some or all of the elements of another collection It is a powerful and succinct way to specify a data transformation (from one collection to another). General form: `[ expression for-clause condi...
github_jupyter
# Images to Text: A Gentle Introduction to Optical Character Recognition with PyTesseract ***How to install & run the course notebooks on your own computer*** For this course, we've been working in Jupyter Notebooks hosted on [Binder](https://binder.constellate.org/). If you want to host your own materials in Binder,...
github_jupyter
``` import torchaudio as ta import torch from torch.utils.data import DataLoader import torch.nn as nn import torch.nn.functional as F import torch.autograd.profiler as profiler # import pytorch_lightning as pl import numpy as np import os import IPython.display as ipd import numpy as np import math import glob f...
github_jupyter
``` from google.colab import drive drive.mount('/content/drive') path = '/content/drive/MyDrive/Research/AAAI/dataset1/second_layer_with_entropy/' import numpy as np import pandas as pd import torch import torchvision from torch.utils.data import Dataset, DataLoader from torchvision import transforms, utils import tor...
github_jupyter
``` import pandas as pd import janitor as jn import pymc3 as pm import matplotlib.pyplot as plt import seaborn as sns import numpy as np from utils import ECDF import arviz as az %load_ext autoreload %autoreload 2 %matplotlib inline %config InlineBackend.figure_format = 'retina' ``` # Darwin's Finches A research gro...
github_jupyter
Trees and diversity estimates for molecular markers. Env from 62_phylo_reduced. After first run and evaluation, manually resolve problems with selected sequences (on plate fasta level): - VBS00055 (aconitus) its2 trimmed 3' - weak signal, multipeaks - VBS00021,VBS00022,VBS00023 (barbirostris) its2 re-trimmed to the sa...
github_jupyter
<!-- dom:TITLE: PHY321: Two-body problems, gravitational forces, scattering and begin Lagrangian formalism --> # PHY321: Two-body problems, gravitational forces, scattering and begin Lagrangian formalism <!-- dom:AUTHOR: [Morten Hjorth-Jensen](http://mhjgit.github.io/info/doc/web/) at Department of Physics and Astronom...
github_jupyter
ENS'IA - Session 4: Convolutional neural networks ----- Today, we move on to **Convolutional neural networks (CNN)**! These are neural networks specialized in image processing. You will implement a basic CNN architecture and learn some techniques to boost your scores! Let's load the libraries we will use along with t...
github_jupyter
<a href="https://colab.research.google.com/github/arthurflor23/handwritten-text-recognition/blob/master/src/tutorial.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> <img src="https://github.com/arthurflor23/handwritten-text-recognition/blob/master/d...
github_jupyter
# Kili Tutorial: How to leverage Counterfactually augmented data to have a more robust model This recipe is inspired by the paper *Learning the Difference that Makes a Difference with Counterfactually-Augmented Data*, that you can find here on [arXiv](https://arxiv.org/abs/1909.12434) In this study, the authors point...
github_jupyter
## by Jan Willem de Gee (jwdegee@gmail.com) ``` import sys, os import numpy as np import pandas as pd import matplotlib as mpl mpl.rcParams['pdf.fonttype'] = 42 import matplotlib.pyplot as plt import seaborn as sns import hddm from joblib import Parallel, delayed from IPython import embed as shell ``` Let's start wi...
github_jupyter
``` %matplotlib inline import numpy as np import matplotlib.pyplot as plt #defining the function def function_for_roots(x): #defining the function where we are finding the roots a = 1.01 #using variables for the constants b = -3.04 c = 2.07 return a*x**2 + b*x + c # finding the roots...
github_jupyter
# Tutorial: FICO Explainable Machine Learning Challenge In this tutorial, we use the dataset form the FICO Explainable Machine Learning Challenge: https://community.fico.com/s/explainable-machine-learning-challenge. The goal is to create a pipeline by combining a binning process and logistic regression to obtain an ex...
github_jupyter
# Sales Analysis Source: [https://github.com/d-insight/code-bank.git](https://github.com/d-insight/code-bank.git) License: [MIT License](https://opensource.org/licenses/MIT). See open source [license](LICENSE) in the Code Bank repository. ------------- #### Import libraries ``` import os import pandas as pd ``` ...
github_jupyter
### **Import Google Drive** ``` from google.colab import drive drive.mount('/content/drive') ``` ### **Import Library** ``` import glob import numpy as np import os import shutil np.random.seed(42) from sklearn.preprocessing import LabelEncoder import cv2 import tensorflow as tf import keras import shutil import ran...
github_jupyter
# Generative Adversarial Networks This code is based on https://arxiv.org/abs/1406.2661 paper from Ian J. Goodfellow, Jean Pouget-Abadie, et all ![title](https://github.com/DSC-UI-SRIN/Introduction-to-GAN/raw/master/1%20-%20Fundamental%20of%20GANs/images/minmax.png) ``` from google.colab import drive drive.mount('/co...
github_jupyter
``` # Imports import matplotlib import matplotlib.pyplot as plt import numpy as np import pandas as pd plt.rcParams['figure.figsize'] = (15.0, 8.0) # set default size of plots plt.rcParams['figure.facecolor'] = 'white' pd.set_option('display.max_rows', None) matplotlib.rcParams.update({'font.size': 15}) test_column_...
github_jupyter
# Using Web Processing Service (WPS) with the Defra Earth Observation Data Service API This notebook introduces the concept of the Web Processing Service (WPS) which enables users to submit instructions to the EO Data Service to return outputs. The instructions are contained in the XML files provided. Please ensure th...
github_jupyter
``` import warnings warnings.filterwarnings('ignore') import re import time import numpy as np import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline import pandas as pd pd.options.display.max_columns = None pd.options.display.mpl_style = 'default' from nltk.tokenize import word_tokenize from util3 im...
github_jupyter
## Normal Distribution Normal Distribution will is the distribution which calculates popularity of the population. This will get discussed on including standard deviation to determine Z score of particular value. ![jpeg](../galleries/coursera-statistics/2w40.jpg) *Screenshot taken from [Coursera](https://class.cours...
github_jupyter
# Test CKA ``` import numpy as np import pickle import gzip import cca_core from CKA import linear_CKA, kernel_CKA X = np.random.randn(100, 64) Y = np.random.randn(100, 64) print('Linear CKA, between X and Y: {}'.format(linear_CKA(X, Y))) print('Linear CKA, between X and X: {}'.format(linear_CKA(X, X))) print('RBF K...
github_jupyter
``` %matplotlib inline """This simpy model mimics the arrival and treatment of patients in an emergency department with a limited number of doctors. Patients are generated, wait for a doc (if none available), take up the doc resources for the time of consulation, and exit the ED straight after seeing doc. Patients are ...
github_jupyter
# Seismic Cubeset tutorial Welcome! This notebook shows how to use `SeismicCubeset` class to hold information about .sgy/.hdf5 cubes. Also, utilitary class `SeismicGeometry` is demonstrated. ``` # Necessary modules import os import sys from glob import glob sys.path.append('..') from seismiqb.batchflow import FilesI...
github_jupyter
# A study of bias in data on Wikipedia The purpose of this study is to explore bias in data on Wikipedia by analyzing Wikipedia articles on politicians from various countries with respect to their populations. A further metric used for comparison is the quality of articles on politicians across different countries. #...
github_jupyter
# Ensemble sorting of a Neuropixels recording This notebook reproduces figures 1 and 4 from the paper [**SpikeInterface, a unified framework for spike sorting**](https://www.biorxiv.org/content/10.1101/796599v2). The data set for this notebook is available on the Dandi Archive: [https://gui.dandiarchive.org/#/dandise...
github_jupyter
# Regresión lineal En el siguiente archivo se va a desarrollar la regresión lineal para las combinaciones de cada una de las variables que se encuentran en los datos provistos, agrupada por departamentos. Los datos se pueden encontrar [acá](https://docs.google.com/spreadsheets/u/1/d/12h1Pk1ZO-BDcGldzKW-IA9VMkU9RlUOPopF...
github_jupyter
# Webinar n°1: Pyleecan Basics This notebook is the support of the first out of three webinars organized by the association [Green Forge Coop](https://www.linkedin.com/company/greenforgecoop/about/) and the UNICAS University. The webinars schedule is: - Friday 16th October 15h-17h (GMT+2): How to use pyleecan (basic...
github_jupyter
``` import re ``` # Intro to Class: (if we really want to use a class for Book) The real implementation of this class to real text should should requires more sophiscated discussion. My suggestion is to write some methods to automatically convert Book class's instance attributes to tags (TEI, XML, or MARKUS format)...
github_jupyter
0 0~6 1 6~12 2 12~18 3 18~24 시간대, 분, 수유량 0, 100, 50 1, 200, 30 2, 100, 30 ``` param_window_size = 6 param_seq_length = 287 param_num_epoch = 10 param_lstm_units = 64 param_lstm_stack = 2 num_sample = param_seq_length - param_window_size import numpy as np import os import pandas import theano from keras.models impo...
github_jupyter
``` import numpy as np import pandas as pd import seaborn as sns %matplotlib inline import matplotlib.pyplot as plt from matplotlib import style train_data = pd.read_csv('train.csv') train_data.info() # Data Cleaning # #from the above output we can see that we are missing 177 values in the age column, # 687 from the ...
github_jupyter
# Initial Operations: ``` import pandas as pd import os import numpy as np from sklearn.decomposition import PCA, TruncatedSVD from sklearn.manifold import TSNE from sklearn.model_selection import train_test_split from sklearn.neighbors import KNeighborsClassifier from sklearn.linear_model import RidgeClassifierCV ...
github_jupyter
``` import os import torch import torch.nn as nn import torch.optim as optim import torch.backends.cudnn as cudnn import torch.nn.init as init import argparse from torch.autograd import Variable import torch.utils.data as data #CHANGE from data import v2, v1, AnnotationTransform, VOCDetection, detection_collate, VOC_CL...
github_jupyter
# Operations on Word Vectors Welcome to your first assignment of Week 2, Course 5 of the Deep Learning Specialization! Because word embeddings are very computationally expensive to train, most ML practitioners will load a pre-trained set of embeddings. In this notebook you'll try your hand at loading, measuring simi...
github_jupyter
# Variational Bayes Notes ## What is variational Bayes? A technique that allows us to compute approximations to non-closed form Bayes update equations. ## Why would we use it? In **Bayesian parameter estimation**, to compute the intractable integration of the denominator in the parameter posterior probability: \begi...
github_jupyter
# Example of Data Analysis with DCD Hub Data First, we will install the Python SDK of DCD-hub and other libraries to gerate plot from the data. In your project folder, create "requirements.txt" file and save the file with the text written below: dcd-sdk>=0.0.22 <br /> paho-mqtt <br /> python-dotenv <br /> pyserial <...
github_jupyter
# Presenting SOTA results on CIMA dataset This notebook serves as visualisation for State-of-the-Art methods on CIMA dataset _Note: In case you want to get some further evaluation related to new submission, you may contact JB._ ``` %matplotlib inline %load_ext autoreload %autoreload 2 import os, sys import glob, js...
github_jupyter
# Latent Dirichlet Allocation for Text Data In this assignment you will * apply standard preprocessing techniques on Wikipedia text data * use GraphLab Create to fit a Latent Dirichlet allocation (LDA) model * explore and interpret the results, including topic keywords and topic assignments for documents Recall that...
github_jupyter
# Basic Functionality ghoul version 0.1.0 ## Collapsing symbols The purpose of ghoul is to randomly generate internally-consistent python objects. The basic unit in ghoul is the `Symbol`. A symbol is an object in a "superposition": it contains many possible states, until it "collapses" to a concrete value. ``` fro...
github_jupyter
``` import sys, os, glob import numpy as np import pandas as pd import matplotlib import matplotlib.pyplot as plt import seaborn as sns import logging # from scipy.interpolate import UnivariateSpline, interp1d from statsmodels.stats.multicomp import pairwise_tukeyhsd, MultiComparison from statsmodels.stats.libqsturng i...
github_jupyter
``` NAME = "Robina Shaheen" DATE = "06242020" COLLABORATORS = "" ``` # Wildfires in California: Causes and Consequences The rising carbon dioxide in the atmosphere is contributing to constant increase in global temperatures. Over the last two decades, humanity has observed record-breaking extreme weather events. A co...
github_jupyter
# Keras Basics Welcome to the section on deep learning! We'll be using Keras with a TensorFlow backend to perform our deep learning operations. This means we should get familiar with some Keras fundamentals and basics! ## Imports ``` import numpy as np ``` ## Dataset We will use the Bank Authentication Data Set t...
github_jupyter
# Comparative Analysis with MELD ``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import scprep import meld import sklearn import pickle import cna import time # making sure plots & clusters are reproducible np.random.seed(42) ``` # Test on Sepsis ``` # Import sepsis expression data d = cn...
github_jupyter
# Evolutionary Shape Prediction An experiment in evolutionary software using *reinforcement learning* to discover interesting data objects within a given set of graph data. ``` import kglab namespaces = { "nom": "http://example.org/#", "wtm": "http://purl.org/heals/food/", "ind": "http://purl.org/heal...
github_jupyter
## Вот и первая домашка! :) Воспользуемся датасетом про цены на дома в Бостоне. Небольшая расшифровка: * `crim` – уровень преступности на душу населения по городам; * `zn` – доля земли под жилую застройку, зонированная под участки площадью более 25000 кв. футов; * `indus` – доля акров, не связанных с розничной торгов...
github_jupyter
# DQN Breakout ``` from __future__ import division import gym import numpy as np import random import tensorflow as tf import tensorflow.contrib.slim as slim import matplotlib.pyplot as plt import scipy.misc import os %matplotlib inline ``` ### Load the game environment ``` env = gym.make('BreakoutDeterministic-v4'...
github_jupyter
<a href="https://kaggle.com/code/ritvik1909/siamese-network" target="_blank"><img align="left" alt="Kaggle" title="Open in Kaggle" src="https://kaggle.com/static/images/open-in-kaggle.svg"></a> # Siamese Network A Siamese neural network (sometimes called a twin neural network) is an artificial neural network that use...
github_jupyter
``` import os os.chdir('..') ``` <img src="flow_2.png"> ``` from flows.flows import Flows flow = Flows(2) path = "./data/flow_2" files_list = ["train.csv","test.csv"] dataframe_dict, columns_set = flow.load_data(path, files_list) dataframe_dict, columns_set= flow.flatten_json_data(dataframe_dict) dataframe_dict, colu...
github_jupyter
# UROP Code Stuff #### The python translation of doit.pl ## Initializing ### Since this is a notebook, argv doesn't work how it normally would. Instead, place the values in this block ``` import sys import numpy as np sys.argv = ['doit.py', 1] with open('framedist_vals', 'r') as f: framedist = np.array(f.rea...
github_jupyter
``` import pandas as pd import matplotlib.pyplot as plt import numpy as np from rdkit import Chem from rdkit.Chem import AllChem from rdkit.Chem import Descriptors from sklearn.model_selection import train_test_split from sklearn.neural_network import MLPClassifier from sklearn.preprocessing import StandardScaler from ...
github_jupyter
# [Country Embedding](https://philippmuens.com/word2vec-intuition/) ``` import json import pandas as pd import seaborn as sns import numpy as np # prettier Matplotlib plots import matplotlib.pyplot as plt import matplotlib.style as style style.use('seaborn') ``` # 1. Dataset #### Download ``` %%bash download=1 fo...
github_jupyter
# 1. Regressão Linear ## 1.1. Univariada Existem diversos problemas na natureza para os quais procura-se obter valores de saída dado um conjunto de dados de entrada. Suponha o problema de predizer os valores de imóveis de uma determinada cidade, conforme apresentado na Figura 1, em que podemos observer vários pontos q...
github_jupyter
First we need to download the dataset. In this case we use a datasets containing poems. By doing so we train the model to create its own poems. ``` from datasets import load_dataset dataset = load_dataset("poem_sentiment") print(dataset) ``` Before training we need to preprocess the dataset. We tokenize the entries ...
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/Certification_Trainings/Healthcare/20.SentenceDetectorDL_Healthcare.ipynb) # ...
github_jupyter
# Test post compute 3D ``` import numpy as np import matplotlib.pyplot as plt import pandas as pd import subprocess as sp import sys import os import glob import pickle import itertools from matplotlib.colors import LogNorm, PowerNorm, Normalize from ipywidgets import * %matplotlib widget ### Transformation functio...
github_jupyter
``` # Imports / Requirements import json import numpy as np import torch import matplotlib.pyplot as plt import torch.nn.functional as F import torchvision from torch import nn, optim from torchvision import datasets, transforms, models from torch.autograd import Variable from collections import OrderedDict from PIL ...
github_jupyter
# Exercise 1 **(1)** Forecasting with linear models: > **(a)** Estimate four linear models unsing the OLS estimator > **(b)** Forecast n steps ahead using the estimated models > **(c)** Forecast n steps ahead (recursively) using the estimated models > **(d)** Compute confidence intervals for both **(b)** and **(c)*...
github_jupyter
<a href="https://colab.research.google.com/github/IanCostello/tools/blob/ValidationTool/import-validation-helper/ImportValidatorMaster.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Import Validation Helper This Colab notebook introduces a few to...
github_jupyter
``` import pandas as pd import os import json from functools import singledispatch date = "2022-02-12" STATE_NAMES = { 'AP': 'Andhra Pradesh', 'AR': 'Arunachal Pradesh', 'AS': 'Assam', 'BR': 'Bihar', 'CT': 'Chhattisgarh', 'GA': 'Goa', 'GJ': 'Gujarat', 'HR': 'Haryana', 'HP': 'Himachal Pradesh', 'JH':...
github_jupyter
``` #import packages import numpy as np from numpy import loadtxt import pylab as pl from IPython import display from RcTorch import * from matplotlib import pyplot as plt from scipy.integrate import odeint import time import matplotlib.gridspec as gridspec #this method will ensure that the notebook can use multiproce...
github_jupyter
<a href="https://colab.research.google.com/github/parekhakhil/pyImageSearch/blob/main/1402_opencv_template_matching.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ![logo_jupyter.png](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAABcCAYAAABA4uO...
github_jupyter
# Regular Expressions in Python > Some people, when confronted with a problem, think, "I know, I'll use regular expressions." Now they have two problems. - Jamie Zawinski ## First day: quick overview This first day we will explore the basics of the `re` (standard libary) module so you can start adding this powerful ...
github_jupyter
## Eng+Wales well-mixed example model This is the inference notebook. There are various model variants as encoded by `expt_params_local` and `model_local`, which are shared by the notebooks in a given directory. Outputs of this notebook: * `ewMod-inf.pik` : result of inference computation * `ewMod-hess.npy` : hessi...
github_jupyter
# AllSides sources & bias crawler Get and save a list of rated news sources as left or right and in between. A CSV file will be created with the following columns: - Source - Label - Agree - Disagree - Publisher URL - Publisher site ``` !ipython -m pip install aiohttp bs4 requests import asyncio import csv import l...
github_jupyter
# Summary of transfer outcomes for practice M85092 **Context** We would like to see a summary of transfer outcomes where the sending practice is M85092 for April data (if available), otherwise March data. NB: Upon finding there were only 8 relevant transfers, we also used March data (which contained 2600 transfers)...
github_jupyter
``` num_classes = 2 ultrasound_size = 128 data_folder = r"QueensToChildrens" notebook_save_folder = r"SavedNotebooks" model_save_folder = r"SavedModels" ultrasound_file = r"ultrasound.npy" segmentation_file = r"segmentation.npy" test_ultrasound_file = r"ultrasound-test.npy" test_segmentation_file = r"segmentation-te...
github_jupyter
<a href="https://colab.research.google.com/github/mnslarcher/cs224w-slides-to-code/blob/main/notebooks/04-link-analysis-pagerank.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Link Analysis: PageRank ``` import random from typing import Optional...
github_jupyter
# Background This notebook walks through the creation of a fastai [DataBunch](https://docs.fast.ai/basic_data.html#DataBunch) object. This object contains a pytorch dataloader for the train, valid and test sets. From the documentation: ``` Bind train_dl,valid_dl and test_dl in a data object. It also ensures all the...
github_jupyter
# Project 3: Smart Beta Portfolio and Portfolio Optimization ## Instructions Each problem consists of a function to implement and instructions on how to implement the function. The parts of the function that need to be implemented are marked with a `# TODO` comment. After implementing the function, run the cell to tes...
github_jupyter
# Generative Adversarial Network In this notebook, we'll be building a generative adversarial network (GAN) trained on the MNIST dataset. From this, we'll be able to generate new handwritten digits! GANs were [first reported on](https://arxiv.org/abs/1406.2661) in 2014 from Ian Goodfellow and others in Yoshua Bengio'...
github_jupyter
# Welcome to fastai ``` from fastai import * from fastai.vision import * from fastai.gen_doc.nbdoc import * from fastai.core import * from fastai.basic_train import * ``` The fastai library simplifies training fast and accurate neural nets using modern best practices. It's based on research in to deep learning best p...
github_jupyter
``` print("hello world") a = 10 print(a) b = 10 * a # jupyter will automatically print the last value in the block # and by the way: this is how a comment looks. b if b > 50: print("b is greater than 50") ``` Python can handle numbers of arbitrary length :) What's actually $2^{2048}$? ``` 2**2048 ``` ## define...
github_jupyter
################################################## ## Assignment 1 ## Problem 2(a) ## Samin Yeasar Arnob ## McGill ID: 260800927 ## COMP 767- Reinforcement Learning Winter 2019 ################################################# # Grid World Environment Original Grid world environment was taken from link: https:/...
github_jupyter
``` import numpy as np from sklearn.metrics import silhouette_score from scipy.spatial.distance import euclidean class Kmeans: ''' K-means is a clustering algorithm that finds convex clusters. The user specifies the number of clusters a priori.''' def __init__(self, K=2, init='k++', rand...
github_jupyter
``` from __future__ import division import numpy as np import epgcpmg as epg import time import matplotlib.pyplot as plt %matplotlib inline def numerical_gradient(myfun, myparams, e=1e-5): initial_params = myparams.copy() num_grad = np.zeros(initial_params.shape) perturb = np.zeros(initial_params.shape) ...
github_jupyter