code
stringlengths
2.5k
150k
kind
stringclasses
1 value
``` from __future__ import division, print_function import os import sys from collections import OrderedDict # Third-party import astropy.coordinates as coord import astropy.units as u import matplotlib as mpl import matplotlib.pyplot as pl import numpy as np pl.style.use('apw-notebook') %matplotlib inline # Custom i...
github_jupyter
## Basic core This module contains all the basic functions we need in other modules of the fastai library (split with [`torch_core`](/torch_core.html#torch_core) that contains the ones requiring pytorch). Its documentation can easily be skipped at a first read, unless you want to know what a given function does. ``` ...
github_jupyter
# 3-tier Separates presentation, application processing, and data management functions. reference: https://shunnien.github.io/2017/07/29/3-tier-and-mvc-introduction/ ``` class Data(object): products = { 'milk': {'price': 1.5, 'quantity': 10}, 'eggs': {'price': 0.2, 'quantity': 100}, 'chee...
github_jupyter
<a href="https://colab.research.google.com/github/denikn/Machine-Learning-MIT-Assignment/blob/main/Week%2002%20-%20Perceptrons/Week02_Homework_02.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> #MIT 6.036 Spring 2019: Homework 2# This colab noteboo...
github_jupyter
``` # # this just to make sure we are using only on CPU # import os # os.environ["CUDA_VISIBLE_DEVICES"]="-1" %cd .. import time import os.path as op import numpy as np import torch from torch.optim import Adam from torch.nn import functional as F from torch.utils.data import DataLoader from torch.utils.tensorboard im...
github_jupyter
``` import pandas as pd import numpy as np import seaborn as sns import csv import matplotlib as mpl import matplotlib.pyplot as plt path_to_file = 'flight_delays.csv' df = pd.read_csv(path_to_file, sep=',') f = df[(df['dep_delayed_15min'] == 'N')] f ``` 1.Доля всех задержек ко всем вылетам ``` df.groupby('dep_delaye...
github_jupyter
# Logistic Regression with a Neural Network mindset Welcome to your first (required) programming assignment! You will build a logistic regression classifier to recognize cats. This assignment will step you through how to do this with a Neural Network mindset, and so will also hone your intuitions about deep learning....
github_jupyter
# Self-Driving Car Engineer Nanodegree ## Project: **Finding Lane Lines on the Road** *** In this project, you will use the tools you learned about in the lesson to identify lane lines on the road. You can develop your pipeline on a series of individual images, and later apply the result to a video stream (really j...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt ``` ## PIN computation To compute the PIN of a given day, we need to optimize the product of the likelihood computed on each time interval in the day. In particular we fix a time interval of 5 minutes to discretize time, and since we are deali...
github_jupyter
# Move Function Now that you know how a robot uses sensor measurements to update its idea of its own location, let's see how we can incorporate motion into this location. In this notebook, let's go over the steps a robot takes to help localize itself from an initial, uniform distribution to sensing, moving and updatin...
github_jupyter
``` import cartopy.crs as ccrs import xarray as xr import matplotlib.pyplot as plt import numpy as np from itertools import product import pandas as pd import os import time from datetime import timedelta import rasterio.warp as rasteriowarp SATELLITE_DATA_PATH = os.path.expanduser('~/data/EUMETSAT/reprojected_subsette...
github_jupyter
# Self-Driving Car Engineer Nanodegree ## Project: **Finding Lane Lines on the Road** *** In this project, you will use the tools you learned about in the lesson to identify lane lines on the road. You can develop your pipeline on a series of individual images, and later apply the result to a video stream (really j...
github_jupyter
# Stochastic Volatility model ## Imports & Settings ``` import warnings warnings.filterwarnings('ignore') %matplotlib inline from pathlib import Path import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib.ticker import FuncFormatter import seaborn as sns import pymc3 as pm from pym...
github_jupyter
# Fusing graphblas.matrix_multiply with graphblas.apply This example will go over how to use the `--graphblas-structuralize ` and `--graphblas-optimize` passes from `graphblas-opt` to fuse `graphblas.matrix_multiply` ops with `graphblas.apply` ops into `graphblas.matrix_multiply_generic` ops. Let's first import some ...
github_jupyter
<h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#Explainability-with-Amazon-SageMaker-Debugger" data-toc-modified-id="Explainability-with-Amazon-SageMaker-Debugger-1">Explainability with Amazon SageMaker Debugger</a></span><ul class="toc-item"><li><span><...
github_jupyter
# Programming in Python ## Session 1 ### Aim of the Session Learn/review the basics - what is ... - how to ... ### 'Hello World!' ``` # the culturally-expected introductory statement ``` ### Literals Values of a _type_, presented literally ``` # example name type designation 42 # integer...
github_jupyter
# Метод сопряжённых градиентов (Conjugate gradient method): гадкий утёнок ## На прошлом занятии... 1. Методы спуска 2. Направление убывания 3. Градиентный метод 4. Правила выбора шага 5. Теоремы сходимости 6. Эксперименты ## Система линейных уравнений vs. задача безусловной минимизации Рассмотрим задачу $$ \min_{x ...
github_jupyter
# Reading Data ## Connect to store (using sina local file) First let's create an empty database with you as a single user In a real application only admin user should have write permission to the file ``` import os import sys import shlex from subprocess import Popen, PIPE import kosh kosh_example_sql_file = "kosh...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.datasets import fetch_openml data = fetch_openml(data_id=1590, as_frame=True) X = pd.get_dummies(data.data) y_true = (data.target == '>50K') * 1 sex = data.data[['sex', 'race']] sex.value_counts() from fairlearn.metrics import group...
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
# **PARAMETER FITTING DETAILED EXAMPLE** This provides a detailed example of parameter fitting using the python-based tool ``SBstoat``. Details about the tool can be found at in this [github repository](https://github.com/sys-bio/SBstoat). # Preliminaries ``` IS_COLAB = True if IS_COLAB: !pip install -q SBstoat...
github_jupyter
## Version ``` System.out.println(System.getProperty("java.version")); ``` ## Identifiers 1. Available characters: lowercase letters (a to z), uppercase letters(A to Z), digits (0 to 9), underscore `_`, and dollar sign `$` 2. Cannot start with a digit 3. Case sensitive ## Keywords - abstract - continue - for - new...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt import pandas as pd import statsmodels as sm %matplotlib inline from sklearn.preprocessing import MinMaxScaler, StandardScaler, Normalizer, Binarizer ``` # Prepare data for Machine Learning ``` #Scripts for preprocessing data for machine learning #Borrowed genero...
github_jupyter
``` %matplotlib inline import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import os import pandas as pd import sklearn import sys import tensorflow as tf import time from tensorflow import keras print(tf.__version__) print(sys.version_info) for module in mpl, np, pd, sklearn, tf, keras: p...
github_jupyter
``` """ Script of petro-inversion of gravity over TKC Notes: This version of the script uses data with less noises but still invert with a higher assumed noise level. This is equivalent to increase the chi-factor. This has been needed in order to fit both geophysical and petrophysical data set. """ # Script of petro...
github_jupyter
``` import time import matplotlib.pyplot as plt import numpy as np from sklearn.datasets import fetch_openml #from sklearn.datasets import fetch_openml from sklearn.linear_model import LogisticRegression from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler from sklearn.u...
github_jupyter
``` from pathlib import Path import cv2 import matplotlib.pyplot as plt import random from skimage.filters import (threshold_otsu, threshold_niblack,threshold_sauvola) random.seed(10) #for debug import numpy as np #TODO introduce a variabl n to increase speed while debugging def get_raw_data(path): p = Path(pat...
github_jupyter
# ML Pipeline Preparation Follow the instructions below to help you create your ML pipeline. ### 1. Import libraries and load data from database. - Import Python libraries - Load dataset from database with [`read_sql_table`](https://pandas.pydata.org/pandas-docs/stable/generated/pandas.read_sql_table.html) - Define fea...
github_jupyter
<a href="https://colab.research.google.com/github/mrdbourke/tensorflow-deep-learning/blob/main/07_food_vision_milestone_project_1.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # 07. Milestone Project 1: 🍔👁 Food Vision Big™ In the previous noteb...
github_jupyter
# CPSC 330 hw7 ``` import numpy as np import pandas as pd ### BEGIN SOLUTION from sklearn.impute import SimpleImputer from sklearn.compose import ColumnTransformer from sklearn.pipeline import Pipeline from sklearn.preprocessing import StandardScaler, OrdinalEncoder, OneHotEncoder from sklearn.linear_model import Rid...
github_jupyter
``` import pandas as pd df = pd.read_csv('../data/data-binary.csv') df.dtypes from sklearn.linear_model import LogisticRegression def get_model(df, X_cols, y_col, solver='liblinear', penalty='l1', C=0.2): X = df[X_cols] y = df[y_col] model = LogisticRegression(penalty=penalty, solver=solver, C=C) ...
github_jupyter
# Candlestick Hanging Man https://www.investopedia.com/articles/active-trading/040914/understanding-hanging-man-optimistic-candlestick-pattern.asp ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import talib import warnings warnings.filterwarnings("ignore") # yahoo finance is used to fetc...
github_jupyter
# Train an MNIST model with TensorFlow MNIST is a widely-used dataset for handwritten digit classification. It consists of 70,000 labeled 28x28 pixel grayscale images of hand-written digits. The dataset is split into 60,000 training images and 10,000 test images. There are 10 classes (one for each of the 10 digits). T...
github_jupyter
# MASS Algorithm Tutorial This notebook is a tutorial on how to use STUMPY and the MASS algorithm [1] to compute a **distance profile**, a vector containing all of the distances from a query subsequence to the subsequences of a time series. In this tutorial we are going to reproduce one of the use case mentioned in t...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt from cemag import entropy, prior_params, find_error_probability, std_eff ``` # Loading expression Data The included dataset contains log2(TPM) normalized RNA-seq data for various tissues taken from adult zebrafish at different ages. For deta...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt from collections import Counter import datetime import matplotlib.pyplot as plt from IPython import display from scipy import stats import math import random from sklearn import preprocessing from sklearn.model_selection import ShuffleSplit, ...
github_jupyter
# Clonamos el repositorio para obtener los dataSet ``` !git clone https://github.com/joanby/ia-course.git ``` # Damos acceso a nuestro Drive ``` from google.colab import drive drive.mount('/content/drive') ``` # Test it ``` !ls '/content/drive/My Drive' ``` #Google colab tools ``` from google.colab import files ...
github_jupyter
<a href="https://colab.research.google.com/github/revendrat/FinancialMathematics/blob/main/Py_Finance_01.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` #install yahoo finance %pip install yfinance # import packages & modules import pandas as pd...
github_jupyter
## Objectives - Identify noun phrase chunks using POS tags - Extract information from noun phrases in the Penn Treebank ## Dowloading Lexicons ``` import nltk nltk.download("punkt") nltk.download("treebank") nltk.download("averaged_perceptron_tagger") nltk.download("wordnet") ``` Code to access relevant modules (yo...
github_jupyter
# Importing Required Libraries ``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns from sklearn.model_selection import train_test_split from sklearn import metrics %matplotlib inline sns.set_style("darkgrid") sns.set(style="ticks", color_codes=True) data = pd.read_csv("inp...
github_jupyter
``` import pandas as pd import mysql.connector from IPython.display import display, Markdown db = mysql.connector.connect( host="localhost", user="root", password="secret", port="3306", database="serlo" ) def read_event_log(): df = pd.read_sql(""" select event_log.id, event_log.date,...
github_jupyter
# Inferential Statistics III - Bayesian ## Introduction In the last two subunits, you've encountered two schools for performing inference from samples. The Frequentist school calls upon a body of theory established over the past couple of centuries or so. Under certain assumptions and conditions, this allows us to ca...
github_jupyter
``` %matplotlib inline from matplotlib import style style.use('fivethirtyeight') import matplotlib.pyplot as plt import matplotlib.dates as mdates from flask import Flask, jsonify import numpy as np import pandas as pd import datetime as dt from scipy import stats ``` # Reflect Tables into SQLAlchemy ORM ``` # Python...
github_jupyter
# Gated PixelCNN receptive fields Hi everybody! In this notebook, we will analyse the Gated PixelCNN's block receptive field. Diferent of the original PixelCNN, we expect that the blocks of the Gated PixelCNN do not create blind spots that limit the information flow of the previous pixel in order to model the density ...
github_jupyter
``` %matplotlib notebook import sys from pathlib import Path SRC_ROOT_DIR_0 = '/g/wsl_projs/practical-astronomy' SRC_ROOT_DIR_1 = '/g/wsl_projs/practical-astronomy/myastro/' sys.path.insert(0, SRC_ROOT_DIR_0) sys.path.insert(1, SRC_ROOT_DIR_1) %load_ext autoreload %autoreload 2 import numpy as np import matplotlib.py...
github_jupyter
<img src='https://certificate.tpq.io/quantsdev_banner_color.png' width="250px" align="right"> # Reinforcement Learning &copy; Dr Yves J Hilpisch | The Python Quants GmbH [quants@dev Discord Server](https://discord.gg/uJPtp9Awaj) | [@quants_dev](https://twitter.com/quants_dev) | <a href="mailto:qd@tpq.io">qd@tpq.io</...
github_jupyter
[View in Colaboratory](https://colab.research.google.com/github/SakshiPriya/inverted-visualization/blob/master/m&v_inverted_visualization_.ipynb) ``` !apt-get install -y -qq software-properties-common python-software-properties module-init-tools !add-apt-repository -y ppa:alessandro-strada/ppa 2>&1 > /dev/null !apt...
github_jupyter
<a href="https://colab.research.google.com/github/NeuromatchAcademy/course-content-dl/blob/main/tutorials/W1D1_BasicsAndPytorch/W1D1_Tutorial1.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Tutorial 1: PyTorch **Week 1, Day 1: Basics and PyTorch*...
github_jupyter
# Logistic Regression ## Resources: [Logistic Regression Tutorial for Machine Learning](http://machinelearningmastery.com/logistic-regression-tutorial-for-machine-learning/) [Logistic Regression for Machine Learning](http://machinelearningmastery.com/logistic-regression-for-machine-learning/) [How To Implement Logi...
github_jupyter
``` import pandas as pd import matplotlib.pyplot as plt import seaborn as sns movies = pd.read_csv("ml-latest-small/movies.csv") movies_rating = pd.read_csv("ml-latest-small/ratings.csv") sum_movies_genres = movies["genres"].str.get_dummies('|').sum() movies_by_genre = sum_movies_genres.sort_values(ascending=False) mo...
github_jupyter
# The importance of constraints Constraints determine which potential adversarial examples are valid inputs to the model. When determining the efficacy of an attack, constraints are everything. After all, an attack that looks very powerful may just be generating nonsense. Or, perhaps more nefariously, an attack may ge...
github_jupyter
``` import os import glob import pandas as pd import numpy as np from tqdm import tqdm import pickle from copy import copy sources_with_data_text = os.path.join('data', 'sources_with_data.txt') with open (sources_with_data_text, mode='r') as f: lines = f.readlines() #check we closed the file assert f.closed ...
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> # `GiRaFFE_NRPy`: Main Driver ## Author: Patrick Nelson <...
github_jupyter
## 1. Introduction Notebook for generating lyrics using LSTM network. The dataset contains all the songs recorded by Bob Dylan. Stages: 1. EDA - Summary statistics on dataset: distribution of no. of characters, words, sentences in collection - Histograms & wordclouds 2. Preprocessing - Create corpus of all...
github_jupyter
``` import os import pickle import numpy as np import pandas as pd import matplotlib.pyplot as plt from scipy import stats import scipy.signal as scisig import scipy.stats import cvxEDA # dir(cvxEDA) fs_dict = {'ACC': 32, 'BVP': 64, 'EDA': 4, 'TEMP': 4, 'label': 700, 'Resp': 700, 'ECG':700} WINDOW_IN_SECONDS = 1 label...
github_jupyter
``` import numpy as np import zarr import pandas as pd import dask.array as da import allel import matplotlib.pyplot as plt %matplotlib inline ``` ## Cluster setup ``` from dask_kubernetes import KubeCluster #cluster = KubeCluster(n_workers=30) #cluster cluster= KubeCluster() cluster.scale_up(6) cluster.adapt(minimu...
github_jupyter
``` # Visualization of the KO Gold Standard from: # Miraldi et al. (2018) "Leveraging chromatin accessibility data for transcriptional regulatory network inference in Th17 Cells" # TO START: In the menu above, choose "Cell" --> "Run All", and network + heatmap will load # NOTE: Default limits networks to TF-TF edges i...
github_jupyter
# Model development using MIMIC-IV EMR data only (Strategies 0-3) 1. Summary statistics 2. Feature selection (to add) 3. Model development 4. Hyperparameter tuning (to add) 5. Evaluation of the final model and error analysis (to add) <img src="../results/class distribution.jpeg" alt="Groups" style="width: 400px;"/> ...
github_jupyter
``` # import dependencies %matplotlib inline from matplotlib import style style.use('fivethirtyeight') import matplotlib.pyplot as plt import numpy as np import pandas as pd import datetime as dt ``` # Reflect Tables into SQLAlchemy ORM ``` # Python SQL toolkit and Object Relational Mapper import sqlalchemy from sqla...
github_jupyter
# MCIS6273 Data Mining (Prof. Maull) / Fall 2021 / HW0 **This assignment is worth up to 20 POINTS to your grade total if you complete it on time.** | Points <br/>Possible | Due Date | Time Commitment <br/>(estimated) | |:---------------:|:--------:|:---------------:| | 20 | Wednesday, Sep 1 @ Midnight | _up to_ 20 ho...
github_jupyter
# SMIB system as in Milano's book example 8.1 ``` %matplotlib widget import numpy as np import matplotlib.pyplot as plt import scipy.optimize as sopt import ipywidgets from pydae import ssa import json ``` ## Import system module ``` from smib_milano_ex8p1_4ord_avr import smib_milano_ex8p1_4ord_avr_class ``` ## Ins...
github_jupyter
# Simrandeep Brar ## Research question/interests My research question is to determine what show type (movie/tv show & pg/pg-13/mature) are the most popular. I'm researching this question because I wanna see what kind of content people seem to enjoy the most on Netflix. I'll be using multiple supplemental graphs to sup...
github_jupyter
# Week 2 - Data handling The Python modules `pandas` and `numpy` are useful libraries to handle datasets and apply basic operations on them. Some of the things we learnt in week 1 using native Python (e.g. accessing, working with and writing data files, and performing operations on them) can be easily achieved using...
github_jupyter
``` import numpy as np import pandas as pd import os import matplotlib.pyplot as plt from fastai.vision import * import torch #from mrnet_orig import * from mrnet_itemlist import * #from ipywidgets import interact, Dropdown, IntSlider %matplotlib notebook plt.style.use('grayscale') # run tree on my data to see its ...
github_jupyter
``` %matplotlib inline from matplotlib import style style.use('fivethirtyeight') import matplotlib.pyplot as plt import numpy as np import pandas as pd import datetime as dt ``` # Reflect Tables into SQLAlchemy ORM ``` # Python SQL toolkit and Object Relational Mapper import sqlalchemy from sqlalchemy.ext.automap imp...
github_jupyter
Sascha Spors, Professorship Signal Theory and Digital Signal Processing, Institute of Communications Engineering (INT), Faculty of Computer Science and Electrical Engineering (IEF), University of Rostock, Germany # Tutorial Digital Signal Processing **Correlation**, Winter Semester 2021/22 (Course #24505) - lecture:...
github_jupyter
Template untuk mengupdate database bangwas di sinkronkan dengan data aset milik pt kai - load data yang akan di sinkronkan di line 1 (dataset dr bangwas.web.id belum ada perubahan, jenis dan pemilik masih berupa kode) - load data yg jd bencmarking yg sudah diolah dari data aset milik pt kai (relate to data_aset_kai.ip...
github_jupyter
<a href="https://colab.research.google.com/github/Pdugovich/DS-Unit-1-Sprint-3-Statistical-Tests-and-Experiments/blob/master/module2-sampling-confidence-intervals-and-hypothesis-testing/LS_DS_132_Sampling_Confidence_Intervals_and_Hypothesis_Testing_Assignment.ipynb" target="_parent"><img src="https://colab.research.goo...
github_jupyter
# Let's kill off `Runner` ``` %load_ext autoreload %autoreload 2 %matplotlib inline #export from exp.nb_09 import * AvgStats ``` ## Imagenette data [Jump_to lesson 11 video](https://course.fast.ai/videos/?lesson=11&t=6571) ``` path = datasets.untar_data(datasets.URLs.IMAGENETTE_160) tfms = [make_rgb, ResizeFixed(1...
github_jupyter
![Callysto.ca Banner](https://github.com/callysto/curriculum-notebooks/blob/master/callysto-notebook-banner-top.jpg?raw=true) <h2 align='center'>Data Literacy through Sports Analytics</h2> <h3 align='center'>Southern Alberta Teachers' Convention 2021</h3> <h3 align='center'>Tina Leard (Cybera)<br> Michael Lamoureux ...
github_jupyter
``` #import libraries import numpy.ma as MA import datetime as dt from datetime import datetime, timedelta import xarray as xr import numpy as np import pandas as pd import os from netCDF4 import Dataset # http://code.google.com/p/netcdf4-python/ #subroutine to check for bad values def checkValue(value): # Check...
github_jupyter
**Introduction** In this post, you will discover the Keras Python library that provides a clean and convenient way to create a range of deep learning models on top of Theano or TensorFlow. All creidts to -- "http://machinelearningmastery.com/tutorial-first-neural-network-python-keras/" Let’s get started. **Dependenc...
github_jupyter
# Prepare Superresolution Training Data with eo-learn There are many examples and resources for training superresolution networks on (satellite) imagery: - [MDL4EO](https://mdl4eo.irstea.fr/2019/03/29/enhancement-of-sentinel-2-images-at-1-5m/) - [ElementAI HighRes-Net](https://github.com/ElementAI/HighRes-net) - [Fast...
github_jupyter
``` import cv2 import keras from keras import backend as K from tensorflow.python.keras.applications import imagenet_utils from keras.models import Model from keras.preprocessing import image import matplotlib.pyplot as plt import numpy as np #from scipy.misc import imread from imageio import imread import tensorflow a...
github_jupyter
**Chapter 6 – Decision Trees** _This notebook contains all the sample code and solutions to the exercises in chapter 6._ <table align="left"> <td> <a target="_blank" href="https://colab.research.google.com/github/ageron/handson-ml/blob/master/06_decision_trees.ipynb"><img src="https://www.tensorflow.org/images/...
github_jupyter
# Train DynUNet on Decathlon datasets This tutorial shows how to train 3D segmentation tasks on all the 10 decathlon datasets with `DynUNet`. Refer to papers: `Automated Design of Deep Learning Methods for Biomedical Image Segmentation <https://arxiv.org/abs/1904.08128>` `nnU-Net: Self-adapting Framework for U-Net-B...
github_jupyter
## Recommendations with MovieTweetings: Collaborative Filtering One of the most popular methods for making recommendations is **collaborative filtering**. In collaborative filtering, you are using the collaboration of user-item recommendations to assist in making new recommendations. There are two main methods of ...
github_jupyter
# L5 Closed-loop Gym-compatible Environment This notebook demonstrates some of the aspects of our gym-compatible closed-loop environment. You will understand the inner workings of our L5Kit environment and an RL policy can be used to rollout the environment. Note: The training of different RL policies in our enviro...
github_jupyter
##### Function "print" for prints the specified message to the screen, or other standard output device ``` print(5+5) print("Hello World") print(TRUE) ---------------------- ``` ##### R is case sensitive ``` print("Me") #Not same with print("ME") print("01") #Not same with print("1") ---------------------- ``` ###...
github_jupyter
## Instructions to reproduce the WaMDaM / WEAP paper use case results ### Open Source Python Software To Manage, Populate, Compare, And Analyze Weap Models And Scenarios #### By Adel M. Abdallah, Feb 2022 ### Abstract The Water Evaluation and Planning system (WEAP) is a proprietary systems simulation software th...
github_jupyter
##### Copyright 2019 The TensorFlow Authors. Licensed under the Apache License, Version 2.0 (the "License"); ``` #@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.o...
github_jupyter
# Managing Throwing and Catching and Exceptions In this workbook, we're going to work with a sample that describes a cashier's till at a store. We'll look at what happens when the cashier makes change for orders, the exceptions thrown and the danger they create. First, let's describe the `Till` class ``` public cla...
github_jupyter
# Consume deployed webservice via REST Demonstrates the usage of a deployed model via plain REST. REST is language-agnostic, so you should be able to query from any REST-capable programming language. ## Configuration ``` from environs import Env env = Env(expand_vars=True) env.read_env("foundation.env") env.read_...
github_jupyter
# Advanced Certification in AIML ## A Program by IIIT-H and TalentSprint ## Not for grades ## Learning Objective The objective of this experiment is to understand Decision Tree classifier. ## Dataset #### History This is a multivariate dataset introduced by R.A.Fisher (Father of Modern Statistics) for showcasing l...
github_jupyter
# Calculate China-Z Index (CZI) with Python China Z-Index (CZI) is extensively used by National Climate Centre (NCC) of China to monitor drought conditions throughout the country (Wu et al., 2001; Dogan et al., 2012). CZI assumes that precipitation data follow the Pearson Type III distribution and is related to Wilson...
github_jupyter
``` import os import sys sys.path.append(f'{os.environ["HOME"]}/Projects/planckClusters/catalogs') from load_catalogs import load_PSZcatalog from tqdm import tqdm_notebook data = load_PSZcatalog() PS1_dir = f'{os.environ["HOME"]}/Projects/planckClusters/data/extern/PS1' SDSS_dir = f'{os.environ["HOME"]}/Projects/planc...
github_jupyter
# Keras mnist LeNet-5 v2 **此项目为测试修改版的LeNet-5** - 目前达到$0.9929$的准确率 ``` %matplotlib inline import os import PIL import pickle import numpy as np import pandas as pd import matplotlib.pyplot as plt import tensorflow as tf import keras from IPython import display from functools import partial from sklearn.preprocessing ...
github_jupyter
``` class Chain: def __init__(self, cid): self.cid = cid self.res = [] return def addres(self, res): self.res.append(res) return def printchain(self): print("chain: %s" % str(self.cid)) # for res in self.res: # res.printme() clas...
github_jupyter
<a href="https://colab.research.google.com/github/krmiddlebrook/intro_to_deep_learning/blob/master/machine_learning/lesson%203%20-%20Neural%20Networks/intro-to-neural-networks.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Intro to Neural Network...
github_jupyter
``` #Packages import pandas as pd import numpy as np import os import pickle import random from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer from sklearn.linear_model import LogisticRegression from sklearn.ensemble import RandomForestClassifier from sklearn.tree import DecisionTreeClassifier ...
github_jupyter
# Building your Deep Neural Network: Step by Step Welcome to your week 4 assignment (part 1 of 2)! You have previously trained a 2-layer Neural Network (with a single hidden layer). This week, you will build a deep neural network, with as many layers as you want! - In this notebook, you will implement all the functio...
github_jupyter
# Saving and Loading Models In this notebook, I'll show you how to save and load models with PyTorch. This is important because you'll often want to load previously trained models to use in making predictions or to continue training on new data. ``` %matplotlib inline %config InlineBackend.figure_format = 'retina' i...
github_jupyter
**Copyright 2020 The TF-Agents 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 agr...
github_jupyter
<img align="center" style="max-width: 1000px" src="banner.png"> <img align="right" style="max-width: 200px; height: auto" src="hsg_logo.png"> ## Lab 02 - "Artificial Neural Networks" Machine Learning, University of St. Gallen, Spring Term 2022 The lab environment of the "Coding and Artificial Intelligence" IEMBA c...
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
# LeNet Lab Solution ![LeNet Architecture](lenet.png) Source: Yan LeCun ## Load Data Load the MNIST data, which comes pre-loaded with TensorFlow. You do not need to modify this section. ``` from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("MNIST_data/", reshape=False) X_...
github_jupyter
# SVR with Scale & Quantile Transformer This Code template is for regression analysis using the SVR Regressor where rescaling method used is Scale and feature transformation is done via Quantile Transformer. ### Required Packages ``` import warnings import numpy as np import pandas as pd import matplotlib.pyplot a...
github_jupyter
``` %matplotlib inline from matplotlib import style style.use('fivethirtyeight') import matplotlib.pyplot as plt from datetime import datetime import numpy as np import pandas as pd import datetime as dt ``` # Reflect Tables into SQLAlchemy ORM ``` # Python SQL toolkit and Object Relational Mapper import sqlalchemy f...
github_jupyter
``` import sys sys.path.append("/Users/msachde1/Downloads/Research/Development/mgwr/") import warnings warnings.filterwarnings("ignore") from mgwr.gwr import GWR import pandas as pd import numpy as np from spglm.family import Gaussian, Binomial, Poisson from mgwr.gwr import MGWR from mgwr.sel_bw import Sel_BW import mu...
github_jupyter
# Hidden Markov Models ### Problem Statement The following problem is from the Udacity course on Artificial Intelligence (Thrun and Norvig), chapter 11 (HMMs and filters). It involves a simple scenario where a person's current emotional state is determined by the weather on that particular day. The task is to find th...
github_jupyter