text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
# <font color='firebrick'><center>Idx Stats Report</center></font> ### This report provides information from the output of samtools idxstats tool. It outputs the number of mapped reads per chromosome/contig. <br> ``` from IPython.display import display, Markdown from IPython.display import HTML import IPython.core.dis...
github_jupyter
``` # Import lib # =========================================================== import csv import pandas as pd import numpy as np import random import time import collections import math import sys from tqdm import tqdm from time import sleep import matplotlib.pyplot as plt # %matplotlib inline plt.style.use('fivethirt...
github_jupyter
# NumPy 入門 本章では、Python で数倀蚈算を高速に行うためのラむブラリ[泚釈1](#note1)である NumPy の䜿い方を孊びたす。 本章の目暙は、[単回垰分析ず重回垰分析](https://tutorials.chainer.org/ja/07_Regression_Analysis.html)の章で孊んだ重回垰分析を行うアルゎリズムを**NumPy を甚いお実装するこず**です。 NumPy による**倚次元配列multidimensional array**の扱い方を知るこずは、他の様々なラむブラリを利甚する際に圹立ちたす。 䟋えば、様々な機械孊習手法を統䞀的なむンタヌフェヌスで利甚できる **s...
github_jupyter
# HuberRegressorw with StandardScaler This Code template is for the regression analysis using a Huber Regression and the feature rescaling technique StandardScaler in a pipeline. ### Required Packages ``` import warnings import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as ...
github_jupyter
# Signal Autoencoder ``` import numpy as np import scipy as sp import scipy.stats import itertools import logging import matplotlib.pyplot as plt import pandas as pd import torch.utils.data as utils import math import time import tqdm import torch import torch.optim as optim import torch.nn.functional as F from argpa...
github_jupyter
# BetterReads: Optimizing GoodReads review data This notebook explores how to achieve the best results with the BetterReads algorithm when using review data scraped from GoodReads. It is a short follow-up to the exploration performed in the `03_optimizing_reviews.ipynb` notebook. We have two options when scraping rev...
github_jupyter
# 2.18 Programming for Geoscientists class test 2016 # Test instructions * This test contains **4** questions each of which should be answered. * Write your program in a Python cell just under each question. * You can write an explanation of your solution as comments in your code. * In each case your solution program...
github_jupyter
# OGGM flowlines: where are they? In this notebook we show how to access the OGGM flowlines location before, during, and after a run. Some of the code shown here will make it to the OGGM codebase [eventually](https://github.com/OGGM/oggm/issues/1111). ``` from oggm import cfg, utils, workflow, tasks, graphics from o...
github_jupyter
# Introduction to Machine Learning Nanodegree ## Project: Finding Donors for *CharityML* In this project, we employ several supervised algorithms to accurately model individuals' income using data collected from the 1994 U.S. Census. The best candidate algorithm is then chosen from preliminary results and is further o...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn.metrics import r2_score from sklearn.linear_model import SGDRegressor # # load the data # df = pd.read_csv('../Datasets/synth_temp.csv') # # slice 1902 and forward # df = df.loc[df.Year > 1901] # # roll up by year # df_group_year = ...
github_jupyter
[View in Colaboratory](https://colab.research.google.com/github/ArunkumarRamanan/Exercises-Machine-Learning-Crash-Course-Google-Developers/blob/master/validation.ipynb) #### Copyright 2017 Google LLC. ``` # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in complianc...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt import os import sys from hawkes import hawkes, sampleHawkes, plotHawkes, iterative_sampling, extract_samples, sample_counterfactual_superposition, check_monotonicity_hawkes sys.path.append(os.path.abspath('../')) from sampling_utils import thinning_T ``` This not...
github_jupyter
# Two Layer QG Model Example # Here is a quick overview of how to use the two-layer model. See the :py:class:`pyqg.QGModel` api documentation for further details. First import numpy, matplotlib, and pyqg: ``` import numpy as np from matplotlib import pyplot as plt %matplotlib inline import pyqg ``` ## Initialize an...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt ``` This notebook provides a basic example of using the `blg_strain` package to calculate the magnetoelectric susceptibility for strained bilayer graphene. # Strained Lattice ``` from blg_strain.lattice import StrainedLattice sl = StrainedLattice(eps=0.01, thet...
github_jupyter
# Transfer Learning Most of the time you won't want to train a whole convolutional network yourself. Modern ConvNets training on huge datasets like ImageNet take weeks on multiple GPUs. Instead, most people use a pretrained network either as a fixed feature extractor, or as an initial network to fine tune. In this not...
github_jupyter
``` %matplotlib inline import sys import os import json from glob import glob from collections import defaultdict, OrderedDict import dinopy import yaml import matplotlib.pyplot as plt from matplotlib.ticker import MultipleLocator import seaborn import numpy import pandas as pd import networkx from scipy.special impo...
github_jupyter
# LAB 4c: Create Keras Wide and Deep model. **Learning Objectives** 1. Set CSV Columns, label column, and column defaults 1. Make dataset of features and label from CSV files 1. Create input layers for raw features 1. Create feature columns for inputs 1. Create wide layer, deep dense hidden layers, and output layer ...
github_jupyter
# Hive Command Note **Outline** * [Introduction](#intro) * [Syntax](#syntax) * [Reference](#refer) --- Hive is a data warehouse infrastructure tool to process structured data in Hadoop. It resides on top of Hadoop to summarize Big Data, and makes querying and analyzing easy. * **Access Hive**: in cmd, type *`hive...
github_jupyter
# Loading and working with data in sktime Python provides a variety of useful ways to represent data, but NumPy arrays and pandas DataFrames are commonly used for data analysis. When using NumPy 2d-arrays or pandas DataFrames to analyze tabular data the rows are commony used to represent each instance (e.g. case or ob...
github_jupyter
This notebook will show an example of text preprocessing applied to RTL-Wiki dataset. This dataset was introduced in [1] and later recreated in [2]. You can download it in from http://139.18.2.164/mroeder/palmetto/datasets/rtl-wiki.tar.gz -------- [1] "Reading Tea Leaves: How Humans Interpret Topic Models" (NIPS 200...
github_jupyter
``` import pandas as pd import numpy as np from sklearn import metrics from sklearn import preprocessing from sklearn.linear_model import LogisticRegression from sklearn.pipeline import Pipeline from sklearn.preprocessing import OneHotEncoder, StandardScaler from bedrock_client.bedrock.analyzer.model_analyzer import ...
github_jupyter
<table style="float:left; border:none"> <tr style="border:none"> <td style="border:none"> <a href="http://bokeh.pydata.org/"> <img src="http://bokeh.pydata.org/en/latest/_static/bokeh-transparent.png" style="width:70px" > </a> ...
github_jupyter
``` import matplotlib.pyplot as plt import numpy as np import pymc3 as pm import theano from scipy.integrate import odeint from theano import * THEANO_FLAGS = "optimizer=fast_compile" ``` # Lotka-Volterra with manual gradients by [Sanmitra Ghosh](https://www.mrc-bsu.cam.ac.uk/people/in-alphabetical-order/a-to-g/san...
github_jupyter
# Quantum Teleportation This notebook demonstrates quantum teleportation. We first use Qiskit's built-in simulators to test our quantum circuit, and then try it out on a real quantum computer. ## 1. Overview <a id='overview'></a> Alice wants to send quantum information to Bob. Specifically, suppose she wants to send...
github_jupyter
# Train convolutional network for sentiment analysis. Based on "Convolutional Neural Networks for Sentence Classification" by Yoon Kim http://arxiv.org/pdf/1408.5882v2.pdf For `CNN-non-static` gets to 82.1% after 61 epochs with following settings: embedding_dim = 20 filter_sizes = (3, 4) num_filters = 3 dr...
github_jupyter
[![img/pythonista.png](img/pythonista.png)](https://www.pythonista.io) # Esquema de *OpenAPI*. https://swagger.io/docs/specification/basic-structure/ ## Estructura. * Versión de *OpenAPI*. * Información (```info```). * Etiquetas (```tags```). * Servidores (```servers```). * Componentes (```components```). * Esque...
github_jupyter
# COVIDvu - US regions visualizer <img src='resources/American-flag.png' align = 'right'> --- ## Runtime prerequisites ``` %%capture --no-stderr requirementsOutput displayRequirementsOutput = False %pip install -r requirements.txt from covidvu.utils import autoReloadCode; autoReloadCode() if displayRequirementsOutp...
github_jupyter
## Libraries ``` ### Uncomment the next two lines to, ### install tensorflow_hub and tensorflow datasets #!pip install tensorflow_hub #!pip install tensorflow_datasets import numpy as np import tensorflow as tf import matplotlib.pyplot as plt import tensorflow_hub as hub import tensorflow_datasets as tfds from tens...
github_jupyter
``` import math import numpy as np import pandas as pd from matplotlib import pyplot as plt from scipy.stats import bayes_mvs as bayesest import os import time from szsimulator import Szsimulator %matplotlib inline mean_size = 3 # micron doubling_time = 18 #min tmax = 180 #min sample_time = 2 #min div_steps = 10 n...
github_jupyter
# Text Data in scikit-learn ``` import matplotlib.pyplot as plt import sklearn sklearn.set_config(display='diagram') from pathlib import Path import tarfile from urllib import request data_path = Path("data") extracted_path = Path("data") / "train" imdb_path = data_path / "aclImdbmini.tar.gz" def untar_imdb(): ...
github_jupyter
# Create a general MODFLOW model from the NHDPlus dataset Project specific variables are imported in the model_spec.py and gen_mod_dict.py files that must be included in the notebook directory. The first first includes pathnames to data sources that will be different for each user. The second file includes a dictionar...
github_jupyter
``` %matplotlib inline ``` Advanced: Making Dynamic Decisions and the Bi-LSTM CRF ====================================================== Dynamic versus Static Deep Learning Toolkits -------------------------------------------- Pytorch is a *dynamic* neural network kit. Another example of a dynamic kit is `Dynet <ht...
github_jupyter
## Sparse logistic regression $\newcommand{\n}[1]{\left\|#1 \right\|}$ $\newcommand{\R}{\mathbb R} $ $\newcommand{\N}{\mathbb N} $ $\newcommand{\Z}{\mathbb Z} $ $\newcommand{\lr}[1]{\left\langle #1\right\rangle}$ We want to minimize $$\min_x J(x) := \sum_{i=1}^m \log\bigl(1+\exp (-...
github_jupyter
# Ibis Integration (Experimental) The [Ibis project](https://ibis-project.org/docs/) tries to bridge the gap between local Python and [various backends](https://ibis-project.org/docs/backends/index.html) including distributed systems such as Spark and Dask. The main idea is to create a pythonic interface to express SQ...
github_jupyter
### Homework: going neural (6 pts) We've checked out statistical approaches to language models in the last notebook. Now let's go find out what deep learning has to offer. <img src='https://raw.githubusercontent.com/yandexdataschool/nlp_course/master/resources/expanding_mind_lm_kn_3.png' width=300px> We're gonna use...
github_jupyter
# One Shot Learning with Siamese Networks This is the jupyter notebook that accompanies ## Imports All the imports are defined here ``` %matplotlib inline import torchvision import torchvision.datasets as dset import torchvision.transforms as transforms from torch.utils.data import DataLoader,Dataset import matplotl...
github_jupyter
# Naive Bayes $$ \begin{split} \mathop{argmax}_{c_k}p(y=c_k|x) &= \mathop{argmax}_{c_k}p(y=c_k)p(x|y=c_k) \\ & \left( due to: p(y=c_k|x) = \frac{p(y=c_k)p(x|y=c_k)}{p(x)} \right) \\ &= \mathop{argmax}_{c_k}p(y=c_k)\prod_jp(x^{(j)}|y=c_k) \end{split} $$ Use Maximum Likelihood Estimate(MLE) to evaluate $ p(y=c_k)$ and $ ...
github_jupyter
# Working with Streaming Data Learning Objectives 1. Learn how to process real-time data for ML models using Cloud Dataflow 2. Learn how to serve online predictions using real-time data ## Introduction It can be useful to leverage real time data in a machine learning model when making a prediction. However, doing ...
github_jupyter
# Build GAN (Generative Adversarial Networks) with PyTorch and SageMaker ### About GAN Generative Adversarial Network (GAN) i is a generative machine learning model, which is widely used in advertising, games, entertainment, media, pharmaceuticals and other industries. It can be used to create fictional characters an...
github_jupyter
# Quantization of Signals *This jupyter notebook is part of a [collection of notebooks](../index.ipynb) on various topics of Digital Signal Processing. Please direct questions and suggestions to [Sascha.Spors@uni-rostock.de](mailto:Sascha.Spors@uni-rostock.de).* ## Characteristic of a Linear Uniform Quantizer The ch...
github_jupyter
``` import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data from tensorflow.contrib.tensorboard.plugins import projector # 蜜入数据集 mnist = input_data.read_data_sets(r"C:\Users\zdwxx\Downloads\Compressed\MNIST_data", one_hot=True) # 运行次数 max_steps = 550 * 21 # 囟片数量 image_num = 3000 # 定义䌚话 ses...
github_jupyter
# Diseño de software para cómputo científico ---- ## Unidad 5: Integración con lenguajes de alto nivel con bajo nivel. ## Agenda de la Unidad 5 - JIT (Numba) - Cython. - Integración de Python con FORTRAN. - **Integración de Python con C.** ## Recapitulando - Escribimos el código Python. - Pasamos todo a numpy. -...
github_jupyter
# An Introduction to Python using Jupyter Notebooks <a id='toc'></a> ## Table of Contents: ### Introduction * [Python programs are plain text files](#python-programs) * [Use the Jupyter Notebook for editing and running Python](#jn-editing-python) * [How are Jupyter Notebooks stored](#how-its-stored) * [What you need t...
github_jupyter
<a href="https://colab.research.google.com/github/vndee/pytorch-vi/blob/master/chatbot_tutorial.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ## CHATBOT **Tác giả**: [Matthew Inkawhich](https://github.com/MatthewInkawhich) Trong hướng dẫn này chú...
github_jupyter
# Tema 4.1 <a class="tocSkip"> # Imports ``` import math import numpy as np import pandas as pd import matplotlib.pyplot as plt import graphviz import sklearn.tree import sklearn.neighbors import sklearn.naive_bayes import sklearn.svm import sklearn.metrics import sklearn.preprocessing import sklearn.model_selectio...
github_jupyter
# Super Resolution with PaddleGAN and OpenVINO This notebook demonstrates converting the RealSR (real-world super-resolution) model from [PaddlePaddle/PaddleGAN](https://github.com/PaddlePaddle/PaddleGAN) to OpenVINO's Intermediate Representation (IR) format, and shows inference results on both the PaddleGAN and IR mo...
github_jupyter
``` %load_ext autoreload %autoreload 2 import importlib import vsms import torch import torch.nn as nn import clip from vsms import * from vsms import BoxFeedbackQuery class StringEncoder(object): def __init__(self): variant ="ViT-B/32" device='cpu' jit = False self.device = device ...
github_jupyter
``` import sys, os import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt import pandas_profiling as pp sys.path.insert(0, os.path.abspath('..')) from script.functions import * ``` #### First, we import the data and display it after passing it through the function. ``` df = load...
github_jupyter
<a href="https://colab.research.google.com/github/wesleybeckner/technology_fundamentals/blob/main/C4%20Machine%20Learning%20II/SOLUTIONS/SOLUTION_Tech_Fun_C4_S2_Computer_Vision_Part_2_(Defect_Detection_Case_Study).ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In C...
github_jupyter
# Data Manipulation and Plotting with `pandas` ``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns ``` ![pandas](https://upload.wikimedia.org/wikipedia/commons/thumb/e/ed/Pandas_logo.svg/2880px-Pandas_logo.svg.png) ## Learning Goals - Load .csv files into `pandas` DataFr...
github_jupyter
# KCWI_calcs.ipynb functions from Busola Alabi, Apr 2018 ``` from __future__ import division import glob import re import os, sys from astropy.io.fits import getheader, getdata from astropy.wcs import WCS import astropy.units as u import numpy as np from scipy import interpolate import logging from time import time i...
github_jupyter
## MIC Demo 1 - Basic steps for measurement This simple demonstration of the MIC toolbox uses two simulated bivariate VAR(2) models from the ["Macroeconomic simulation comparison with a multivariate extension of the Markov Information Criterion"](https://www.kent.ac.uk/economics/documents/research/papers/2019/1908.pdf...
github_jupyter
# Predicting Remaining Useful Life (advanced) <p style="margin:30px"> <img style="display:inline; margin-right:50px" width=50% src="https://www.featuretools.com/wp-content/uploads/2017/12/FeatureLabs-Logo-Tangerine-800.png" alt="Featuretools" /> <img style="display:inline" width=15% src="https://upload.wikimedi...
github_jupyter
``` #export from local.torch_basics import * from local.test import * from local.layers import * from local.data.all import * from local.notebook.showdoc import show_doc from local.optimizer import * from local.learner import * #default_exp callback.hook ``` # Model hooks > Callback and helper function to add hooks i...
github_jupyter
## Demo of 1D regression with an Attentive Neural Process with Recurrent Neural Network (ANP-RNN) model This notebook will provide a simple and straightforward demonstration on how to utilize an Attentive Neural Process with a Recurrent Neural Network (ANP-RNN) to regress context and target points to a sine curve. Fi...
github_jupyter
<img src="images/usm.jpg" width="480" height="240" align="left"/> # MAT281 - Laboratorio N°02 ## Objetivos del laboratorio * Reforzar conceptos básicos de clasificación. ## Contenidos * [Problema 01](#p1) <a id='p1'></a> ## I.- Problema 01 <img src="https://www.xenonstack.com/wp-content/uploads/xenonstack-credi...
github_jupyter
# T1548.001 - Abuse Elevation Control Mechanism: Setuid and Setgid An adversary may perform shell escapes or exploit vulnerabilities in an application with the setsuid or setgid bits to get code running in a different user’s context. On Linux or macOS, when the setuid or setgid bits are set for an application, the appl...
github_jupyter
``` import matplotlib.pyplot as plt x = [1, 2.1, 0.4, 8.9, 7.1, 0.1, 3, 5.1, 6.1, 3.4, 2.9, 9] y = [1, 3.4, 0.7, 1.3, 9, 0.4, 4, 1.9, 9, 0.3, 4.0, 2.9] plt.scatter(x,y, color='red') w = [0.1, 0.2, 0.4, 0.8, 1.6, 2.1, 2.5, 4, 6.5, 8, 10] z = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] plt.plot(z, w, color='lightblue', linewidt...
github_jupyter
``` import pandas as pd import sklearn as sk import json import ast import pickle import math import matplotlib.pyplot as plt df = pd.read_json('/data/accessible_POIs/great-britain-latest.json') df.loc[:,'id'] = df['Node'].apply(lambda x: dict(x)['id']) df.loc[:,'access'] = df['Node'].apply(lambda x: dict(x)['tags'].ge...
github_jupyter
### Image Captioning To perform image captioning we are going to apply an approach similar to the work described in references [1],[2], and [3]. The approach applied here uses a recurrent neural network (RNN) to train a network to generate image captions. The input to the RNN is comprised of a high-level representatio...
github_jupyter
#### New to Plotly? Plotly's Python library is free and open source! [Get started](https://plotly.com/python/getting-started/) by downloading the client and [reading the primer](https://plotly.com/python/getting-started/). <br>You can set up Plotly to work in [online](https://plotly.com/python/getting-started/#initiali...
github_jupyter
# Process an interferogram with ASF HyP3 https://hyp3-docs.asf.alaska.edu/using/sdk/ ## Search for scenes scenes over grand mesa, colorado using https://asf.alaska.edu/api/ ``` import requests import shapely.geometry roi = shapely.geometry.box(-108.3,39.2,-107.8,38.8) polygonWKT = roi.wkt baseurl = "https://api.d...
github_jupyter
# Activity #1: MarketMap * another way to visualize mappable data ## 1.a : explore the dataset ``` # our usual stuff %matplotlib inline import pandas as pd import numpy as np #!pip install xlrd # JPN, might have to run this # note: this is quering from the web! How neat is that?? df = pd.read_excel('https://query.d...
github_jupyter
``` import sys import os os.environ["CUDA_VISIBLE_DEVICES"]="0" #for training on gpu from scipy import signal import tensorflow as tf import matplotlib.pyplot as plt import numpy as np import pickle import time from random import shuffle from tensorflow import keras from tensorflow.keras.utils import to_categorical fr...
github_jupyter
# 蜬眮卷积 :label:`sec_transposed_conv` 到目前䞺止我们所见到的卷积神经眑络层䟋劂卷积层 :numref:`sec_conv_layer`和汇聚层 :numref:`sec_pooling`通垞䌚减少䞋采样蟓入囟像的空闎绎床高和宜。 然而劂果蟓入和蟓出囟像的空闎绎床盞同圚以像玠级分类的语义分割䞭将䌚埈方䟿。 䟋劂蟓出像玠所倄的通道绎可以保有蟓入像玠圚同䞀䜍眮䞊的分类结果。 䞺了实现这䞀点尀其是圚空闎绎床被卷积神经眑络层猩小后我们可以䜿甚及䞀种类型的卷积神经眑络层它可以增加䞊采样䞭闎层特埁囟的空闎绎床。 圚本节䞭我们将介绍 *蜬眮卷积*transposed convol...
github_jupyter
##### Copyright 2020 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
### Strings - Quotation Marks ``` # Quotation marks must be matching. Both of the following work. good_string = "Hello, how are you?" another_good_string = 'Hello, how are you?' # These strings will not work bad_string = 'Don't do that' another_bad_string = "Don't do that' # Notice you enclose the whole sentence in do...
github_jupyter
``` import copy if __name__ == '__main__': %run Tests.ipynb %run MoleculeGenerator2.ipynb %run Discrim.ipynb %run Rewards.ipynb %run PPO_WITH_TRICKS.ipynb %run ChemEnv.ipynb %run SupervisedPreTraining.ipynb device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") # wants: a...
github_jupyter
Lambda School Data Science, Unit 2: Predictive Modeling # Applied Modeling, Module 3 ### Objective - Visualize and interpret partial dependence plots ### Links - [Kaggle / Dan Becker: Machine Learning Explainability — Partial Dependence Plots](https://www.kaggle.com/dansbecker/partial-plots) - [Christoph Molnar: Int...
github_jupyter
# Obtaining movie data, API-testing ``` # open questions: # API only allows 1k requests per day.. # initial load (static database) or load on request, maybe another API required then? # regular updates? import requests import pandas as pd ``` # get imdb ids ``` # uses links.csv, a list of random imdbIds from https:...
github_jupyter
# MLP ORF to GenCode Use GenCode 38 and length-restricted data. Use model pre-trained on Simulated ORF. ``` import time def show_time(): t = time.time() print(time.strftime('%Y-%m-%d %H:%M:%S %Z', time.localtime(t))) show_time() import numpy as np import pandas as pd import matplotlib.pyplot as plt from sk...
github_jupyter
# Step 1: Data gathering __Step goal__: Download and store the datasets used in this study. __Step overview__: 1. London demographic data; 2. London shape files; 3. Counts data; 4. Metro stations and lines. #### Introduction All data is __open access__ and can be found on the official websites. Note, that the data ...
github_jupyter
<h1 align="center">Exploratory Analysis : Game of Thrones</h1> ![Game of Thrones](https://upload.wikimedia.org/wikipedia/en/d/d8/Game_of_Thrones_title_card.jpg) One of the most popular television series of all time, Game of Thrones is a fantasy drama set in fictional continents of Westeros and Essos filled with multi...
github_jupyter
# HyperEuler on MNIST-trained Neural ODEs ``` import sys ; sys.path.append('..') from torchdyn.models import *; from torchdyn import * import torch import torch.nn as nn from torch.utils.data import DataLoader from torchvision import datasets, transforms import pytorch_lightning as pl from pytorch_lightning.loggers i...
github_jupyter
``` import numpy as np import tensorflow as tf import random as rn import os import matplotlib.pyplot as plt %matplotlib inline os.environ['PYTHONHASHSEED'] = '0' np.random.seed(1) rn.seed(1) from keras import backend as K tf.compat.v1.set_random_seed(1) #sess = tf.Session(graph=tf.get_default_graph()) #K.set_session(s...
github_jupyter
<h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#Modeling" data-toc-modified-id="Modeling-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>Modeling</a></span><ul class="toc-item"><li><span><a href="#Victims" data-toc-modified-id="Victims-1.1"><span class...
github_jupyter
``` # evaluate RFE for classification import numpy as np from sklearn.datasets import make_classification from sklearn.model_selection import cross_val_score, RepeatedStratifiedKFold, RepeatedKFold from sklearn.feature_selection import RFE from sklearn.tree import DecisionTreeClassifier from sklearn.pipeline import Pip...
github_jupyter
# [Day 8](https://www.hackerrank.com/challenges/30-dictionaries-and-maps/problem) ``` {'1':'a'}.update({'2':'c'}) d = {} for i in range(int(input())): x = input().split() d[x[0]] = x[1] while True: try: name = input() if name in d: print(name, "=", d[name], sep="") else:...
github_jupyter
# Introduction to XGBoost Spark with GPU The goal of this notebook is to show how to train a XGBoost Model with Spark RAPIDS XGBoost library on GPUs. The dataset used with this notebook is derived from Fannie Mae’s Single-Family Loan Performance Data with all rights reserved by Fannie Mae. This processed dataset is re...
github_jupyter
# Exp 41 analysis See `./informercial/Makefile` for experimental details. ``` import os import numpy as np from IPython.display import Image import matplotlib import matplotlib.pyplot as plt %matplotlib inline %config InlineBackend.figure_format = 'retina' import seaborn as sns sns.set_style('ticks') matplotlib.r...
github_jupyter
# DOPPELGANGER # ## Ever wondered how your "doppelganger" dog would look like? # EXPERIMENT LOCALLY ### Prepare Environment Install and import needed modules. ``` import numpy as np import pandas as pd import os from tensorflow.keras.preprocessing.image import ImageDataGenerator from tensorflow.keras.applications.x...
github_jupyter
## Exercise 3.10 Taxicab (tramcar) problem Suppose you arrive in a new city and see a taxi numbered 100. How many taxis are there in this city? Let us assume taxis are numbered sequentially as integers starting from 0, up to some unknown upper bound $\theta$. (We number taxis from 0 for simplicity; we can also count fr...
github_jupyter
## Nearest Neighbor item based Collaborative Filtering ![image.png](https://miro.medium.com/max/1400/1*aSq9viZGEYiWwL9uJ3Recw.png) Source: https://towardsdatascience.com ``` ##Dataset url: https://grouplens.org/datasets/movielens/latest/ import pandas as pd import numpy as np r_cols = ['user_id','movie_id','rating'...
github_jupyter
# PaddleOCR DJL example In this tutorial, we will be using pretrained PaddlePaddle model from [PaddleOCR](https://github.com/PaddlePaddle/PaddleOCR) to do Optical character recognition (OCR) from the given image. There are three models involved in this tutorial: - Word detection model: used to detect the word block f...
github_jupyter
# Física de partículas ... com R e tidyverse Esse tutorial utiliza os dados abertos do experimento CMS do LHC [CMS Open Data](http://opendata.cern.ch/about/cms) Disponíveis no site [CERN Open Data portal](http://opendata.cern.ch). Para rodar esse tutorial offline, vide o arquivo [README](https://github.com/cms-open...
github_jupyter
文章来自 䜜者子实 曎倚机噚孊习笔记访问[这里](https://github.com/zlotus/notes-LSJU-machine-learning) # 第十五讲PCA的奇匂倌分解、独立成分分析 回顟䞀䞋䞊䞀讲的内容——PCA算法䞻芁有䞉䞪步骀 1. 将数据正规化䞺零期望以及单䜍化方差 2. 计算协方差矩阵$\displaystyle\varSigma=\frac{1}{m}x^{(i)}\left(x^{(i)}\right)^T$ 3. 扟到$\varSigma$的前$k$䞪特埁向量。 圚䞊䞀讲的最后我们还介绍了PCA圚面郚识别䞭的应甚。试想䞀䞋圚面郚识别䞭$x^{(i)}\in\mathbb R...
github_jupyter
<h1 align="center">SimpleITK Spatial Transformations</h1> **Summary:** 1. Points are represented by vector-like data types: Tuple, Numpy array, List. 2. Matrices are represented by vector-like data types in row major order. 3. Default transformation initialization as the identity transform. 4. Angles specified in ra...
github_jupyter
``` ##### derived from https://github.com/bozhu/AES-Python import copy Sbox = ( 0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5, 0x30, 0x01, 0x67, 0x2B, 0xFE, 0xD7, 0xAB, 0x76, 0xCA, 0x82, 0xC9, 0x7D, 0xFA, 0x59, 0x47, 0xF0, 0xAD, 0xD4, 0xA2, 0xAF, 0x9C, 0xA4, 0x72, 0xC0, 0xB7, 0xFD, 0x93, 0x26, 0x36, 0x3F,...
github_jupyter
# CME 193 - Lecture 8 Here's what you've seen over the past 7 lectures: * Python Language Basics * NumPy - Arrays/Linear Algebra * SciPy - Sparse Linear Algebra/Optimization * DataFrames - Reading & Maniputlating tabular data * Scikit learn - Machine Learning Models & use with data * Ortools - More Optimization You'v...
github_jupyter
``` import xarray as xr import numpy as np import pandas as pd import matplotlib.pyplot as plt import seawater as sw import cartopy.crs as ccrs # import projections import cartopy.feature as cf # import features fig_dir='C:/Users/gentemann/Google Drive/f_drive/docs/projects/misst-arct...
github_jupyter
# Understanding Data Actions blocktorch streamlines the creation and implementation of machine learning models for tabular data. One of the many features it offers is [data checks](https://blocktorch.alteryx.com/en/stable/user_guide/data_checks.html), which are geared towards determining the health of the data before ...
github_jupyter
``` import numpy as np from bokeh.plotting import figure, show, output_notebook from bokeh.layouts import gridplot output_notebook() N = 9 x = np.linspace(-2, 2, N) y = x**2 sizes = np.linspace(10, 20, N) xpts = np.array([-.09, -.12, .0, .12, .09]) ypts = np.array([-.1, .02, .1, .02, -.1]) figures = [] p = figure(title...
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
<div class="alert alert-block alert-info"> <font size="5"><b><center> Section 5</font></center> <br> <font size="5"><b><center>Recurrent Neural Network in PyTorch with an Introduction to Natural Language Processing</font></center> </div> Credit: This example is obtained from the following book: Subramanian, Vishnu. 2...
github_jupyter
``` import numpy as np import pandas as pd import holoviews as hv import networkx as nx from holoviews import opts hv.extension('bokeh') defaults = dict(width=400, height=400) hv.opts.defaults( opts.EdgePaths(**defaults), opts.Graph(**defaults), opts.Nodes(**defaults)) ``` Visualizing and working with network gr...
github_jupyter
# Data Analysis of Bitcoin and Where it is Heading # Graphing the whole Graph ``` #### Importing Pandas and others and Reading csv file import os import matplotlib.pyplot as plt import numpy as np import seaborn as sns import pandas as pd import plotly.express as px ##Remodified .CSV data to make managing data easie...
github_jupyter
<a href="https://colab.research.google.com/github/google/jax-md/blob/main/notebooks/athermal_linear_elasticity.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` #@title Imports and utility code !pip install jax-md import numpy as onp import jax....
github_jupyter
``` # noexport import os os.system('export_notebook identify_domain_training_data.ipynb') from tmilib import * import csv import sys num_prev_enabled = int(sys.argv[1]) num_labels_enabled = 2 + num_prev_enabled data_version = 4 + num_prev_enabled print 'num_prev_enabled', num_prev_enabled print 'data_version', data_ve...
github_jupyter
# Module 3 Required Coding Activity Introduction to Python (Unit 2) Fundamentals All course .ipynb Jupyter Notebooks are available from the project files download topic in Module 1, Section 1. This is an activity from the Jupyter Notebook **`Practice_MOD03_IntroPy.ipynb`** which you may have already completed. ...
github_jupyter
<a href="https://colab.research.google.com/github/Tessellate-Imaging/monk_v1/blob/master/study_roadmaps/1_getting_started_roadmap/2_elemental_features_of_monk/5)%20Feature%20-%20Switch%20modes%20without%20reloading%20experiment%20-%20train%2C%20eval%2C%20infer.ipynb" target="_parent"><img src="https://colab.research.go...
github_jupyter