text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
``` import sys import numpy as np import scipy.io as sio import keras import numpy as np import os import matplotlib import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split from keras.optimizers import SGD from keras.optimizers import Adam, Adadelta from keras.callbacks import ModelCheckp...
github_jupyter
# CycleGAN, Image-to-Image Translation In this notebook, we're going to define and train a CycleGAN to read in an image from a set $X$ and transform it so that it looks as if it belongs in set $Y$. Specifically, we'll look at a set of images of [Yosemite national park](https://en.wikipedia.org/wiki/Yosemite_National_P...
github_jupyter
# TensorFlow In this notebook, we'll learn the basics of [TensorFlow + Keras](https://tensorflow.org), which is a machine learning library used to build dynamic neural networks. We'll learn about the basics, like creating and using Tensors. # Set seeds ``` %tensorflow_version 2.x import numpy as np import tensorflow...
github_jupyter
``` %load_ext watermark import numpy as np import pandas as pd ``` ## Load the JupyterHub logs ``` columns = ['user', 'machine', 'session_start', 'session_end', 'session_length', 'log_file'] df_all = pd.read_csv("../data/jhub_logs.csv.gz", parse_dates=["session_start", "session_end"]) df_all["session_length"] = (df_a...
github_jupyter
``` %serialconnect # below is the esp8266 version # RST | GPIO1 TX # A0 | GPIO3 RX # D0 GPIO16 | GPIO5 D1 SCL # SCK D5 GPIO14 | GPIO4 D2 SDA # MISO D6 GPIO12 | GPIO0 D3 # MOSI D7 GPIO13 | GPIO2 D4 LED # SS D8 GPIO15 | GND # 3V3 ...
github_jupyter
# MAPEM de Pierro algorithm for the Bowsher prior One of the more popular methods for guiding a reconstruction based on a high quality image was suggested by Bowsher. This notebook explores this prior. We highly recommend you look at the [PET/MAPEM](../PET/MAPEM.ipynb) notebook first. This example extends upon the qua...
github_jupyter
``` %matplotlib inline ``` ************************* Text rendering With LaTeX ************************* Rendering text with LaTeX in Matplotlib. Matplotlib has the option to use LaTeX to manage all text layout. This option is available with the following backends: * Agg * PS * PDF The LaTeX option is activated ...
github_jupyter
``` #all_slow ``` # Tutorial - Migrating from Lightning > Incrementally adding fastai goodness to your Lightning training We're going to use the MNIST training code from Lightning's 'Quick Start' (as at August 2020), converted to a module. See `migrating_lightning.py` for the Lightning code we are importing here. `...
github_jupyter
``` %load_ext autoreload %autoreload 2 ``` # LDLS Demo This notebook demonstrates how to use LDLS to perform instance segmentation of a LiDAR point cloud. This demo uses Frame 571 from the KITTI object detection dataset. ## Setup Import LiDAR segmentation modules: ``` import numpy as np from pathlib import Path im...
github_jupyter
# Background Computation with "ofilter" This notebook illustrate background calculations using `ofilter` algorithm adapted from IRAF. ``` import matplotlib.pyplot as plt import numpy as np import scipy import ofiltsky %matplotlib inline ``` ### Generate Data ``` # Set the seed for reproducibility np.random.seed(0...
github_jupyter
<a href="https://colab.research.google.com/github/NeuromatchAcademy/course-content/blob/master/tutorials/W3D2_DynamicNetworks/student/W3D2_Tutorial1.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Neuromatch Academy: Week 3, Day 2, Tutorial 1 # Ne...
github_jupyter
# Creating city models and objects In this tutorial we explore how to create new city models with using `cjio`'s API. ``` from pathlib import Path from cjio import cityjson from cjio.models import CityObject, Geometry ``` Set up paths for the tutorial. ``` package_dir = Path(__name__).resolve().parent.parent.pare...
github_jupyter
# Image classification of simulated AT-TPC events Welcome to this project in applied machine learning. In this project we will tackle a simple classification problem of two different classes. The classes are simulated reaction types for the Ar(p, p') experiment conducted at MSU, in this task we'll focus on the classi...
github_jupyter
### Import Package ``` import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers import numpy as np import traceback import contextlib import pathlib ``` ### Load Dataset ``` mnist = tf.keras.datasets.fashion_mnist (X_train, y_train), (X_test, y_test) = mnist.load_data() print("Train...
github_jupyter
<a href="https://colab.research.google.com/github/probml/probml-notebooks/blob/main/notebooks/bnn_hmc_gaussian.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # (SG)HMC for inferring params of a 2d Gaussian Based on https://github.com/google-rese...
github_jupyter
# CIFAR10 전이학습 기반 분류기 이 노트북은 사전 훈련된 심층-CNN 중에서 VGG16으로 전이학습의 개념을 확용한 분류기를 구축하는 단계를 개략적으로 설명한다. ``` %matplotlib inline # Pandas and Numpy for data structures and util fucntions import scipy as sp import numpy as np import pandas as pd from numpy.random import rand pd.options.display.max_colwidth = 600 # Scikit 임포트 f...
github_jupyter
# Table of Contents <p><div class="lev1 toc-item"><a href="#Setting-up-your-machine-Learning-Application" data-toc-modified-id="Setting-up-your-machine-Learning-Application-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>Setting up your machine Learning Application</a></div><div class="lev2 toc-item"><a href="#Train...
github_jupyter
[source](../api/alibi_detect.ad.model_distillation.rst) # Model distillation ## Overview [Model distillation](https://arxiv.org/abs/1503.02531) is a technique that is used to transfer knowledge from a large network to a smaller network. Typically, it consists of training a second model with a simplified architecture...
github_jupyter
## 각 형태소 분석기 비교 (KKMA, KOMORAN, MECAB, TWITTER) ##### 긍정리뷰 3개 vs. 부정리뷰 3개를 기준으로 ------------ #### 긍정리뷰 "3달정도 사용해오고 있는데 가성비부터 최고예요. 운동도 하고 교통비도 아끼고 대만족입니다." "QR코드 이용해서 대여하니 빠르고 편해요. 처음 이용해봤는데 좋았네요^^" "너무너무 좋아요. 결제도 쉽고 대여소 찾는 것도 쉽고 정기권 끊어서 타고있어요. 이거 덕분에 자전거 많이 타고있어요!! 감사합니다~" #### 부정리뷰 "소셜로그인은 ...
github_jupyter
<a href="https://colab.research.google.com/github/liscolme/EscapeEarth/blob/main/Interns/Elise/BLS_Function_Test.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` from google.colab import drive drive.mount('/content/gdrive') ######################...
github_jupyter
``` import math import numpy as np from sympy import * t, s, k = symbols('t, s, k') # Defino los métodos de suma de rectángulos - izquierda def _Riemman_izq(Func, limA, limB, numI): """ Método de la Bisección para encontrar raíces en un intervalo. ## Parámetros: Func (function) : función que de...
github_jupyter
``` file_1 = """Stock Close Beta Cap Apple 188.72 0.2 895.667B Tesla 278.62 0.5 48.338B""" file_2 = """Employee Wage Hired Promotion Linda 3000 2017 Yes Bob 2000 2016 No Joshua 800 2019 Yes""" ``` ### My solution Other approaches are possible ``` def parser(stringa): """ Parse string and returns dict of list...
github_jupyter
``` import numpy as np import pandas as pd import xarray as xr from glob import glob import pymongo import pdb from datetime import datetime, timedelta from sqlalchemy import create_engine import time import psycopg2 import os from io import StringIO from scipy import sparse from scipy.sparse.linalg import svds impo...
github_jupyter
<a href="https://colab.research.google.com/github/satyajitghana/PadhAI-Course/blob/master/11_VectorizedGDAlgorithms.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import numpy as np import matplotlib.pyplot as plt import matplotlib.colors impor...
github_jupyter
<a href="https://colab.research.google.com/github/mottaquikarim/PYTH2/blob/master/src/Topics/nb/basic_data_types.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Basic Data Types Let's discuss data types, variables, and naming. A data type is a u...
github_jupyter
# CT-LTI: Multiple Sample Performance Evaluation Table This table is found in the appendix section A.4. and summarizes the performance comparison between NODEC and OC in relative terms of error and energy. Without extensive hyperparameter optimization we see that NODEC is competitive to OC for all graphs and intial-tar...
github_jupyter
## PLINK GWAS Regression Tutorial These commands walk through running the GWAS regressions from Marees et al. 2018 using PLINK. As in all PLINK tutorials, the comments and code from the original tutorial are included with R steps commented out (and replaced by python where necessary) and to disambiguate between comme...
github_jupyter
### quero usar matplotlib para ilustrar permutações A primeira coisa é fazer circulos numerados ``` %matplotlib inline import matplotlib.pyplot as plt import numpy as np circle1=plt.Circle((0,0),.1,color='r', alpha=0.2, clip_on=False) plt.axes(aspect="equal") fig = plt.gcf() fig.gca().add_artist(circle1) plt.axis("o...
github_jupyter
# Fitting to existing data ``` # Base Data Science snippet import pandas as pd import numpy as np import matplotlib.pyplot as plt import os import time from tqdm import tqdm_notebook %matplotlib inline %load_ext autoreload %autoreload 2 ``` Inspiration - https://www.lewuathe.com/covid-19-dynamics-with-sir-model.html...
github_jupyter
<img src="https://raw.githubusercontent.com/brazil-data-cube/code-gallery/master/img/logo-bdc.png" align="right" width="64"/> # <span style="color:#336699">Introduction to the SpatioTemporal Asset Catalog (STAC)</span> <hr style="border:2px solid #0077b9;"> <div style="text-align: left;"> <a href="https://nbviewe...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt %matplotlib inline import plotly.offline as py import plotly.graph_objs as go import plotly.tools as tls import seaborn as sns import io from google.colab import files uploaded = files.upload() data = uploaded['LAND TEMPERATURES FILE FROM KAGGLE...
github_jupyter
``` import bare ``` #### Plot detected interest points over images ``` image_file_name = 'image.tif' ip_file_name = 'image.vwip' ip_csv_file_name = bare.core.write_ip_to_csv(ip_file_name) bare.plot.ip_plot(image_file_name, ip_csv_file_name) ``` !['example_plot_IP'](example_plots/interest_points/v2_sub8_interest_poi...
github_jupyter
``` %matplotlib inline import numpy as np import pandas as pd import scipy import sklearn import spacy import matplotlib.pyplot as plt import seaborn as sns import re from nltk.corpus import state_union, stopwords from collections import Counter from sklearn.model_selection import train_test_split import warnings warni...
github_jupyter
<a href="https://colab.research.google.com/github/GivanTsai/Bert-cookbook/blob/main/BERT_Fine_Tuning_Sentence_Classification_v4.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # BERT Fine-Tuning Tutorial with PyTorch By Chris McCormick and Nick Rya...
github_jupyter
# Example: Polynomial Cureve Fitting Observse a real-valued input variable $x$ $\rightarrow$ predict a real-valued target variable $t$ * $\textbf{x} \equiv (x_1, \cdots, x_i, \cdots, x_N)^T, \quad x_i \in [0, 1]$ * $\textbf{t} \equiv (t_1, \cdots, t_i, \cdots, t_N)^T, \quad t_i = \sin(2\pi x_i) + N(\mu, \sigma^2)$ ...
github_jupyter
## Initialization ``` import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt import math import scipy.io from scipy.special import expit from math import * from scipy import optimize sns.set_style('whitegrid') %matplotlib inline ``` ## Loading Data ``` mat = scipy.io.loadmat('ex...
github_jupyter
# Analyse wavefields This notebook checks the velocity models and FD simulations output by `generate_velocity_models.py` and `generate_forward_simulations.py` are sensible. ``` import glob import matplotlib.pyplot as plt import matplotlib.animation as animation import numpy as np import scipy as sp import sys sys.pat...
github_jupyter
# Week 3: Transfer Learning Welcome to this assignment! This week, you are going to use a technique called `Transfer Learning` in which you utilize an already trained network to help you solve a similar problem to the one it was originally trained to solve. Let's get started! ``` import os import zipfile import matp...
github_jupyter
# Introduction to Taxi ETL Job This is the Taxi ETL job to generate the input datasets for the Taxi XGBoost job. ## Prerequirement ### 1. Download data All data could be found at https://www1.nyc.gov/site/tlc/about/tlc-trip-record-data.page ### 2. Download needed jars * [cudf-21.12.2-cuda11.jar](https://repo1.maven.o...
github_jupyter
``` # default_exp cli #hide from nbdev.showdoc import * #export from dash_oop_components.core import * #export import os import webbrowser from pathlib import Path import click ``` # dashapp CLI > a simple way of launching dashboards directly from the commandline With `dash_oop_components` you can easily dump the co...
github_jupyter
# Bag of Tricks Experiment Analyze the effects of our different "tricks". 1. Sample matches off mask 2. Scale by hard negatives 3. L2 pixel loss on matches We will compare standard network, networks missing one trick only, and a network without any tricks (i.e same as Tanner Schmidt) ``` import dense_correspondence...
github_jupyter
# Calculate Shapley values Shapley values as used in coalition game theory were introduced by William Shapley in 1953. [Scott Lundberg](http://scottlundberg.com/) applied Shapley values for calculating feature importance in [2017](http://papers.nips.cc/paper/7062-a-unified-approach-to-interpreting-model-predictions....
github_jupyter
# Allosteric pathways with current flow analysis on protein-cofactor networks *This tutorial shows how to build and analyze networks that include protein residues and cofactors (e.g. lipids or small molecules).* ***Note***: To build and analyze a residue interaction network of the isolated protein only, just skip the...
github_jupyter
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-59152712-8"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-59152712-8'); </script> # Start-to-Finish Example: Validating Shifted Kerr-Schild i...
github_jupyter
# Aerospace and Defense Portfolio Risk and Returns ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import math import warnings warnings.filterwarnings("ignore") # fix_yahoo_finance is used to fetch data import yfinance as yf yf.pdr_override() # input # Aerospace and ...
github_jupyter
``` import numpy as np import pandas as pd import scipy print(f"SciPy version: {scipy.__version__}") from collections import OrderedDict import scipy.sparse as sp import time import random from constants import (DATA_OCT, DATA_NOV, EXPORT_DIR, UX_CONSTANTS, SEED, NEW_USER_ID, NEW_PRODUCT_ID, T, USECOLS, ...
github_jupyter
# **Working memory training**: Module allegiance matrix calculation **Last edited:** 04-10-2018 Step 0: Loading libraries -------------------------------- ``` import sys sys.path.append("..") import os %matplotlib inline import scipy.io as sio import numpy as np from nilearn import plotting import pandas as pd i...
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-machine-learning/resources/bANLa) course resource._ --- ## Applied Machine...
github_jupyter
## Dependencies ``` import json, warnings, shutil, glob from jigsaw_utility_scripts import * from scripts_step_lr_schedulers import * from transformers import TFXLMRobertaModel, XLMRobertaConfig from tensorflow.keras.models import Model from tensorflow.keras import optimizers, metrics, losses, layers SEED = 0 seed_ev...
github_jupyter
# Data pre-processing steps 1. Remove columns that contain "Call" data 2. Transpose the dataframe so that each row is a patient and each column is a gene 3. Remove gene description and set the gene accession numbers as the column headers 4. Merge the data (expression values) with the class labels (patient numbers) ``...
github_jupyter
# 1A.e - Correction de l'interrogation écrite du 14 novembre 2014 coût algorithmique, calcul de séries mathématiques ``` from jyquickhelper import add_notebook_menu add_notebook_menu() ``` ## Enoncé 1 ### Q1 Le code suivant produit une erreur. Corrigez le programme. ``` nbs = [ 1, 5, 4, 7 ] # for n in nbs: ...
github_jupyter
``` import time import glob import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap from sklearn.metrics import confusion_matrix, accuracy_score, classification_report from sklearn.preprocessing import StandardScaler from sklearn.model_selection import train_t...
github_jupyter
# Spark JDBC to Databases - [Overview](#spark-jdbc-overview) - [Setup](#spark-jdbc-setup) - [Define Environment Variables](#spark-jdbc-define-envir-vars) - [Initiate a Spark JDBC Session](#spark-jdbc-init-session) - [Load Driver Packages Dynamically](#spark-jdbc-init-dynamic-pkg-load) - [Load Driver Packag...
github_jupyter
``` #experiment name and snapshot folder (used for model persistence) from __future__ import print_function experiment_setup_name = "tutorial.wikicat.advanced" snapshot_path = "./agentnet_snapshots/" !mkdir ./agentnet_snapshots import numpy as np from matplotlib import pyplot as plt %matplotlib inline #theano imports...
github_jupyter
# Math Part 1 ``` from __future__ import print_function import tensorflow as tf import numpy as np from datetime import date date.today() author = "kyubyong. https://github.com/Kyubyong/tensorflow-exercises" tf.__version__ np.__version__ sess = tf.InteractiveSession() ``` NOTE on notation * _x, _y, _z, ...: NumPy 0-d...
github_jupyter
``` import matplotlib as mpl import matplotlib.pyplot as plt age_x = [25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35] dev_x = [38496, 42000, 46752, 49320, 53200, 56000, 62316, 64928, 67317, 68748, 73752] ax = plt.bar(age_x, dev_x) for index, value in zip(age_x, dev_x): plt.text(index, value+5000, f'{...
github_jupyter
# Dask pipeline ## Example: Tracking the International Space Station with Dask In this notebook we will be using two APIs: 1. [Google Maps Geocoder](https://developers.google.com/maps/documentation/geocoding/overview) 2. [Open Notify API for ISS location](http://api.open-notify.org/) We will use them to keep track ...
github_jupyter
# Multi-Timescale Prediction This notebook showcases some ways to use the **MTS-LSTM** from our recent publication to generate predictions at multiple timescales: [**"Rainfall-Runoff Prediction at Multiple Timescales with a Single Long Short-Term Memory Network"**](https://arxiv.org/abs/2010.07921). Let's assume we h...
github_jupyter
# Helium Hydride (Tapered HeH+) Exemplar ## Step 0: Import various libraries ``` # Imports for QSCOUT import jaqalpaq from jaqalpaq.core import circuitbuilder from jaqalpaq.core.circuit import normalize_native_gates from jaqalpaq import pygsti from qscout.v1 import native_gates # Imports for basic mathematical functi...
github_jupyter
# Regularization Welcome to the second assignment of this week. Deep Learning models have so much flexibility and capacity that **overfitting can be a serious problem**, if the training dataset is not big enough. Sure it does well on the training set, but the learned network **doesn't generalize to new examples** that...
github_jupyter
### Global and Local Scopes In Python the **global** scope refers to the **module** scope. The scope of a variable is normally defined by **where** it is (lexically) defined in the code. ``` a = 10 ``` In this case, **a** is defined inside the main module, so it is a global variable. ``` def my_func(n): c = n ...
github_jupyter
# Ungraded Lab: Walkthrough of ML Metadata Keeping records at each stage of the project is an important aspect of machine learning pipelines. Especially in production models which involve many iterations of datasets and re-training, having these records will help in maintaining or debugging the deployed system. [ML Me...
github_jupyter
## Exercise: Pricing a European Call Option under Risk Neutrality #### John Stachurski Let's price a European option under the assumption of risk neutrality (for simplicity). Suppose that the current time is $t=0$ and the expiry date is $n$. We need to evaluate $$ P_0 = \beta^n \mathbb E_0 \max\{ S_n - K, 0 \} $$ ...
github_jupyter
# Weight Sampling Tutorial If you want to fine-tune one of the trained original SSD models on your own dataset, chances are that your dataset doesn't have the same number of classes as the trained model you're trying to fine-tune. This notebook explains a few options for how to deal with this situation. In particular...
github_jupyter
## Build an MTH5 and Operate the Aurora Pipeline Outlines the process of making an MTH5 file, generating a processing config, and running the aurora processor ``` # Required imports for theh program. from pathlib import Path import sys import pandas as pd from mth5.clients.make_mth5 import MakeMTH5 from mth5 import ...
github_jupyter
``` import wandb wandb.init(project="test") from wandb.integration.sb3 import WandbCallback ''' A large part of the code in this file was sourced from the rl-baselines-zoo library on GitHub. In particular, the library provides a great parameter optimization set for the PPO2 algorithm, as well as a great example impleme...
github_jupyter
Objective ------------------------ Try out different hypothesis to investigate the effect of lockdown measures on mobility - Assume that mobility is affected by weather, lockdown and miscellanous - Consider misc. info to be one such as week info (if it is a holisday week etc...) - Assume mobility follows a weekly pat...
github_jupyter
# Studying avoided crossing for a 1 cavity-2 qubit system, <mark>with and without thermal losses</mark> 1. **Introduction** 2. **Problem parameters** 3. **Setting up operators, Hamiltonian's, and the initial state** 4. **Demonstrating avoided crossing** * Plotting the ramp pulse generated * Solving the Master...
github_jupyter
# seaborn.jointplot --- Seaborn's `jointplot` displays a relationship between 2 variables (bivariate) as well as 1D profiles (univariate) in the margins. This plot is a convenience class that wraps [JointGrid](http://seaborn.pydata.org/generated/seaborn.JointGrid.html#seaborn.JointGrid). ``` %matplotlib inline import ...
github_jupyter
# Think Bayes: Chapter 9 This notebook presents code and exercises from Think Bayes, second edition. Copyright 2016 Allen B. Downey MIT License: https://opensource.org/licenses/MIT ``` from __future__ import print_function, division % matplotlib inline import warnings warnings.filterwarnings('ignore') import math...
github_jupyter
**Documentation for getting started with ipyleaflet:** https://ipyleaflet.readthedocs.io **Video tutorial for this:** https://www.youtube.com/watch?v=VW1gYD5eB6E ## Create default interactive map ``` # import the package import ipyleaflet # define m as a default map m = ipyleaflet.Map() # display map m ``` ## Cu...
github_jupyter
``` import seaborn as sns from matplotlib import pyplot as plt import numpy as np import pandas as pd #load dataset into the notebook data = pd.read_csv('titanic.csv') data.head() #get all coumns in small caps data.columns.str.lower() #lets look the mean of survival using gender data.groupby('Sex')[['Survived']].mean()...
github_jupyter
``` import numpy as np import pandas as pd import scipy as sp import matplotlib.pyplot as plt import matplotlib as mpl import seaborn as sns sns.set() from IPython.core.pylabtools import figsize import statsmodels.api as sm from patsy import dmatrix df = pd.read_csv('~/src/properties_2016.csv') df.tail() train_2016_d...
github_jupyter
# Read datasets ``` import pandas as pd countries_of_the_world = pd.read_csv('../datasets/countries-of-the-world.csv') countries_of_the_world.head() mpg = pd.read_csv('../datasets/mpg.csv') mpg.head() student_data = pd.read_csv('../datasets/student-alcohol-consumption.csv') student_data.head() young_people_survey_dat...
github_jupyter
# Preprocessing To begin the training process, the raw images first had to be preprocessed. For the most part, this meant removing the banners that contained image metadata while retaining as much useful image data as possible. To remove the banners, I used a technique called "reflective padding" which meant I remove ...
github_jupyter
<a href="https://colab.research.google.com/github/GavinHacker/recsys_model/blob/master/7_recbaserecall.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # 使用基于电影相似度进行推荐的方法进行召回 ### install library ``` !pip install pymysql from google.colab import dri...
github_jupyter
# 03 - Registering a Model in your Workspace Now that we have trained a set of models and identified the run containing the best model, we want to deploy the model for inferencing. ``` import environs e_vars = environs.Env() e_vars.read_env('../workshop.env') USER_NAME = e_vars.str("USER_NAME") EXPERIMENT_NAME = e_...
github_jupyter
``` from datascience import * import seaborn as sns import numpy as np import pandas as pd %matplotlib inline import matplotlib.pyplot as plt import statsmodels.formula.api as smf from matplotlib.lines import Line2D plt.style.use('seaborn') #Data clarification #Rank - Current World ranking based on 4 last competitions ...
github_jupyter
``` CLR = { 'blue': ['#e0f3ff', '#aadeff', '#2bb1ff', '#15587f', '#0b2c40'], 'gold': ['#fff3dc', '#ffebc7', '#ffddab', '#b59d79', '#5C4938'], 'red': ['#ffd8e8', '#ff9db6', '#ff3e72', '#6B404C', '#521424'], 'gray': ['#eeeeee', '#bbbbbb', '#999999', '#666666', '#333333'], } import pathlib import matplot...
github_jupyter
## Data Visualization - Pie Chart: Compare Percentages - Bar Chart: Compare Scores across groups - Histogram: Show frequency of values/value range - Line Chart: Show trend of Scores - Scatter Plot: Show Relationship between a pair of Scores - Map: Show Geo Distribution of data |Type|Variable Y|Variable X| |:--:|:--:|...
github_jupyter
# Quantum Kernel Alignment with Qiskit Runtime <br> **Classification with Support Vector Machines**<br> Classification problems are widespread in machine learning applications. Examples include credit card risk, handwriting recognition, and medical diagnosis. One approach to tackling classification problems is the su...
github_jupyter
``` import networkx import collections %load_ext autoreload %autoreload 2 from pymedphys._experimental import tree, graphviz module_dependencies = tree.get_module_dependencies() internal_modules = set(module_dependencies.keys()) root = 'pymedphys' top_level_api = [item for item in module_dependencies[root] if not item...
github_jupyter
# Evaluation metrics for classification models ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import os pd.options.mode.chained_assignment = None %matplotlib inline ``` ### Back with the credit card default dataset ``` # Loading the dataset DATA_DIR = '../data' FILE...
github_jupyter
``` from __future__ import print_function from textwrap import dedent import pytablewriter table_name = "example_table" headers = ["int", "float", "str", "bool", "mix", "time"] data = [ [0, 0.1, "hoge", True, 0, "2017-01-01 03:04:05+0900"], [2, "-2.23", "foo", False, None, "2017-12-23 12...
github_jupyter
``` import pickle import numpy as np import seaborn as sns import matplotlib.pyplot as plt with open('cdrk_lastepisode_heat.pickle', 'rb') as f: last_heat = pickle.load(f) with open('cdrk_heat_unique0.pickle', 'rb') as f: heat_uniq0 = pickle.load(f) with open('cdrk_heat_freq0.pickle', 'rb') as f: heat_fr...
github_jupyter
# Deterministic Inputs, Noisy “And” gate model (DINA) This notebook will show you how to train and use the DINA. First, we will show how to get the data (here we use Math1 from math2015 as the dataset). Then we will show how to train a DINA and perform the parameters persistence. At last, we will show how to load the ...
github_jupyter
## Ejercicio 1 Dada la siguiente lista: > ```ejer_1 = [1,2,3,4,5]``` Inviertela par que quede de la siguiente manera > ```ejer_1 = [5,4,3,2,1]``` ## Ejercicio 2 Eleva todos los elementos de la lista al cuadrado > ```ejer_2 = [1,2,3,4,5]``` ## Ejercicio 3 Crea una lista nueva con todas las combinaciones de las siguie...
github_jupyter
# Building ERDDAP Datasets This notebook documents the process of creating XML fragments for nowcast system run results files for inclusion in `/results/erddap-datasets/datasets.xml` which is symlinked to `/opt/tomcat/content/erddap/datasets.xml` on the `skookum` ERDDAP server instance. The contents are a combination...
github_jupyter
<a href="https://colab.research.google.com/github/iotanalytics/IoTTutorial/blob/main/code/detection_and_segmentation/Anomaly_Detection_with_Autoencoder_.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # **Anomaly Detection with Autoencoder** Autoenc...
github_jupyter
# Robot Class In this project, we'll be localizing a robot in a 2D grid world. The basis for simultaneous localization and mapping (SLAM) is to gather information from a robot's sensors and motions over time, and then use information about measurements and motion to re-construct a map of the world. ### Uncertainty A...
github_jupyter
### Model features - augmentation (6 image generated) - 2 dropout layer - adam optimizer with learning rate decay ``` NAME = '2dropout-augmentation' LOAD = True import sys import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import cv2 import random from tqdm impor...
github_jupyter
# 09 - Decision Trees by [Alejandro Correa Bahnsen](albahnsen.com/) version 0.2, May 2016 ## Part of the class [Machine Learning for Risk Management](https://github.com/albahnsen/ML_RiskManagement) This notebook is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License](http://creativecommo...
github_jupyter
# Location Set Covering Problem (LSCP) *Authors:* [Germano Barcelos](https://github.com/gegen07), [James Gaboardi](https://github.com/jGaboardi), [Levi J. Wolf](https://github.com/ljwolf), [Qunshan Zhao](https://github.com/qszhao) Location Set Covering is a problem realized by Toregas, et al. (1971). He figured out t...
github_jupyter
``` !pip3 install tqdm from post_processing import * from const import ROOT from const import * ``` vert_path = os.path.join(".", 'vertical_hamming') vert_path1 = os.path.join(".", 'vertical_hamming_res') vert_file_list = glob.glob(os.path.join(vert_path, '*.png'))+ glob.glob(os.path.join(vert_path1, '*.png')) df = pd...
github_jupyter
# Character Sequence to Sequence In this notebook, we'll build a model that takes in a sequence of letters, and outputs a sorted version of that sequence. We'll do that using what we've learned so far about Sequence to Sequence models. This notebook was updated to work with TensorFlow 1.1 and builds on the work of Dav...
github_jupyter
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. # Create Image In this notebook, we show the following steps for deploying a web service using AzureML: - Create an image - Test image locally ``` import pandas as pd from utilities import text_to_json, get_auth from azureml.co...
github_jupyter
# Weight Initialization In this lesson, you'll learn how to find good initial weights for a neural network. Having good initial weights can place the neural network close to the optimal solution. This allows the neural network to come to the best solution quicker. ## Testing Weights ### Dataset To see how different w...
github_jupyter
``` #import urllib, urllib3 #from bs4 import BeautifulSoup #import requests #import time #import io #import numpy as np ##import nltk ##from nltk.corpus import wordnet as wn #import pandas as pd #from sklearn.feature_extraction.text import CountVectorizer #import gensim #from gensim.models.ldamodel import LdaModel ``` ...
github_jupyter
# Interpretable forecasting with N-Beats ``` import os import warnings warnings.filterwarnings("ignore") os.chdir("../../..") import pandas as pd import torch import pytorch_lightning as pl from pytorch_lightning.callbacks import EarlyStopping from pytorch_forecasting import TimeSeriesDataSet, NBeats, Baseline from...
github_jupyter
# Create a QComponent - Advanced ``` from qiskit_metal import draw, Dict from qiskit_metal.toolbox_metal import math_and_overrides from qiskit_metal.qlibrary.core import QComponent import qiskit_metal as metal design = metal.designs.DesignPlanar() ``` ## Qubits and Junctions The vast majority of junction management ...
github_jupyter