text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib.patches import Ellipse from sklearn.preprocessing import StandardScaler from sklearn.mixture import GaussianMixture from sklearn.decomposition import PCA from sklearn import datasets, metrics heart_disease = pd.read_excel('Proces...
github_jupyter
``` # UN_Geosheme_Subregion = ['Australia and New Zealand','Caribbean','Central America','Central Asia','Eastern Africa','Eastern Asia','Eastern Europe','Melanesia','Micronesia','Middle Africa','Northern Africa','Northern America','Northern Europe','Polynesia','South America','South-Eastern Asia','Southern Africa','Sou...
github_jupyter
# Challenge 2 - Padlock Secret **Difficulty level**: 3 - beginner One approach to find a password or a padlock secret combination is to use a brute force attack. Of course, for a small combination it is not a big deal, but for complex combination it could be almost impossible using the current computation power. Her...
github_jupyter
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. ![Impressions](https://PixelServer20190423114238.azurewebsites.net/api/impressions/MachineLearningNotebooks/how-to-use-azureml/automated-machine-learning/classification-credit-card-fraud/auto-ml-classification-credit-card-fraud....
github_jupyter
# Ray Crash Course - Exercise Solutions © 2019-2021, Anyscale. All Rights Reserved ![Anyscale Academy](../../images/AnyscaleAcademyLogo.png) This notebook discusses solutions for the exercises in the _crash course_. ## 01 Ray Crash Course - Tasks - Exercise 1 As currently written, the memory footprint of `estimate...
github_jupyter
``` from fastai2.vision.all import * ``` # Checar el VerboseCallback ``` from fastai2.test_utils import VerboseCallback class VerboseCallback(Callback): "Callback that prints the name of each event called" def __call__(self, event_name): print(event_name) super().__call__(event_name) ``` # Cr...
github_jupyter
# Answers: Classes Provided here are answers to the practice questions at the end of "Classes". ## Objects **Objects Q1**. ``` # specific strings will differ true_var = 'asdf123'.isalnum() false_var = '!!!!'.isalnum() ``` **Objects Q2**. ``` days_summary = {} for day in days_of_week: days_summary[day] = site...
github_jupyter
## Keypad Combinations A keypad on a cellphone has alphabets for all numbers between 2 and 9, as shown in the figure below: <img style="float: center;height:200px;" src="Keypad.png" alt="A cell phone keypad that has letters associated with each number 2 through 9"><br> You can make different combinations of alphabet...
github_jupyter
# 三星级复现项目:使用DDPG解决四轴飞行器速度控制 (这可能是史上最“偷懒”的三星级复现项目,改改任务环境就可以提交了 - -!应该没有更懒的了,O(∩_∩)O哈哈~) # Step1 安装依赖 !pip uninstall -y parl # 说明:AIStudio预装的parl版本太老,容易跟其他库产生兼容性冲突,建议先卸载 !pip uninstall -y pandas scikit-learn # 提示:在AIStudio中卸载这两个库再import parl可避免warning提示,不卸载也不影响parl的使用 ``` !pip uninstall -y parl # 说明:AIStudio预装的parl...
github_jupyter
``` # python 3.6.8 # DLISIO v0.3.5 # numpy v1.16.2 # pandas v0.24.1 # lasio v0.25.1 from dlisio import lis import pandas as pd import os import lasio import numpy as np def extract_wellname(f, find_wellname, manualwellname): if find_wellname == "Yes": records = f.wellsite_data() inforec = records[0...
github_jupyter
# SYS 611: Dice Fighters Example (w/ Binomial Process Gen.) Paul T. Grogan <pgrogan@stevens.edu> This example shows how to model the dice fighters example in Python using a binomial process generator. ## Dependencies This example is compatible with Python 2 environments through use of the `__future__` library funct...
github_jupyter
# Sampled Softmax For classification and prediction problems a typical criterion function is cross-entropy with softmax. If the number of output classes is high the computation of this criterion and the corresponding gradients could be quite costly. Sampled Softmax is a heuristic to speed up training in these cases. (...
github_jupyter
### Data Source Dataset is derived from Fannie Mae’s [Single-Family Loan Performance Data](http://www.fanniemae.com/portal/funding-the-market/data/loan-performance-data.html) with all rights reserved by Fannie Mae. This processed dataset is redistributed with permission and consent from Fannie Mae. For the full raw da...
github_jupyter
### Univariate linear regression using gradient descent ``` import matplotlib.pyplot as plt import numpy as np from sklearn import datasets, linear_model from sklearn.metrics import mean_squared_error, r2_score %matplotlib inline data_train = np.zeros((2,20)) data_train[0] = [4, 5, 5, 7, 8, 8, 9, 11, 11, 12, 13, 14, ...
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
# Using BagIt to tag oceanographic data [`BagIt`](https://en.wikipedia.org/wiki/BagIt) is a packaging format that supports storage of arbitrary digital content. The "bag" consists of arbitrary content and "tags," the metadata files. `BagIt` packages can be used to facilitate data sharing with federal archive centers ...
github_jupyter
<table class="ee-notebook-buttons" align="left"> <td><a target="_blank" href="https://github.com/giswqs/earthengine-py-notebooks/tree/master/Filter/filter_in_list.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td> <td><a target="_blank" href="...
github_jupyter
# Adversarial-Robustness-Toolbox for scikit-learn AdaBoostClassifier ``` from sklearn.ensemble import AdaBoostClassifier from sklearn.datasets import load_iris import numpy as np from matplotlib import pyplot as plt from art.estimators.classification import SklearnClassifier from art.attacks.evasion import ZooAttack...
github_jupyter
``` import os import sys import numpy as np import PIL.Image import torch import torchvision sys.path. append('../icnn_torch') from icnn import reconstruct_stim from utils import normalise_img, img_preprocess,img_deprocess, get_cnn_features #load CNN model from torchvision #net = torchvision.models.resnet50(pretraine...
github_jupyter
``` import os import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib.ticker as tick %matplotlib inline model = 'Shake-ResNet-26 2x64d (Shake-Shake-Image)' log_dir = os.path.join('results', model) df = pd.read_json(os.path.join(log_dir, 'log')) df.rename(columns={ 'epoch': 'Epoch'...
github_jupyter
<a href="https://colab.research.google.com/github/probml/pyprobml/blob/master/notebooks/word_analogies_torch.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Solving word analogies using pre-trained word embeddings Based on D2L 14.7 http://d2l.a...
github_jupyter
# Napelemek temelésének előrejelzése gépi tanulási algoritmusok segítségével ## A feladat `count félrevezet; cov,corr INF-et ad; quantile-t nem tudom használni,mint nyugodtan kivehetem mert úgyis nulla? ``` import math import pandas as pd import numpy as np PATH_TO_TRAIN = '../data/raw/train15.csv' DATE_FORMAT = '%Y%...
github_jupyter
<!--BOOK_INFORMATION--> <a href="https://www.packtpub.com/big-data-and-business-intelligence/machine-learning-opencv" target="_blank"><img align="left" src="data/cover.jpg" style="width: 76px; height: 100px; background: white; padding: 1px; border: 1px solid black; margin-right:10px;"></a> *This notebook contains an ex...
github_jupyter
# Stocks Analysis Demo ``` !/User/align_mlrun.sh ``` ## Setup stocks project ``` from os import path import os import mlrun # Set the base project name project_name_base = 'stocks' # Initialize the MLRun environment and save the project name and artifacts path project_name, artifact_path = mlrun.set_environment(pro...
github_jupyter
# Train a Smartcab to Drive Goal: Construct an optimized Q-Learning driving agent that will navigate a Smartcab through its ideal environment towards a destination - without sacrificing on safety or reliability. Both of the evaluation metric is measured using a letter-grade system as follows: | Grade | Safety | Rel...
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.signal import find_peaks from scipy.interpolate import UnivariateSpline, interp1d from scipy import stats from statsmodels.stats.multicomp import pairwise_tuk...
github_jupyter
# Translation simple ecoder-decocer over the b3 dataset ``` import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torchtext import data import pandas as pd import unicodedata import string import re import random import copy from contra_qa.plots.functions import simple_step_plot i...
github_jupyter
``` # Running %env without any arguments # lists all environment variables # The line below sets the environment # variable CUDA_VISIBLE_DEVICES %env CUDA_VISIBLE_DEVICES = import numpy as np from datetime import datetime import pandas as pd import io import time import bson # this is installed...
github_jupyter
# Make sure this SageMakerNotebookExecutionRole has access to Kendra ``` import boto3 import sagemaker import pandas as pd sess = sagemaker.Session() bucket = sess.default_bucket() role = sagemaker.get_execution_role() region = boto3.Session().region_name sm = boto3.Session().client(service_name='sagemaker', regio...
github_jupyter
# Working with time series data ``` %matplotlib inline import pandas as pd import numpy as np import matplotlib.pyplot as plt pd.options.display.max_rows = 8 ``` ## Case study: air quality data of European monitoring stations (AirBase) [AirBase](http://www.eea.europa.eu/data-and-maps/data/airbase-the-european-air-q...
github_jupyter
# Simple Naive Bayes Classifier ## T1. Load a dataset The following code loads a dataset consisting of text messages and spam-ham labels. ``` from typing import List, Tuple, Dict, Iterable, Set from collections import defaultdict import re import math import pandas as pd url = 'https://raw.githubusercontent.com/mle...
github_jupyter
<a href="https://colab.research.google.com/github/yanin2020/Curso-de-Python/blob/master/Phyton_curso.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> [CURSO FRECODECAMP](https://www.youtube.com/watch?v=DLikpfc64cA&ab_channel=freeCodeCampEspa%C3%B1ol)...
github_jupyter
# Module 1: **Data Science - Basic Data Understanding** Course website: [SHALA-2020](https://shala2020.github.io/) Instructors: Sudhakar Kumar, Rishav Arjun, and Sahar Nasser --- ## Plotting mathematical functions --- ``` # Loading the libraries import pandas as pd import numpy as np import seaborn as sns import...
github_jupyter
> This is one of the 100 recipes of the [IPython Cookbook](http://ipython-books.github.io/), the definitive guide to high-performance scientific computing and data science in Python. # 4.7. Implementing an efficient rolling average algorithm with stride tricks Stride tricks can be useful for local computations on arr...
github_jupyter
``` import pandas as pd from pybatfish.client.commands import * from pybatfish.datamodel import * from pybatfish.question import bfq, list_questions, load_questions pd.set_option("display.width", 300) pd.set_option("display.max_columns", 20) pd.set_option("display.max_rows", 1000) pd.set_option("display.max_colwidt...
github_jupyter
``` library(caret, quiet=TRUE); library(base64enc) library(httr, quiet=TRUE) ``` # Build a Model ``` set.seed(1960) create_model = function() { model <- train(Species ~ ., data = iris, method = "rpart" , preProcess = c("expoTrans")) return(model) } # dataset model = create_model() pred <- predict(mo...
github_jupyter
``` #hide %load_ext autoreload %autoreload 2 # default_exp latent_factor_fxns ``` # Latent Factor Functions > This module contains the update and forecast functions to work with a latent factor DGLM. There are two sets of functions: The first works with the latent_factor class in PyBATS, which represents latent facto...
github_jupyter
``` from ei_net import * # import the .py file but you can find all the functions at the bottom of this notebook from utilities import show_values import matplotlib.pyplot as plt %matplotlib inline ########################################## ############ PLOTTING SETUP ############## EI_cmap = "Greys" where_to_save_pngs...
github_jupyter
# Source Code ### Libraries :- **Selenium Driver** ``` from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import Select from selenium.common.exceptions import NoSuchElementException ``` **Speech** ``` import pyttsx3 #It works offline from gtts import g...
github_jupyter
# Investigate Web Application Firewall (WAF) Data </br> **Author:** Vani Asawa <br/> **Date:** December 2020 </br> **Notebook Version:** 1.0 <br/> **Python Version:** Python 3.6 <br/> **Required Packages:** msticpy, pandas, kqlmagic <br/> **Data Sources Required:** WAF data (AzureDiagnostics) <br/> ## What is the pur...
github_jupyter
``` # Comparing fiTQun's results with the fully supervised ResNet-18 classifier on the varying position dataset # Naming convention: first particle type is which file it is from, last particletype is what the hypothesis is ## Imports import sys import os import time import math import random import pdb import h5py #...
github_jupyter
## Conditional Independence Two random variable $X$ and $Y$ are conditiaonly independent given $Z$, denoted by $X \perp \!\! \perp Y \mid Z$ if $$p_{X,Y\mid Z} (x,y\mid z) = p_{X\mid Z}(x\mid z) \, p_{Y\mid Z}(y\mid z)$$ In general Marginal independence doesn't imply conditional independence and vice versa. ### Ex...
github_jupyter
``` #default_exp eda #hide import transformers import torch import torch.nn as nn import torch.optim as optim import pandas as pd import Hasoc.config as config import Hasoc.utils.utils as utils import Hasoc.utils.engine as engine import Hasoc.model.model as model import Hasoc.dataset.dataset as dataset from functool...
github_jupyter
# Topic Modeling wiht Latent Semantic Analysis Latent Semantic Analysis (LSA) is a method for reducing the dimnesionality of documents treated as a bag of words. It is used for document classification, clustering and retrieval. For example, LSA can be used to search for prior art given a new patent application. In thi...
github_jupyter
# Transfer Learning experiments ``` import os import torch import mlflow import numpy as np from torch import nn from torch import optim from collections import OrderedDict import torch.nn.functional as F from torchvision import datasets, transforms, models ``` ## Transfer Learning with DenseNet ### Loading data ``...
github_jupyter
<a href="https://colab.research.google.com/github/wileyw/DeepLearningDemos/blob/master/sound/simple_audio_working_vggish_dataset.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ##### Copyright 2020 The TensorFlow Authors. ``` #@title Licensed under...
github_jupyter
## CNN WITH CLASSES FROM [HERE](https://github.com/hunkim/DeepLearningZeroToAll/blob/master/lab-10-6-mnist_nn_batchnorm.ipynb) ``` import os import numpy as np from scipy import ndimage import matplotlib.pyplot as plt import tensorflow as tf import tensorflow.contrib.slim as slim from tensorflow.examples.tutorials.mni...
github_jupyter
``` import os import pandas as pd import numpy as np pd.options.display.max_rows = 500 pd.options.display.max_columns = 500 from matplotlib import pyplot as plt %matplotlib inline # Vega lite spec builders import vincent import altair import vega help(vega) def replace_misspelled(region_name, misspelled, replace): ...
github_jupyter
# Programación lineal, algoritmo símplex ## Introducción El método de programación lineal ha sido un método sumamente utilizado para matemática avanzada y ciencias avanzadas, brindando solución a problemas de máximos y mínmos, ya que este algoritmo nos presenta distintos métodos de solución, siendo el más utilizado e...
github_jupyter
``` import pickle import pandas as pd import os import json import glob import numpy as np from optimizers.utils import Model, Architecture from nasbench_analysis.search_spaces.search_space_1 import SearchSpace1 from nasbench_analysis.search_spaces.search_space_2 import SearchSpace2 from nasbench_analysis.search_spac...
github_jupyter
Lambda School Data Science, Unit 2: Predictive Modeling # Regression & Classification, Module 1 ## Objectives - Clean data & remove outliers - Use scikit-learn for linear regression - Organize & comment code ## Setup #### If you're using [Anaconda](https://www.anaconda.com/distribution/) locally Install required P...
github_jupyter
``` # Useful for debugging %load_ext autoreload %autoreload 2 # Nicer plotting import matplotlib.pyplot as plt import matplotlib %matplotlib inline %config InlineBackend.figure_format = 'retina' matplotlib.rcParams['figure.figsize'] = (8,4) ``` # Autophase and Autophase and Scale examples ``` from impact import Impac...
github_jupyter
# Introduction: Home Credit Default Risk Competition This notebook is intended for those who are new to machine learning competitions or want a gentle introduction to the problem. I purposely avoid jumping into complicated models or joining together lots of data in order to show the basics of how to get started in mac...
github_jupyter
<a href="https://colab.research.google.com/github/mbonyani/Spine_Segmentation/blob/main/step2.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` !ls -lha kaggle.json !pip install -q kaggle !mkdir -p ~/.kaggle !cp kaggle.json ~/.kaggle/ !chmod ...
github_jupyter
--- # __Python Pandas__ Data Structures, Inspection, Cleanign, Indexing, Slicing, merging, concatenating --- Code examples on the most frequently used functions - Collected, Created and Edited by __Pawel Rosikiewicz__ www.SimpleAI.ch ## CONTENT * __CREAETING SERIES & DATA FRAME__ </br> * __LOADING/...
github_jupyter
``` %tensorflow_version 1.x # Clone git %rm -rf archlectures !git clone https://github.com/armaank/archlectures %cd archlectures/generative/ %%sh chmod 755 get_models.sh ./get_models.sh from IPython.display import Javascript display(Javascript('''google.colab.output.setIframeHeight(0, true, {maxHeight: 200})''')) !pip ...
github_jupyter
``` """ You can run either this notebook locally (if you have all the dependencies and a GPU) or on Google Colab. Instructions for setting up Colab are as follows: 1. Open a new Python 3 notebook. 2. Import this notebook from GitHub (File -> Upload Notebook -> "GITHUB" tab -> copy/paste GitHub URL) 3. Connect to an in...
github_jupyter
``` # Copyright 2021 Google LLC # # 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 agreed to in writi...
github_jupyter
## Make 3d model sections ``` import telluricpy, numpy as np, gc import scipy import VTKUtil as pvtkUtil %matplotlib qt def simpeg2vtk(mesh,modDict): from vtk import vtkRectilinearGrid as rectGrid, vtkXMLRectilinearGridWriter as rectWriter, VTK_VERSION from vtk.util.numpy_support import numpy_to_vtk ...
github_jupyter
# Inference and Validation Now that you have a trained network, you can use it for making predictions. This is typically called **inference**, a term borrowed from statistics. However, neural networks have a tendency to perform *too well* on the training data and aren't able to generalize to data that hasn't been seen...
github_jupyter
<a href="https://colab.research.google.com/github/Tessellate-Imaging/monk_v1/blob/master/study_roadmaps/2_transfer_learning_roadmap/5_exploring_model_families/4_resnet/8)%20Comparing%20resnet%20v1%20and%20v2%20variants%20-%20mxnet%20backend.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/cola...
github_jupyter
``` from PIL import Image import torchvision.transforms as transforms import matplotlib.pyplot as plt import torch import numpy as np import cv2 from samples.CLS2IDX import CLS2IDX ``` # Auxiliary Functions ``` from baselines.ViT.LVViT_LRP import lvvit_small_patch16_224 as vit_LRP from baselines.ViT.ViT_explanation_g...
github_jupyter
# Demo for 2d DOT ``` import chainer from chainer import Variable, optimizers, serializers, utils from chainer import Link, Chain, ChainList import chainer.functions as F import chainer.links as L from chainer import cuda #import numpy as xp gpu_device = 0 cuda.get_device(gpu_device).use() import numpy as np import ...
github_jupyter
``` import sys sys.path.append('../../pyutils') import numpy as np import matplotlib.pyplot as plt import pandas as pd import metrics import utils ``` # Bernoulli Distribution $$X \sim B(p)$$ $X$ is a single binary random variable. Parameters: - $p \in [0, 1]$: probability that X takes the value $1$ $$P(X=0) = 1...
github_jupyter
### Gluon Implementation in Recurrent Neural Networks ``` import sys sys.path.insert(0, '..') import d2l import math from mxnet import autograd, gluon, init, nd from mxnet.gluon import loss as gloss, nn, rnn import time (corpus_indices, char_to_idx, idx_to_char, vocab_size) = d2l.load_data_time_machine() ``` ### D...
github_jupyter
``` import os os.chdir('/home/enis/projects/nna/src/nna/exp/megan/run-2/') # import run # import nna import torch import torch.nn as nn import torch.nn.functional as F from torchvision import transforms import torchaudio torchaudio.set_audio_backend("sox_io") import numpy as np from pathlib import Path from collecti...
github_jupyter
# bqplot https://github.com/bloomberg/bqplot ## A Jupyter - d3.js bridge bqplot is a jupyter interactive widget library bringing d3.js visualization to the Jupyter notebook. - Apache Licensed bqplot implements the abstractions of Wilkinson’s “The Grammar of Graphics” as interactive Jupyter widgets. bqplot provides...
github_jupyter
# Stochastic gradient descent (SGD) SGD is an incremental gradient descent algorithm which modifies its weights, in an effort to reach a local minimum. The cuML implementation takes only numpy arrays and cuDF datasets as inputs. - In order to convert your dataset into a cuDF dataframe format please refer the [cuD...
github_jupyter
# Unit 4: Neighborhood-based Collaborative Filtering for Rating Prediction In this section we generate personalized recommendations for the first time. We exploit rating similarities among users and items to identify similar users and items that assist in finding the relevant items to recommend for each user. This de...
github_jupyter
``` import pandas as pd %matplotlib inline players = pd.read_csv('players.csv') matches = pd.read_csv('match.csv') heroes = pd.read_csv('hero_names.csv') items = pd.read_csv('item_ids.csv') items.info() hero_lookup = dict(zip(heroes['hero_id'], heroes['localized_name'])) hero_lookup[0] = 'Unknown' players['her...
github_jupyter
``` BRANCH = 'v1.0.2' """ You can run either this notebook locally (if you have all the dependencies and a GPU) or on Google Colab. Instructions for setting up Colab are as follows: 1. Open a new Python 3 notebook. 2. Import this notebook from GitHub (File -> Upload Notebook -> "GITHUB" tab -> copy/paste GitHub URL) 3...
github_jupyter
# The Spinning Effective One-Body Initial Condition Solver ## Author: Tyler Knowles ## This module documents the reduced spinning effective one-body initial condition solver as numerically implemented in LALSuite's SEOBNRv3 gravitational waveform approximant. That is, we follow Section IV A of [Buonanno, Chen, and D...
github_jupyter
## Analysis of Gene Expression Data via Arrays using Bioconductor/R - I Today, this notebook constitutes your in-class activity and homework. Over the next 3 days, we will be constructing your own gene expression analysis pipeline, using available tools in R, and available data from the gene expression omnibus (GEO): ...
github_jupyter
postcode strings can be converted to the following formats via the `output_format` parameter: * `compact`: only number strings without any seperators or whitespace, like "2611ET" * `standard`: postcode strings with proper whitespace in the proper places. Note that in the case of postcode, the compact format is the sam...
github_jupyter
# Business and Data Understanding ## Airports Weather Data 2016 ### Import Airports and their latitude/longitude. 10 US airports with the most weather related delays ``` from pyspark.sql import SQLContext import numpy as np from io import StringIO import requests import json import pandas as pd # @hidden_cell # Th...
github_jupyter
``` import bert from bert import run_classifier from bert import optimization from bert import tokenization from bert import modeling import numpy as np import json import tensorflow as tf import itertools from unidecode import unidecode import re import sentencepiece as spm # !git clone https://github.com/huseinzol05/...
github_jupyter
``` import re import numpy as np import pickle import import_ipynb import import_ipynb from normalizing import normalize from gensim.models.keyedvectors import KeyedVectors from gensim.test.utils import get_tmpfile from gensim.scripts.glove2word2vec import glove2word2vec import collections from collections import de...
github_jupyter
## Importance Sampling and Particle filter ``` import numpy as np import matplotlib.pyplot as plt from scipy.stats import norm from scipy.stats import poisson ``` ## Importance Sampling and resampling Before we dive into the vast universe of nonlinear filtering, let us take a step back and review importance sampling...
github_jupyter
``` #default_exp test #export from fastcore.imports import * from collections import Counter from contextlib import redirect_stdout from nbdev.showdoc import * from fastcore.nb_imports import * ``` # Test > Helper functions to quickly write tests in notebooks ## Simple test functions We can check that code raises a...
github_jupyter
## <h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#Confidence-Intervals" data-toc-modified-id="Confidence-Intervals-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>Confidence Intervals</a></span><ul class="toc-item"><li><span><a href="#Agenda" data-toc...
github_jupyter
# main function for decomposition ### Author: Yiming Fang ``` import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F import torch.backends.cudnn as cudnn from torch.optim.lr_scheduler import StepLR import torchvision import torchvision.transforms as transforms from torchvision ...
github_jupyter
``` from urllib.request import Request, urlopen import urllib import requests import pandas as pd from xlwt import Workbook from bs4 import BeautifulSoup import sys import time import random url_list = ["https://www.google.com/search?q=Aachen+Hbf", "https://www.google.com/search?q=Aalen+Hbf", "https://www.google.com/s...
github_jupyter
``` %load_ext autoreload %autoreload 2 import sys #sys.path.insert(1, '/home/ximo/Documents/GitHub/skforecast') %config Completer.use_jedi = False # Libraries # ============================================================================== import numpy as np import pandas as pd import matplotlib.pyplot as plt from sk...
github_jupyter
``` %load_ext autoreload %autoreload 2 import nlppln with nlppln.WorkflowGenerator(working_dir='/home/jvdzwaan/cwl-working-dir/') as wf: wf.load(steps_dir='../ochre/cwl/') print wf.list_steps() in_dir = wf.add_input(in_dir='Directory') ocr_dir_name = wf.add_input(ocr_dir_name='string') gs_dir_name...
github_jupyter
# Joining all processed data This notebook joins all processed data and then saves it in a file for subsequent modeling. ``` # Last amended: 24th October, 2020 # Myfolder: C:\Users\Administrator\OneDrive\Documents\home_credit_default_risk # Objective: # Solving Kaggle problem: Home Credit Default Risk # ...
github_jupyter
``` from tensorflow.keras.preprocessing.sequence import pad_sequences from tensorflow.keras.layers import Embedding, LSTM, Dense, Dropout, Bidirectional from tensorflow.keras.preprocessing.text import Tokenizer from tensorflow.keras.models import Sequential from tensorflow.keras.optimizers import Adam ### YOUR CODE HER...
github_jupyter
# Implementing a Neural Network In this exercise we will develop a neural network with fully-connected layers to perform classification, and test it out on the CIFAR-10 dataset. ``` # A bit of setup import numpy as np import matplotlib.pyplot as plt from cs231n.classifiers.neural_net import TwoLayerNet %matplotlib ...
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._ --- # The Series Data Str...
github_jupyter
``` import traytable as tt import matplotlib.pyplot as plt ``` Download this notebook and try it out yourself [here](https://github.com/dennisbrookner/traytable/blob/main/docs/examples/0_simple_example.ipynb) ## Making a screen First, initialize the screen with `screen()`. This function requires that you specify * ...
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
## SASPy Tabulation for Descriptive Statistics This notebook demonstrates the usage of a powerful set of tools for descriptive statistics and nesting data in SASPy, powered by the TABULATE procedure. ``` import saspy sas = saspy.SASsession(cfgname='default') saspy.__version__ cars = sas.sasdata('cars', 'sashelp') car...
github_jupyter
# High-performance simulations with TFF This tutorial will describe how to setup high-performance simulations with TFF in a variety of common scenarios. TODO(b/134543154): Populate the content, some of the things to cover here: - using GPUs in a single-machine setup, - multi-machine setup on GCP/GKE, with and without...
github_jupyter
# Pure API Demonstration: Research Software These notebooks demonstrate some uses of the API of Elsevier's *Pure* Current Research Information System (CRIS). This notebook demonstrates some requests for research software. Research Software is currently recorded in Pure as a type of Research Output. **Enter API detai...
github_jupyter
``` from __future__ import absolute_import, division, print_function, unicode_literals import tensorflow as tf from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense, Conv2D, Flatten, Dropout, MaxPooling2D from tensorflow.keras.preprocessing.image import ImageDataGenerator import os i...
github_jupyter
# Introduction to Scientific Python # ## Purpose of this tutorial ## This tutorial aims to be a not-so-gentle but useful introduction to the python programming language. The intended audience is anyone with some familiarity with programming but limited experience with python for scientific work. Good computational sk...
github_jupyter
``` import numpy as np from keras.models import Model from keras.layers import Input, Dense, RepeatVector from keras.layers.merge import Add, Subtract, Multiply, Average, Maximum, Minimum, Concatenate, Dot from keras import backend as K import json from collections import OrderedDict def format_decimal(arr, places=6): ...
github_jupyter
``` import numpy as np import os,sys sys.path.append('.') sys.path.append('../RL_lib/Utils') %load_ext autoreload %load_ext autoreload %autoreload 2 %matplotlib nbagg import os print(os.getcwd()) %%html <style> .output_wrapper, .output { height:auto !important; max-height:1000px; /* your desired max-height he...
github_jupyter
``` %matplotlib inline import pandas import geopandas import numpy as np import matplotlib.pyplot as plt import sys from esda.adbscan import ADBSCAN, get_cluster_boundary, remap_lbls ``` - Set up three clusters ``` n = 100 np.random.seed(12345) c1 = np.random.normal(1, 1, (n, 2)) c2 = np.random.normal(6, 1, (n, 2)) ...
github_jupyter
# __DATA 5600: Introduction to Regression and Machine Learning for Analytics__ ## __Review of Basic Concepts in Asymptotic Theory__ <br> <br> ``` import numpy as np import matplotlib.pyplot as plt %matplotlib inline ``` <br> ## __The Law of Large Numbers__ ***Definition*** The law which states that the larger a ...
github_jupyter
For many users, it may be valuable to pull together some particular properties that can be summarized to a simple value per each species record and view them in a spreadsheet program of one kind or another in order to slice the data in various ways or run reports. This notebook runs through all of the data generated, m...
github_jupyter