text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
# SAS ODA and Python Integration to Analyze COVID-19 Data The purpose of this notebook is to illustrate how Python code can be integrated with calls to SAS ODA in order to solve a particular problem of interest. In the course of this document, we will load the NYT COVID-19 data set. As the NYT data set contains raw cu...
github_jupyter
# ML for Trading: How to run an ML algorithm on Quantopian The code in this notebook is written for the Quantopian Research Platform and uses the 'Algorithms' rather than the 'Research' option we used before. To run it, you need to have a free Quantopian account, create a new algorithm and copy the content to the onl...
github_jupyter
# STUMPY Basics [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/TDAmeritrade/stumpy/main?filepath=notebooks/Tutorial_STUMPY_Basics.ipynb) ## Analyzing Motifs and Anomalies with STUMP This tutorial utilizes the main takeaways from the research papers: [Matrix Profile I](http://www.cs.ucr.e...
github_jupyter
# Autoencoders [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/m12sl/dl-hse-2021/blob/master/12-xae/seminar.ipynb) Пора заняться автоэнкодерами. <img src="https://github.com/m12sl/dl-hse-2021/raw/master/12-xae/img/encoder.png" crossorigin="anonymo...
github_jupyter
# Generating Features from GeoTiff Files From GeoTiff Files available for India over a period of more than 20 years, we want to generate features from those files for the problem of prediction of district wise crop yield in India. Due to gdal package, had to make a separate environment using conda. So install packages...
github_jupyter
``` {-# LANGUAGE InstanceSigs #-} import Control.Applicative (Alternative(..)) import Data.Char newtype Parser s r = Parser { unParser :: [s] -> ParseResult s r } type ParseResult s r = [([s], r)] symbol :: Eq s => s -> Parser s s symbol sym = Parser p where p (s:ss) | s == sym = [(ss, sym)] p _ ...
github_jupyter
#Traditional Value Factor Algorithm By Gil Wassermann Strategy taken from "130/30: The New Long-Only" by Andrew Lo and Pankaj Patel Part of the Quantopian Lecture Series: * www.quantopian.com/lectures * github.com/quantopian/research_public Notebook released under the Creative Commons Attribution 4.0 License. Pleas...
github_jupyter
# 1. File I/O Settings ``` hindcast_data_file = 'test_data/NMME_data_BD.csv' #data used for cross-validated hindcast skill analysis, and to train forecast model hindcast_has_years = True hindcast_has_header = False hindcast_has_obs = True #NOTE: This is mandatory hindcast_export_file = 'bd.csv' #'None' or the name of...
github_jupyter
``` import os.path import re import sys import numpy as np import json import time from six.moves import urllib import matplotlib as mpl from pprint import pprint import pandas as pd %matplotlib inline %load_ext autoreload %autoreload 2 ``` ## Preprocessing - BM Caption dataset - Remove duplication by image url - D...
github_jupyter
# Marching Wagon of useful Modules #### Changing you life one package at a time.... ``` ``` ### Retrying your functions ``` # retrying # https://pypi.python.org/pypi/retrying import time import random from retrying import retry @retry(stop_max_delay=1000) def do_something_unreliable(): if random.randint(0, 1...
github_jupyter
``` !conda upgrade scikit-learn -y from azureml import services from azureml import Workspace from azure.servicebus import ServiceBusService import warnings; warnings.filterwarnings('ignore') import datetime from dateutil import parser import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklea...
github_jupyter
<table class="ee-notebook-buttons" align="left"> <td><a target="_blank" href="https://github.com/giswqs/earthengine-py-notebooks/tree/master/GetStarted/04_band_math.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td> <td><a target="_blank" href...
github_jupyter
``` import numpy as np import pandas as pd from sklearn.base import BaseEstimator, TransformerMixin from sklearn.preprocessing import StandardScaler class MyTransformer(BaseEstimator, TransformerMixin): def __init__(self): self._mean_X = None self._std_X = None def fit(self, X: np.array, y...
github_jupyter
# Introduction One of the most basic questions we might ask of a model is: What features have the biggest impact on predictions? This concept is called **feature importance**. There are multiple ways to measure feature importance. Some approaches answer subtly different versions of the question above. Other appro...
github_jupyter
``` """ Load some libs """ """ python 2 lib using networkx """ import matplotlib.pyplot as plt import networkx as nx import random import math import pandas as pd import statsmodels.api as sm import glob import os import numpy as np from PIL import Image from helpers import * import pickle import time #random.seed(100)...
github_jupyter
# Compare Models This notebook compares various GFW models based on the `measure_speed` and `measure_course` with each other and with the models from Dalhousie University. Note that the distance-to-shore cutoff was disabled in the Dalhousie models, so none of the models compared here are using distance-to-shore as a ...
github_jupyter
# Elementary greenhouse models ____________ <a id='section1'></a> ## 1. A single layer atmosphere ____________ We will make our first attempt at quantifying the greenhouse effect in the simplest possible greenhouse model: a single layer of atmosphere that is able to absorb and emit longwave radiation. <img src="../...
github_jupyter
<a href="https://colab.research.google.com/github/hendradarwin/covid-19-prediction/blob/master/series-dnn_and_rnn/Forecast_2_dnn.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ## Pediction New Death Cases Global Covid-19 Cases ## Load Data and Imp...
github_jupyter
# Optimising Returns in Portfolio Management ### Exploring Numerical Optimisation Techniques to solve Quadratic Problems in Python ##### Zac Keskin - Numerical Optimisation - UCL 2018 ## Part 0: Define functions, Import Data ### Pre-import required packages ``` import numpy as np import pandas as pd import m...
github_jupyter
### Test web application locally This notebook pulls some images and tests them against the local web app running inside the Docker container we made previously. ``` import matplotlib.pyplot as plt import numpy as np from testing_utilities import * import requests %matplotlib inline %load_ext autoreload %autoreload 2 ...
github_jupyter
# Session 3: Data Structuring 2 *Nicklas Johansen* ## Agenda In this session, we will work with different types of data: - Boolean Data - Numeric Operations and Methods - String Operations - Categorical Data - Time Series Data ### Recap - Loading Packages - Pandas Series - Pandas Data Frames - Series vs DataFram...
github_jupyter
``` from __future__ import print_function from parser import * from keras.models import Sequential from keras.layers import Dense, Activation, Dropout ,LSTM from keras.optimizers import RMSprop import numpy as np import random text = parse_folder('TheVGLC-master/Super Mario Bros/Processed/') print('corpus length:', le...
github_jupyter
## Dependencies ``` from tweet_utility_scripts import * from transformers import TFDistilBertModel, DistilBertConfig from tokenizers import BertWordPieceTokenizer from tensorflow.keras.models import Model from tensorflow.keras import optimizers, metrics, losses from tensorflow.keras.callbacks import EarlyStopping, Ten...
github_jupyter
# Using Interact The `interact` function (`ipywidgets.interact`) automatically creates user interface (UI) controls for exploring code and data interactively. It is the easiest way to get started using IPython's widgets. ``` from __future__ import print_function from ipywidgets import interact, interactive, fixed, in...
github_jupyter
<a href="https://qworld.net" target="_blank" align="left"><img src="../qworld/images/header.jpg" align="left"></a> $$ \newcommand{\set}[1]{\left\{#1\right\}} \newcommand{\abs}[1]{\left\lvert#1\right\rvert} \newcommand{\norm}[1]{\left\lVert#1\right\rVert} \newcommand{\inner}[2]{\left\langle#1,#2\right\rangle} \newcomma...
github_jupyter
<a href="https://githubtocolab.com/giswqs/geemap/blob/master/examples/notebooks/49_colorbar.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open in Colab"/></a> Uncomment the following line to install [geemap](https://geemap.org) if needed. ``` # !pip install geemap ``...
github_jupyter
<a href="https://colab.research.google.com/github/Sujangyawali/Fraud_Detection/blob/master/pyspark_for_classification.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` ! pip install pyspark ! pip install -q kaggle ! mkdir ~/.kaggle ! cp kaggle.jso...
github_jupyter
``` from pyspark.sql import SparkSession from pyspark.ml import Pipeline from pyspark.sql.functions import mean,col,split, col, regexp_extract, when, lit from pyspark.ml.feature import StringIndexer from pyspark.ml.feature import VectorAssembler from pyspark.ml.evaluation import MulticlassClassificationEvaluator from p...
github_jupyter
# Tutorial Part 17: Training a Generative Adversarial Network on MNIST In this tutorial, we will train a Generative Adversarial Network (GAN) on the MNIST dataset. This is a large collection of 28x28 pixel images of handwritten digits. We will try to train a network to produce new images of handwritten digits. ##...
github_jupyter
``` #export from fastai2.basics import * from nbdev.showdoc import * #default_exp callback.schedule ``` # Hyperparam schedule > Callback and helper functions to schedule any hyper-parameter ``` from fastai2.test_utils import * ``` ## Annealing ``` #export class _Annealer: def __init__(self, f, start, end): sto...
github_jupyter
# Healthcare insurance fraud identification using PCA anomaly detection 1. [Background](#background) 1. [Setup](#setup) 1. [Data](#data) 1. [Obtain data](#datasetfiles) 1. [Feature Engineering](#feateng) 1. [Missing values](#missing) 1. [Categorical features](#catfeat) 1. [Gender](#gender) ...
github_jupyter
<small><small><i> All the IPython Notebooks in **Python Introduction** lecture series by Dr. Milaan Parmar are available @ **[GitHub](https://github.com/milaan9/01_Python_Introduction)** </i></small></small> # Python Programming Python is a powerful multipurpose programming language created by *Guido van Rossum*. It...
github_jupyter
A very wide range of physical processes lead to wave motion, where signals are propagated through a medium in space and time, normally with little or no permanent movement of the medium itself. The shape of the signals may undergo changes as they travel through matter, but usually not so much that the signals cannot be...
github_jupyter
# Non-linear dependencies amongst the SDGs and climate change by distance correlation We start with investigating dependencies amongst the SDGs on different levels. The method how we investigate these dependencies should take as few assumptions as possible. So, a Pearson linear correlation coefficient or a rank correl...
github_jupyter
# 7 - Functions ``` from scipy import * from matplotlib.pyplot import * %matplotlib inline ``` ## Basics ``` def subtract(x1, x2): return x1 - x2 r = subtract(5.0, 4.3) r ``` ## Parameters and Arguments ``` z = 3 e = subtract(5,z) e z = 3 e = subtract(x2 = z, x1 = 5) e ``` ### Changing Arguments ``` def subt...
github_jupyter
# Introduction to Random Forests ## Resources This notebook is designed around the theory from the fast.ai lectures (course18) with added comments and details found in the lectures and online. The entire course can be found here: http://course18.fast.ai/ml.html. ### Links - Lecture notebook: https://github.com/fasta...
github_jupyter
# Homework 1: Preprocessing and Text Classification Student Name: Jun Luo Student ID: 792597 Python version used: Python2.7 ## General info <b>Due date</b>: 11pm, Sunday March 18th <b>Submission method</b>: see LMS <b>Submission materials</b>: completed copy of this iPython notebook <b>Late submissions</b>: -20...
github_jupyter
# Overview - nb015を改良 - nb020のfoldを使う - top8は均等に振り分ける ``` # gitのhash import subprocess cmd = "git rev-parse --short HEAD" hash = subprocess.check_output(cmd.split()).strip().decode('utf-8') print(hash) ``` # Const ``` # basic NB = '021' DEBUG = False isPI = False isShowLog = True PATH_TRAIN = '../data_ignore/input...
github_jupyter
``` import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("MNIST_data/", one_hot=True) weights = [] for alpha in [.5]: x = tf.placeholder(tf.float32, [None, 784]) W = tf.Variable(tf.zeros([784, 10])) b = tf.Variable(tf.zeros([10])) y = tf...
github_jupyter
PPO Using VAE # VAE classes https://github.com/AntixK/PyTorch-VAE/blob/master/models/vanilla_vae.py ``` import torch from torch import nn from torch.nn import functional as F import torch.optim as optim class VAE(nn.Module): # Use Linear instead of convs def __init__(self, in_channels: int, ...
github_jupyter
# Split Dataframe using Panda's Groupby For this tutorial, I will asume you have a basic understanding of Python, and know how to load a dataframe using the Panda's library. I will use the GL_Detail example file from the AICPA's AuditDataAnalytic's GitHub. ``` import pandas as pd import numpy as np # Displays number...
github_jupyter
# Model selection using hyperopt ``` %matplotlib inline import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap from sklearn.datasets import make_moons from sklearn.metrics import accuracy_score from sklearn.svm import SVC from sklearn.neighbors import KNeighborsClassifier f...
github_jupyter
## Importing libraries ``` import warnings warnings.filterwarnings("ignore") # data manipulation and numeric operations import pandas as pd import numpy as np # save and load serialized objects import pickle # track progress of function execution from tqdm import tqdm import os # metrics from sklearn.metrics impor...
github_jupyter
``` import json from pathlib import Path import matplotlib.pyplot as plt import numpy as np import matplotlib import pandas as pd import pyprojroot import seaborn as sns def convert_seg_error_rate_pct(df): df.avg_segment_error_rate = df.avg_segment_error_rate * 100 return df RESULTS_ROOT = pyprojroot.here() / ...
github_jupyter
# Train VAE for task2... Then what if reconstruction is lower weighted? Loss function is weighted as: $loss = 0.01 L_{Reconstruction} + L_{KLD}$ ``` # public modules from dlcliche.notebook import * from dlcliche.utils import ( sys, random, Path, np, plt, EasyDict, ensure_folder, deterministic_everything, ) f...
github_jupyter
``` # from google.colab import drive # drive.mount('/content/drive') import torch.nn as nn import torch.nn.functional as F import pandas as pd import numpy as np import matplotlib.pyplot as plt import torch import torchvision import torchvision.transforms as transforms from torch.utils.data import Dataset, DataLoader...
github_jupyter
# Explaining Answer Set Solving This is a short guide that shows how Answer Set Programming works. We will use [clingo](https://potassco.org/clingo/) in Python for this, and throughout this document we will use the syntax that clingo uses for answer set programming. <!-- [guide](https://github.com/potassco/guide/rele...
github_jupyter
``` bonus_root = '/network/group/aopp/predict/TIP016_PAXTON_RPSPEEDY/ML4L/ECMWF_files/raw/BonusClimate/' #Wetlands wetlands = ['COPERNICUS', 'CAMA','ORCHIDEE','monthlyWetlandAndSeasonalWater_minusRiceAllCorrected_waterConsistent'] lakes = ['CL_ECMWFAndJRChistory','yearlyCL'] import glob import pandas as pd import xarr...
github_jupyter
<a href="https://colab.research.google.com/github/NeuromatchAcademy/course-content/blob/master/tutorials/W1D1_ModelTypes/student/W1D1_Tutorial2.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Neuromatch Academy: Week 1, Day 1, Tutorial 2 # Model ...
github_jupyter
## Introduction to matplotlib `matplotlib` is the Python plotting package to rule them all. Not because it's the best. Or the easiest to use. Or the fastest. Or... wait, why is it the number 1 plotting package? Nobody knows! But it's everywhere, and making basic plots is... fine. It's really fine. ``` import numpy as...
github_jupyter
``` import pandas as pd from google.colab import drive drive.mount('/content/gdrive', force_remount=True) import pandas as pd import numpy as np import pickle from sklearn.metrics import f1_score, precision_score, recall_score, accuracy_score testData = pd.read_csv('/content/gdrive/MyDrive/ML_Project/Dataset/pre_stand...
github_jupyter
# Introduction to Deep Learning with PyTorch In this notebook, you'll get introduced to [PyTorch](http://pytorch.org/), a framework for building and training neural networks. PyTorch in a lot of ways behaves like the arrays you love from Numpy. These Numpy arrays, after all, are just tensors. PyTorch takes these tenso...
github_jupyter
<a href="https://colab.research.google.com/gist/HerkTG/5f255e18611170ac204fcedb3f9d81e2/algoloader_v1-1.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` #User definied parameters host = "https://covidv3.i.tgcloud.io" #@param {type:"string"} graph...
github_jupyter
``` from __future__ import print_function, division from keras.datasets import mnist from keras.layers import Input, Dense, Reshape, Flatten, Dropout from keras.layers import BatchNormalization, Activation, ZeroPadding2D from keras.layers.advanced_activations import LeakyReLU from keras.layers.convolutional import UpS...
github_jupyter
# Capital Allocation Problem ## Author: Snigdhayan Mahanta In a large corporation the `capital allocation problem` is one of the biggest challenges for the corporate decision-makers. A `corporation` consists of several `business units`. From a high level perspective a corporation can choose to deploy its financial res...
github_jupyter
``` import sys import numpy as np import scipy as sp import pandas as pd from scipy import ndimage import matplotlib.pyplot as plt from scipy import interpolate from scipy.interpolate import griddata from scipy.interpolate import RectBivariateSpline,bisplrep,CloughTocher2DInterpolator,interp2d N=64 M=64 L=3 vs1=3 vs2=-...
github_jupyter
# Integration ``` import matplotlib.pyplot as plt import numpy as np ``` ## Contents 1.[Integral Calculus](#Integral_Calculus) 2.[Fundamental Theorem of Calculus](#Fundamental_Theorem_of_Calculus) 3.[Basic Integration](#Basic_Integration) - [Integrating powers of x](#Integrating_powers_of_x) - [Integrating other b...
github_jupyter
``` import numpy as np from scipy import ndimage from scipy import spatial from scipy import io from scipy import sparse from scipy.sparse import csgraph from scipy import linalg from matplotlib import pyplot as plt import seaborn as sns from skimage import data from skimage import color from skimage import img_as_floa...
github_jupyter
``` ''' Import packages and modules from Python Standard Library and Third party libraries. ''' #Import from python standard library import os #Import from third party libraries import cv2 import glob import numpy as np import pandas as pd from sklearn.utils import shuffle from skimage.color import gray2rgb, rgb2...
github_jupyter
# Grove Temperature sensor module --- ## Aim * This notebook illustrates how to use available APIs for the Grove Temperature sensor module on PYNQ-Z2 PMOD and Arduino interfaces. ## References * [Grove Temperature sensor](https://www.seeedstudio.com/Grove-Temperature-Sensor.html) * [Grove I2C ADC](https://www.seeed...
github_jupyter
``` # Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
github_jupyter
# Estimating the effective reproduction number in Belgium with the RKI method > Using the Robert Koch Institute method with serial interval of 4. - toc:true - branch: master - badges: true - comments: true - author: Lode Nachtergaele - categories: [cast42, covid19, Belgium] Every day [Bart Mesuere](https://twitter.co...
github_jupyter
``` import sys, os sys.version, os.getcwd() ``` # Torch ``` torch.__version__ import pandas as pd PREFIXES = ['WP','EU','CW','TT','RF'] def clean_source_data(directory): data = pd.read_table(directory, header=None) data['prefix'] = data[0].apply(lambda x: str(x).split(']')[0][1:].strip()).str.upper() data...
github_jupyter
# Chapter 1 Exercises ``` import arviz as az import matplotlib.pyplot as plt import numpy as np import pandas as pd from scipy import stats az.style.use('arviz-darkgrid') ``` ## Question 1 *** We do not know whether the brain really works in a Bayesian way, in an approximate Bayesian fashion, or maybe some evoluti...
github_jupyter
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. ![Impressions](https://PixelServer20190423114238.azurewebsites.net/api/impressions/MachineLearningNotebooks/tutorials/quickstart/azureml-quickstart.png) # Tutorial: Azure Machine Learning Quickstart In this tutorial, you lear...
github_jupyter
``` from IPython.core.debugger import set_trace %run 'activation.ipynb' import numpy as np import pickle %run "mnist.ipynb" import matplotlib as mpl import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1 import Grid ``` ### Define Model ``` class RBM: def __init__(self, n_v, n_h, W=None, b=None, c=N...
github_jupyter
``` # from dask.distributed import Client, LocalCluster # import logging # cluster = LocalCluster( # n_workers=28, # threads_per_worker=8, # silence_logs=logging.DEBUG # ) # client = Client(cluster, heartbeat_interval=10000) # print(client.dashboard_link) import afqinsight as afqi import joblib import mat...
github_jupyter
``` import geopandas as gpd import pandas as pd import numpy as np from copy import deepcopy chirps_file = "../Data/vietnam/fluvial_defended/FD_1in5.csv" chirps_ori = pd.read_csv(chirps_file) chirps_ori.dropna(inplace=True) chirps_ori.columns = ['Lon', 'Lat', 'flood_level'] chirps_data = deepcopy(chirps_ori) chirps_dat...
github_jupyter
## Различные графики ``` import numpy as np import matplotlib.pyplot as plt %matplotlib inline ``` ### Regular plot ``` n = 512 X = np.linspace(0, np.pi/2, n, endpoint=True) Y = np.cos(20*X) * np.exp(-X) plt.figure(figsize=(8,4), dpi=80) # Plot upper sine wave plt.plot(X, Y+2, color='green', alpha=1.00) plt.fill_be...
github_jupyter
``` import os from datetime import datetime, timedelta import ipywidgets as widgets import plotly.graph_objs as go import yfinance as yf import pandas as pd from IPython.display import display interval_opts = [ "1m", "2m", "5m", "15m", "30m", "60m", "90m", "1h", "1d", "5d", "...
github_jupyter
# Introduction to XArray > This tutorial introduces XArray, a Python library for working with labeled multidimensional arrays. - toc: false - badges: true - comments: true - categories: [numpy] #### DEA uses XArray as its data model. To better understand what it is, let's first do a simple experiment on how we could...
github_jupyter
## Crop Analysis for English, Arabic, and Paired English+Arabic Memes ``` import logging import shlex import subprocess import sys import io import pandas as pd from collections import namedtuple from pathlib import Path import matplotlib.image as mpimg import matplotlib.pyplot as plt import numpy as np from matplotl...
github_jupyter
# Differential Privacy - DP ### What is DP? Differential Privacy began with ensuring that different *'statistical analysis'* does not violate privacy, which in the early days of DP meant database queries that remained private. Now, any statistical analysis should not violate the privacy of any individual. We want t...
github_jupyter
One can create particle trajectories from a `DatasetSeries` object for a specified list of particles identified by their unique indices using the `particle_trajectories` method. ``` %matplotlib inline import glob from os.path import join import yt from yt.config import ytcfg path = ytcfg.get("yt", "test_data_dir") imp...
github_jupyter
# Data Carpentry Reproducible Research Workshop - Data Exploration ## Learning objectives Use the Python Pandas library in the Jupyter Notebook to: * Assess the structure and cleanliness of a dataset, including the size and shape of the data, and the number of variables of each type. * Describe findings, translate res...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns from sklearn.linear_model import LinearRegression, LogisticRegression, BayesianRidge from sklearn.model_selection import train_test_split survey_data = pd.read_csv('data/Questionnaire_July 31, 2019_10.47.csv') maps_data = ...
github_jupyter
``` from netCDF4 import Dataset import netCDF4 as netcdf import numpy as np import matplotlib.pyplot as plt import matplotlib.ticker as mticker import matplotlib as mpl #mapping import cartopy.crs as ccrs import cartopy.feature as cfeature from cartopy.io import shapereader from cartopy.mpl.gridliner import LONGITUDE_...
github_jupyter
# RNN Evaluation From our paper on "Explainable Prediction of Acute Myocardial Infarction using Machine Learning and Shapley Values" ``` # Import libraries from keras import optimizers, losses, activations, models from keras.callbacks import ModelCheckpoint, EarlyStopping, LearningRateScheduler, ReduceLROnPlateau fro...
github_jupyter
``` from keras.datasets import mnist (trainX, trainY), (testX, testY) = mnist.load_data() from keras.models import Model from keras.layers import Input, Reshape, Dense, Flatten, Dropout, LeakyReLU class Autoencoder: def __init__(self, img_shape=(28, 28), latent_dim=2, n_layers=2, n_units=128): # encoder h =...
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> # BlackHoles@Home Tutorial: Creating `BOINC` native applica...
github_jupyter
# Working with structured data in Python using Pandas ### What is data preprocessing? Process of converting raw data into useful format.In order to better understand the data, we need to gather some statistical insights into our data. In this module of the course, we will use some of the libraries available with Pyt...
github_jupyter
<center><font size="+4">Introduction to Programming and Data Processing 2020/2021</font></center> <center><font size="+2">Sant'Anna School of Advanced Studies, Pisa, Italy</font></center><br/> <center><font size="+2">Course responsible</font></center> <center><font size="+2">Andrea Vandin a.vandin@santannapisa.it</fon...
github_jupyter
# App4 * An App with 4 functions with different types of workload to validate the performance of the optimization algorithm * There is 1 parallel and 1 cycle in App4 ``` import os from io import BytesIO import time import zipfile import numpy as np import boto3 from tqdm import tqdm from datetime import datetime, t...
github_jupyter
``` !curl -L https://raw.githubusercontent.com/facebookresearch/habitat-sim/main/examples/colab_utils/colab_install.sh | NIGHTLY=true bash -s %cd /content/habitat-sim ## [setup] import os import random import sys import git import magnum as mn import numpy as np import habitat_sim from habitat_sim.utils import viz_ut...
github_jupyter
# Neural Machine Translation with Attention: German to English Here we implement a neural machine translator with attention using standard TensorFlow operations. ``` # These are all the modules we'll be using later. Make sure you can import them # before proceeding further. %matplotlib inline from __future__ import p...
github_jupyter
# AlexNet in Keras In this notebook, we leverage an [AlexNet](https://papers.nips.cc/paper/4824-imagenet-classification-with-deep-convolutional-neural-networks)-like deep, convolutional neural network to classify flowers into the 17 categories of the [Oxford Flowers](http://www.robots.ox.ac.uk/~vgg/data/flowers/17/) d...
github_jupyter
# T81-558: Applications of Deep Neural Networks * Instructor: [Jeff Heaton](https://sites.wustl.edu/jeffheaton/), School of Engineering and Applied Science, [Washington University in St. Louis](https://engineering.wustl.edu/Programs/Pages/default.aspx) * For more information visit the [class website](https://sites.wust...
github_jupyter
``` import pyvisa from pylabnet.utils.logging.logger import LogClient from pylabnet.network.core.generic_server import GenericServer from pylabnet.hardware.power_meter.thorlabs_pm320e import Driver from pylabnet.hardware.polarization.polarization_control import Driver as MPC320 , paddle1, paddle2, paddle3 import time i...
github_jupyter
# Face Detection in OpenCV General Object Detection using Haar feature-based cascade classifiers is an effective object detection method proposed by Paul Viola and Michael Jones in their paper, "Rapid Object Detection using a Boosted Cascade of Simple Features" in 2001. It is a machine learning based approach where a c...
github_jupyter
# CS5340 Lecture 8: HMMs # Lecturer: Harold Soh (harold@comp.nus.edu.sg) Graduate TAs: Abdul Fatir Ansari and Chen Kaiqi (AY19/20) This notebook is a supplement to Lecture 8 of CS5340: Uncertainty Modeling in AI The material uses the hmmlearn package and is based on the tutorial provided by the hmmlearn package (h...
github_jupyter
# Fairness Metrics This notebook implements the statistical fairness metrics from: *Towards the Right Kind of Fairness in AI* by Boris Ruf and Marcin Detyniecki (2021) https://arxiv.org/abs/2102.08453 Example with the `german-risk-scoring.csv` dataset. Contributeurs : Xavier Lioneton & Francis Wolinski ## Imports ...
github_jupyter
# Demonstrate the path of high probability and the orthogonal path on the pyloric rhythm for experimental data ``` # Note: this application requires a more recent version of dill. # Other applications in this repository will require 0.2.7.1 # You might have to switch between versions to run all applications. !pip inst...
github_jupyter
``` #export from fastai.basics import * from fastai.text.core import * from fastai.text.data import * from fastai.text.models.core import * from fastai.text.models.awdlstm import * from fastai.callback.rnn import * from fastai.callback.progress import * #hide from nbdev.showdoc import * #default_exp text.learner ``` #...
github_jupyter
## Stable Model Training #### NOTES: * This is "NoGAN" based training, described in the DeOldify readme. * This model prioritizes stable and reliable renderings. It does particularly well on portraits and landscapes. It's not as colorful as the artistic model. ``` import os os.environ['CUDA_VISIBLE_DEVICES']='0' ...
github_jupyter
Air Quality Index 1)To identify the Most polluted City 2)Create a Model to Predict the quality of air ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns df=pd.read_csv('https://raw.githubusercontent.com/tulseebisen/ML_Projects/main/AirQualityIndex/city_day.csv',parse_date...
github_jupyter
``` # !pip install mediapipe opencv-python import mediapipe as mp import cv2 import numpy as np import uuid import os mp_drawing = mp.solutions.drawing_utils mp_hands = mp.solutions.hands ``` # getting realtime webcam feed ``` cap = cv2.VideoCapture(0) while cap.isOpened(): ret, frame = cap.read() cv2.imshow(...
github_jupyter
# Entrenador de modelos Este script contiene el código para entrenar un modelo de regresión lineal a partir de datos de ventas históricos. El modelo como tal es muy sencillo y probablemente no muy bueno, pero el objetivo del ejercicio es mostrar la arquitectura del sistema completo. Una vez se ejecuta el comando `.fi...
github_jupyter
``` %load_ext autoreload %autoreload 2 import torch from UnarySim.sw.kernel.div import CORDIV_kernel from UnarySim.sw.stream.gen import RNG, SourceGen, BSGen from UnarySim.sw.metric.metric import ProgressiveError import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from matplotlib import ticker, cm f...
github_jupyter
``` %matplotlib inline %reload_ext autoreload %autoreload 2 # 多行输出 from IPython.core.interactiveshell import InteractiveShell InteractiveShell.ast_node_interactivity = "all" import numpy as np from kalman_estimation import Kalman4FROLS, Selector, get_mat_data from tqdm import tqdm, trange from utils import get_term_dic...
github_jupyter
# Systems Identification Model Fitting Fit a Systems Identification model off based off of this [specification](https://hackmd.io/w-vfdZIMTDKwdEupeS3qxQ) and [spec](https://hackmd.io/XVaejEw-QaCghV1Tkv3eVQ) with data obtained in [data_acquisition.ipynb](data/data_acquisition.ipynb). #### Process changes and decision...
github_jupyter