code stringlengths 2.5k 150k | kind stringclasses 1
value |
|---|---|
```
import matplotlib.pyplot as plt
import numpy as np
import scipy.special
import copy
def empty_mask(size):
return np.zeros((size,size))
def circular_mask(size):
y,x = np.mgrid[:size, :size]
M = np.zeros((size,size))
x0 = y0 = (size-1)/2
r = size/4
M[(x-x0)**2+(y-y0)**2<=r**2]=1
return ... | github_jupyter |
# DASHBOARD LINK
https://public.tableau.com/profile/altaf.lakhi2442#!/vizhome/UnbankedExploration/Dashboard1
```
import pandas as pd
import seaborn as sns
CPS_df = pd.read_csv("../data/processed/CPS_2009_2017_clean.csv")
ACS_df = pd.read_csv("../data/processed/ACS_2011_2017_clean.csv")
NFCS_df = pd.read_csv("../data/... | github_jupyter |
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License.

# Configuration
_**Setting up your Azure Machine Learning services workspace and configuring your n... | github_jupyter |
This notebook was prepared by [Donne Martin](https://github.com/donnemartin). Source and license info is on [GitHub](https://github.com/donnemartin/interactive-coding-challenges).
# Challenge Notebook
## Problem: Given an array of (unix_timestamp, num_people, EventType.ENTER or EventType.EXIT), find the busiest perio... | github_jupyter |
<a href="https://qworld.net" target="_blank" align="left"><img src="../qworld/images/header.jpg" align="left"></a>
$ \newcommand{\bra}[1]{\langle #1|} $
$ \newcommand{\ket}[1]{|#1\rangle} $
$ \newcommand{\braket}[2]{\langle #1|#2\rangle} $
$ \newcommand{\dot}[2]{ #1 \cdot #2} $
$ \newcommand{\biginner}[2]{\left\langle... | github_jupyter |
# Sentiment Analysis: Data Gathering 1 (Vader)
The original sentiments of domain dataset are unclean, especially for the neutral sentiment. Instead of manually going through and correcting sentiments by hand certain techniques are employed to assist this process. This notebook implements the first data annotation pip... | github_jupyter |
# Datasets and Neural Networks
This notebook will step through the process of loading an arbitrary dataset in PyTorch, and creating a simple neural network for regression.
# Datasets
We will first work through loading an arbitrary dataset in PyTorch. For this project, we chose the <a href="http://www.cs.toronto.edu/~d... | github_jupyter |
# Optimization with equality constraints
```
import math
import numpy as np
from scipy import optimize as opt
```
maximize $.4\,\log(x_1)+.6\,\log(x_2)$ s.t. $x_1+3\,x_2=50$.
```
I = 50
p = np.array([1, 3])
U = lambda x: (.4*math.log(x[0])+.6*math.log(x[1]))
x0 = (I/len(p))/np.array(p)
budget = ({'type': 'eq', 'fun'... | github_jupyter |
```
import sys
sys.path.append('../')
%load_ext autoreload
%autoreload 2
import sklearn
import copy
import numpy as np
import seaborn as sns
sns.set()
import scipy as sp
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import seaborn as sns
# from viz import viz
from bokeh.plotti... | github_jupyter |
# 0) Carregamento as bibliotecas
```
# Mostra múltiplos resultados em uma única saída:
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"
from IPython.display import Math
import pandas as pd
import numpy as np
import geopandas as gpd
import os
import pysal
from p... | github_jupyter |
<a href="https://colab.research.google.com/github/arindamdeyofficial/Amazon_Review_Sentiment_Analysys/blob/main/Group_037_SEC_3_Assignment_2_Image_Captioning.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
Assignment 2 Set 5
Image Captioning
###Deep... | github_jupyter |
```
#IMPORT SEMUA LIBARARY
#IMPORT LIBRARY PANDAS
import pandas as pd
#IMPORT LIBRARY UNTUK POSTGRE
from sqlalchemy import create_engine
import psycopg2
#IMPORT LIBRARY CHART
from matplotlib import pyplot as plt
from matplotlib import style
#IMPORT LIBRARY BASE PATH
import os
import io
#IMPORT LIBARARY PDF
from fpdf im... | github_jupyter |
```
import numpy as np
import pandas as pd
src_path = "C:/Users/h1006/Documents/Research/Sun/Data/1_Kinematics/"
#src_name = ["Results1-5-116.csv", "Results1-54-109-20.csv", "Results2-125-215-20.csv", "Results2-160-210.csv",
# "Results3-1-74-20.csv", "Results3-75-120.csv", "Results4-60-100.csv", "Results4-... | github_jupyter |
# Thematic Reports
Thematic reports run historical analyses on the exposure of a portfolio to various Goldman Sachs Flagship Thematic baskets over a specified date range.
### Prerequisite
To execute all the code in this tutorial, you will need the following application scopes:
- **read_product_data**
- **read_financ... | github_jupyter |
```
import os
import random
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim as optim
import torch.utils.data
import torchvision.datasets as dset
import torchvision.transforms as transforms
import torchvision.utils as vutils
import numpy as np
import ma... | github_jupyter |
```
%cd ../
```
## Stochastic Block Model Experiment
Before geting into the experiment details, let's review algorithm 1 and the primal and dual updates.
### Algorithm 1

```
# %load algorithm/main.py
%time
from sklearn.metrics import mean_squared_error
from penalty import *
def algor... | github_jupyter |
```
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | github_jupyter |
# SAMUR Emergency Frequencies
This notebook explores how the frequency of different types of emergency changes with time in relation to different periods (hours of the day, days of the week, months of the year...) and locations in Madrid. This will be useful for constructing a realistic emergency generator in the city... | github_jupyter |
```
import numpy as np
import tensorflow as tf
from sklearn.utils import shuffle
import re
import time
import collections
import os
def build_dataset(words, n_words, atleast=1):
count = [['PAD', 0], ['GO', 1], ['EOS', 2], ['UNK', 3]]
counter = collections.Counter(words).most_common(n_words)
counter = [i for... | github_jupyter |
# S3Fs Notebook Example
S3Fs is a Pythonic file interface to S3. It builds on top of botocore.
The top-level class S3FileSystem holds connection information and allows typical file-system style operations like cp, mv, ls, du, glob, etc., as well as put/get of local files to/from S3.
The connection can be anonymous -... | github_jupyter |
```
# 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 writing, software
# distributed under t... | github_jupyter |
```
import matplotlib.pyplot as plt
from wildfires.analysis import *
from wildfires.data.datasets import *
new = NewERA5_DryDayPeriod()
old = ERA5_DryDayPeriod()
old.cubes = iris.cube.CubeList([old.cube[:20]])
iris.cube.CubeList([new.cube, old.cube]).realise_data()
diff = new.cube.data - old.cube.data
rel_abs_diff = np... | github_jupyter |
# Character-Level LSTM in PyTorch
In this notebook, I'll construct a character-level LSTM with PyTorch. The network will train character by character on some text, then generate new text character by character. As an example, I will train on Anna Karenina. **This model will be able to generate new text based on the te... | github_jupyter |
# 1 - Sequence to Sequence Learning with Neural Networks
In this series we'll be building a machine learning model to go from once sequence to another, using PyTorch and torchtext. This will be done on German to English translations, but the models can be applied to any problem that involves going from one sequence to... | github_jupyter |
## IBM Quantum Challenge Fall 2021
# Challenge 3: Classify images with quantum machine learning
<div class="alert alert-block alert-info">
We recommend that you switch to **light** workspace theme under the Account menu in the upper right corner for optimal experience.
## Introduction
Machine learning is a tec... | github_jupyter |
# Session 2 - Training a Network w/ Tensorflow
<p class="lead">
Assignment: Teach a Deep Neural Network to Paint
</p>
<p class="lead">
Parag K. Mital<br />
<a href="https://www.kadenze.com/courses/creative-applications-of-deep-learning-with-tensorflow/info">Creative Applications of Deep Learning w/ Tensorflow</a><br /... | github_jupyter |
```
#!pip install pandas_profiling
#!pip install matplotlib
import sys
sys.version
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
import scipy.stats as stats
import pandas_profiling
%matplotlib inline
plt.rcParams['figure.figsize'] = 10, 7.5
plt.rcParam... | github_jupyter |
##### Copyright 2020 The TensorFlow Authors.
```
#@title Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | github_jupyter |
# Week 3: Improve MNIST with Convolutions
In the videos you looked at how you would improve Fashion MNIST using Convolutions. For this exercise see if you can improve MNIST to 99.5% accuracy or more by adding only a single convolutional layer and a single MaxPooling 2D layer to the model from the assignment of the pr... | github_jupyter |
## Data and Training
The **augmented** cough audio dataset of the [Project Coswara](https://coswara.iisc.ac.in/about) was used to train the deep CNN model.
The preprocessing steps and CNN architecture is as shown below. The training code is concealed on Github to protect the exact hyperparameters and maintain perform... | github_jupyter |
# Joy Ride - Part 3: Parallel Parking
In this section you will write a function that implements the correct sequence of steps required to parallel park a vehicle.
NOTE: for this segment the vehicle's maximum speed has been set to just over 4 mph. This should make parking a little easier.
) are built around the NumPy array... | github_jupyter |
# Scraping and Parsing: EAD XML Finding Aids from the Library of Congress
```
import os
from urllib.request import urlopen
from bs4 import BeautifulSoup
import subprocess
## Creating a directory called 'LOC_Metadata' and setting it as our current working directory
!mkdir /sharedfolder/LOC_Metadata
os.chdir('/sharedf... | github_jupyter |
## Dependencies
```
import warnings, glob
from tensorflow.keras import Sequential, Model
from cassava_scripts import *
seed = 0
seed_everything(seed)
warnings.filterwarnings('ignore')
```
### Hardware configuration
```
# TPU or GPU detection
# Detect hardware, return appropriate distribution strategy
strategy, tpu... | github_jupyter |
```
%matplotlib inline
```
This notebook deals with banks of cylinders in a cross flow. Cylinder banks are common heat exchangers where the cylinders may be heated by electricity or a fluid may be flowing within the cylinder to cool or heat the flow around the cylinders. The advantage of cylinder banks is the increase... | github_jupyter |
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License.
# Training Pipeline - Custom Script
_**Training many models using a custom script**_
----
This notebook demonstrates how to create a pipeline that trains and registers many models using a custom script. We utilize the [Paralle... | github_jupyter |
```
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from tqdm import tqdm
# Pg. 125: http://incompleteideas.net/book/bookdraft2018mar21.pdf
#0 is the left terminal state
# 6 is the right terminal state
# 1 ... 5 represents A ... E
VALUES = np.zeros(7)
VALUES[1:6] = 0.5
# For ... | github_jupyter |
```
import xarray as xr
from mpl_toolkits.axes_grid1 import make_axes_locatable
# file = '/Users/mikesmith/Downloads/5MHz_6km_realtime-agg_2f30_fcd6_a21e.nc'
file = '/Users/mikesmith/Downloads/5MHz_6km_realtime-agg_a667_a2f2_f11b.nc'
ds = xr.open_dataset(file).mean('time')
ds
tds = ds.coarsen(longitude=2, latitude=2,... | github_jupyter |
# Amazon SageMaker Object Detection for Bird Species
1. [Introduction](#Introduction)
2. [Setup](#Setup)
3. [Data Preparation](#Data-Preparation)
1. [Download and unpack the dataset](#Download-and-unpack-the-dataset)
2. [Understand the dataset](#Understand-the-dataset)
3. [Generate RecordIO files](#Generate-Reco... | github_jupyter |
# Test
```
import fastai.train
import pandas as pd
import torch
import torch.nn as nn
from captum.attr import LayerIntegratedGradients
# --- Model Setup ---
# Load a fast.ai `Learner` trained to predict IMDB review category `[negative, positive]`
awd = fastai.train.load_learner(".", "imdb_fastai_trained_lm_clf.pth")... | github_jupyter |
## 데이터 불러오기
```
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import datetime as dt
import warnings
warnings.filterwarnings('ignore')
%matplotlib inline
import matplotlib as mat
import matplotlib.font_manager as fonm
font_list = [font.name for font in fonm.fontManager.tt... | github_jupyter |
# Repertoire classification subsampling
When training a classifier to assign repertoires to the subject from which they were obtained, we need a set of subsampled sequences. The sequences have been condensed to just the V- and J-gene assignments and the CDR3 length (VJ-CDR3len). Subsample sizes range from 10 to 10,000... | github_jupyter |
# Strata objects: Legend and Column
Strata is stratigraphic data.
The main object of `strata` submodule is `mplStrater.strata.Column` which represents the single stratigraphic column.
This example shows the structure of the class and how to use it.
First, import all required packages and load the example dataset.
`... | github_jupyter |
Sometimes it is useful to take a random choice between two or more options.
Numpy has a function for that, called `random.choice`:
```
import numpy as np
```
Say we want to choose randomly between 0 and 1. We want an equal probability of getting 0 and getting 1. We could do it like this:
```
np.random.randint(0, ... | github_jupyter |
```
package_jar = '../target/spark-data-repair-plugin_2.12_spark3.2_0.1.0-EXPERIMENTAL-with-dependencies.jar'
import numpy as np
import pandas as pd
from pyspark.sql import *
from pyspark.sql.types import *
from pyspark.sql import functions as f
spark = SparkSession.builder \
.config('spark.jars', package_jar) \
... | github_jupyter |
# Capsule Network
In this notebook i will try to explain and implement Capsule Network. MNIST images will be used as an input.
To implement capsule Network, we need to understand what are capsules first and what advantages do they have compared to convolutional neural network.
### so what are capsules?
* Briefly ex... | github_jupyter |
```
from IPython.core.display import display, HTML
display(HTML("<style>.container { width:60% !important; }</style>"))
```
# Monte Carlo Control
So far, we assumed that we know the underlying model of the environment and that the agent has access to it.
Now, we considere the case in which do not have access to the ... | github_jupyter |
```
import pandas as pd
import numpy as np
import glob
import os
from IPython.core.display import display, HTML
display(HTML("<style>.container { width:100% !important; }</style>"))
display(HTML("<style>div.output_scroll { height: 44em; }</style>"))
def get_meta(path):
"""Returns (threads, num_jsons, repeats)"""
... | github_jupyter |
# Scenario Analysis: Pop Up Shop

Kürschner (talk) 17:51, 1 December 2020 (UTC), CC0, via Wikimedia Commons
`... | github_jupyter |
<span style="color:#888888">Copyright (c) 2014-2021 National Technology and Engineering Solutions of Sandia, LLC. Under the terms of Contract DE-NA0003525 with National Technology and Engineering Solutions of Sandia, LLC, the U.S. Government retains certain rights in this software. Redistribution and use in source ... | github_jupyter |
# Optimization of a Voigt profile
```
from exojax.spec.rlpf import rvoigt
import jax.numpy as jnp
import matplotlib.pyplot as plt
```
Let's optimize the Voigt function $V(\nu, \beta, \gamma_L)$ using exojax!
$V(\nu, \beta, \gamma_L)$ is a convolution of a Gaussian with a STD of $\beta$ and a Lorentian with a gamma pa... | github_jupyter |
```
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import pickle
def load_obj(name ):
with open('ttt/' + name + '.pkl', 'rb') as f:
return pickle.load(f)
results = load_obj("results")
hidden_units = []
def get_avg(list_,n_episodes):
avg = np.abs(np.array(list_[:-n_episodes]).mean... | github_jupyter |
# Machine Learning Trading Bot
In this Challenge, you’ll assume the role of a financial advisor at one of the top five financial advisory firms in the world. Your firm constantly competes with the other major firms to manage and automatically trade assets in a highly dynamic environment. In recent years, your firm has... | github_jupyter |
```
!wget --no-check-certificate \
https://storage.googleapis.com/mledu-datasets/cats_and_dogs_filtered.zip \
-O cats_and_dogs_filtered.zip
! unzip cats_and_dogs_filtered.zip
import keras,os
from keras.models import Sequential
from keras.layers import Dense, Conv2D, MaxPool2D , Flatten
from keras.preprocessing.imag... | github_jupyter |
<!-- Copyright 2015 Google Inc. All rights reserved. -->
<!-- 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 -->
<!-- http://www.apache.org/licenses/LICENSE-2.0 -->
<!-- Unl... | github_jupyter |
## Setup
```
from google.colab import drive
drive.mount('/content/drive')
!ls /content/drive/MyDrive/ColabNotebooks/Transformer
!nvcc --version
!pip3 install timm faiss tqdm numpy
!pip3 install torch==1.10.2+cu113 torchvision==0.11.3+cu113 torchaudio==0.10.2+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable... | github_jupyter |
```
# HIDDEN
from datascience import *
from prob140 import *
import numpy as np
import matplotlib.pyplot as plt
plt.style.use('fivethirtyeight')
%matplotlib inline
import math
from scipy import stats
from scipy import misc
```
### The Chain at a Fixed Time ###
Let $X_0, X_1, X_2, \ldots $ be a Markov Chain with state ... | github_jupyter |
```
import csv
from pprint import pprint
import random
import numpy as np
alphabet = ['',
'ا', 'ب', 'ت', 'ث','ج','ح', 'خ',
'د','ذ','ر','ز', 'س','ش','ص',
'ض','ط','ظ','ع','غ','ف','ق',
'ك','ل','م','ن','ه','و','ي',
'ء','ى','أ','ؤ']
def xalphabetin(char):
num... | github_jupyter |
# Twitter Sentiment Analysis
```
import twitter
import pandas as pd
import numpy as np
```
### Source
https://towardsdatascience.com/creating-the-twitter-sentiment-analysis-program-in-python-with-naive-bayes-classification-672e5589a7ed
### Authenticating Twitter API
```
# Authenticating our twitter API credentials... | github_jupyter |
```
#yds data mapping 2012 (eastbound and westbound)
```
<h4>This script is to map 2012 galway traffic data (bridge 1)</h4>
```
#python list to store csv data as mapping suggest
#Site No Dataset Survey Company Client Project Reference Method of Survey Address Latitude Longtitude Easting Northing Date From Date To Tim... | github_jupyter |
## Data Preperation for the first Model
Welcome to the first notebook. Here we'll process the data from downloading to what we will be using to train our first model - **'Wh’re Art Thee Min’ral?'**.
The steps we'll be following here are:
- Downloading the SARIG Geochem Data Package. **(~350 Mb)**
- Understanding the d... | github_jupyter |
## Hyperopt
### Iris 数据集
在本节中,我们将介绍4个使用hyperopt在经典数据集 Iris 上调参的完整示例。我们将涵盖 K 近邻(KNN),支持向量机(SVM),决策树和随机森林。
对于这项任务,我们将使用经典的Iris数据集,并进行一些有监督的机器学习。数据集有有4个输入特征和3个输出类别。数据被标记为属于类别0,1或2,其映射到不同种类的鸢尾花。输入有4列:萼片长度,萼片宽度,花瓣长度和花瓣宽度。输入的单位是厘米。我们将使用这4个特征来学习模型,预测三种输出类别之一。因为数据由sklearn提供,它有一个很好的DESCR属性,可以提供有关数据集的详细信息。尝试以下代码以获得更多细节信息
```... | github_jupyter |
# Black-Scholes Algorithm Using Numba-dppy
## Sections
- [Black Sholes algorithm](#Black-Sholes-algorithm)
- _Code:_ [Implementation of Black Scholes targeting CPU using Numba JIT](#Implementation-of-Black-Scholes-targeting-CPU-using-Numba-JIT)
- _Code:_ [Implementation of Black Scholes targeting GPU using Kernels](#I... | github_jupyter |
```
# Pandas for managing datasets
import pandas as pd
# seaborn for plotting and styling
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
# read dataset
tips = sns.load_dataset("tips")
# a preview of the data
tips.head()
# make a copy of the data to create the graphs of
df = tips.copy()
df
# cr... | github_jupyter |
TSG097 - Get BDC stateful sets (Kubernetes)
===========================================
Description
-----------
Steps
-----
### Common functions
Define helper functions used in this notebook.
```
# Define `run` function for transient fault handling, suggestions on error, and scrolling updates on Windows
import sys... | github_jupyter |
```
## Importing the libraries
import pandas as pd
import re
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.model_selection import train_test_split
from sklearn.naive_bayes import MultinomialNB
from sklearn.linear_model import Logist... | github_jupyter |
## Trajectory equations:
```
%matplotlib inline
import matplotlib.pyplot as plt
from sympy import *
init_printing()
Bx, By, Bz, B = symbols("B_x, B_y, B_z, B")
x, y, z = symbols("x, y, z" )
x_0, y_0, z_0 = symbols("x_0, y_0, z_0")
vx, vy, vz, v = symbols("v_x, v_y, v_z, v")
vx_0, vy_0, vz_0 = symbols("v_x0, v_y0, v_z0... | github_jupyter |
# 人力规划
等级:高级
## 目的和先决条件
此模型是人员编制问题的一个示例。在人员编制计划问题中,必须在招聘,培训,裁员(裁员)和安排工时方面做出选择。人员配备问题在制造业和服务业广泛存在。
### What You Will Learn
In this example, we will model and solve a manpower planning problem. We have three types of workers with different skills levels. For each year in the planning horizon, the forecasted number o... | github_jupyter |
```
import os, sys
from LossJLearn.utils.plot import show_prediction_face_comparison, show_linear_point, show_regressor_linear
from LossJLearn.datasets import load_linear_data
import numpy as np
from matplotlib import pyplot as plt
import sklearn
from sklearn.linear_model import LinearRegression, Ridge, RidgeCV, Lass... | github_jupyter |
```
%matplotlib inline
%reload_ext autoreload
%autoreload 2
from ipyexperiments import *
from lib.fastai.imports import *
from lib.fastai.structured import *
import pandas as pd
import numpy as np
import lightgbm as lgb
from scipy.sparse import vstack, csr_matrix, save_npz, load_npz
from sklearn.preprocessing import L... | github_jupyter |
```
#Goal: obtain a universal time, in Julian Date from a local time in the header of the fits images
from astropy.io import fits #work with fits images
from astropy.time import Time #work with time in header
import glob #work with files in the directory
import yaml #work with yaml files
import numpy as np
import sys
... | github_jupyter |
**This notebook is an exercise in the [Geospatial Analysis](https://www.kaggle.com/learn/geospatial-analysis) course. You can reference the tutorial at [this link](https://www.kaggle.com/alexisbcook/interactive-maps).**
---
# Introduction
You are an urban safety planner in Japan, and you are analyzing which areas o... | github_jupyter |
# Classification with Neural Network for Yoga poses detection
## Import Dependencies
```
import numpy as np
import pandas as pd
import os
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow.keras.utils import to_categorical
from tensorflow.keras.preprocessing.image import load_img, img_to_array
f... | github_jupyter |
TVAE Model
===========
In this guide we will go through a series of steps that will let you
discover functionalities of the `TVAE` model, including how to:
- Create an instance of `TVAE`.
- Fit the instance to your data.
- Generate synthetic versions of your data.
- Use `TVAE` to anonymize PII information.
- ... | github_jupyter |
```
!pip install kornia
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import sys
import os
import torch.optim as optim
import torchvision
from torchvision import datasets, transforms
from scipy import io
import torch.utils.data
import scipy
from scipy.stats import entropy
import... | github_jupyter |
## _*H2 ground state energy computation using Iterative QPE*_
This notebook demonstrates using Qiskit Chemistry to plot graphs of the ground state energy of the Hydrogen (H2) molecule over a range of inter-atomic distances using IQPE (Iterative Quantum Phase Estimation) algorithm. It is compared to the same energies a... | 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 |
```
#using tensorflow kernel
import tensorflow as tf
print(tf.__version__)
!pip list | grep waymo
!pip list | grep torch
!nvidia-smi
import tensorflow.compat.v1 as tf
import math
import numpy as np
import itertools
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.patches as pat... | github_jupyter |
```
### from datetime import datetime
from os import environ
from os.path import join
import json
# YES/NO data dictionary
YES = 1
NO = 2
NOT_APPLY = 97
IGNORED = 98
NOT_SPECIFIED = 99
# Laboratory result dictionary
LAB_POSITIVE = 1
LAB_NO_POSITIVE = 2
LAB_PENDING_RESULT = 3
LAB_WRONG_RESULT = 4
LAB_NOT_APPLY = 9... | github_jupyter |
# Computer Vision Nanodegree
## Project: Image Captioning
---
In this notebook, you will learn how to load and pre-process data from the [COCO dataset](http://cocodataset.org/#home). You will also design a CNN-RNN model for automatically generating image captions.
Note that **any amendments that you make to this no... | github_jupyter |
```
from scipy.signal import savgol_filter
from math import factorial
from sklearn.cluster import KMeans
import os
import numpy as np
from spectral import *
import matplotlib.pyplot as plt
import math
from scipy.io import loadmat
from sklearn.decomposition import PCA
from sklearn import preprocessing
import pickle
impo... | github_jupyter |
**Student BENREKIA Mohamed Ali (IASD 2021-2022)**
```
%matplotlib inline
import numpy as np
from scipy.linalg import norm
import matplotlib.pyplot as plt
import seaborn as sns
%load_ext autoreload
%autoreload 2
```
# Loading data
```
!wget https://raw.githubusercontent.com/nishitpatel01/predicting-age-of-abalone-... | github_jupyter |
# The Monte Carlo Simulation of Radiation Transport
WE will discuss essentiall physics and method to do gamma quanta (photons with high enough energy) radiation transport using Monte Carlo methods. We will covers interactions processes, basics of radiation passing through matter as well as Monte Carlo method and how i... | github_jupyter |
# Random Signals
*This jupyter notebook is part of a [collection of notebooks](../index.ipynb) on various topics of Digital Signal Processing. Please direct questions and suggestions to [Sascha.Spors@uni-rostock.de](mailto:Sascha.Spors@uni-rostock.de).*
## Auto-Power Spectral Density
The (auto-) [power spectral dens... | github_jupyter |
# Table of Contents
<p>
```
#!python
"""
Find the brightest pixel coordinate of a image.
@author: Bhishan Poudel
@date: Oct 27, 2017
@email: bhishanpdl@gmail.com
"""
# Imports
import time
import numpy as np
from astropy.io import fits
import subprocess
from scipy.ndimage import measurements
def brightest_coor... | github_jupyter |
# Implementation of VGG16
> In this notebook I have implemented VGG16 on CIFAR10 dataset using Pytorch
```
#importing libraries
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchvision import transforms
import torch.optim as optim
import tqdm
import matplotlib.pyplot as plt
from torchvisio... | github_jupyter |
```
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
df_rides = pd.read_csv('cab_rides.csv')
df_weather = pd.read_csv('weather.csv')
df_rides['date'] = pd.to_datetime(df_rides['time_stamp']/ 1000, unit = 's')
df_weather['date'] = pd.to_datetime(df_weather['time_stamp'], unit ... | github_jupyter |
*Accompanying code examples of the book "Introduction to Artificial Neural Networks and Deep Learning: A Practical Guide with Applications in Python" by [Sebastian Raschka](https://sebastianraschka.com). All code examples are released under the [MIT license](https://github.com/rasbt/deep-learning-book/blob/master/LICEN... | github_jupyter |

<a href="https://hub.callysto.ca/jupyter/hub/user-redirect/git-pull?repo=https%3A%2F%2Fgithub.com%2Fcallysto%2Fshorts&branch=master&subPath=master.ipynb&depth=1" target="_parent"><img src="http... | github_jupyter |
```
import pandas as pd
import numpy as np
from sklearn.cluster import MiniBatchKMeans, KMeans
from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer, TfidfTransformer
import matplotlib.pyplot as plt
from sklearn.manifold import TSNE
import ast
from gensim.corpora import Dictionary
from gensim.mo... | github_jupyter |
# REINFORCE in PyTorch
Just like we did before for Q-learning, this time we'll design a PyTorch network to learn `CartPole-v0` via policy gradient (REINFORCE).
Most of the code in this notebook is taken from approximate Q-learning, so you'll find it more or less familiar and even simpler.
```
import sys, os
if 'goog... | github_jupyter |
# Equivalent layer technique for estimating total magnetization direction: Analysis of the result
## Importing libraries
```
% matplotlib inline
import sys
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
import cPickle as pickle
import datetime
import timeit
import string as st
from... | github_jupyter |
# Parsing Natural Language in Python
**(C) 2018 by [Damir Cavar](http://damir.cavar.me/)**
**License:** [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/) ([CA BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/))
This is a tutorial related to ... | github_jupyter |
```
# to get a version that is at least we can use >=
# pip install plotly>=4.0.0
!pip install plotly>=4.1.1
!pip uninstall cufflinks
import plotly
plotly.__version__
# !pip install "notebook>=5.3" "ipywidgets>=7.2"
import plotly.graph_objects as go
fig = go.Figure(data=go.Bar(x=[-3,-2,-1,0,1], y=[2, 3, 1, 5.3, -1], ma... | github_jupyter |
# Mask R-CNN Demo
A quick intro to using the pre-trained model to detect and segment objects.
```
import os
import sys
import random
import math
import numpy as np
import skimage.io
import matplotlib
import matplotlib.pyplot as plt
import cv2,time,json,glob
from IPython.display import clear_output
# Root directory ... | github_jupyter |
# The perceptron - Recognising the MNIST digits
<div>Table of contents</div>
<div id="toc"></div>
```
%matplotlib inline
from pylab import *
from utils import *
```
Let us implement a perceptron that categorize the MNIST images as numbers. As you will see below the behaviour of the network is far from optimal. As w... | github_jupyter |
# BE 240 Lecture 4
# Sub-SBML
## Modeling diffusion, shared resources, and compartmentalized systems
## _Ayush Pandey_
```
# This notebook is designed to be converted to a HTML slide show
# To do this in the command prompt type (in the folder containing the notebook):
# jupyter nbconvert BE240_Lecture4_Sub-SBML.ipy... | github_jupyter |
[Table of Contents](http://nbviewer.ipython.org/github/rlabbe/Kalman-and-Bayesian-Filters-in-Python/blob/master/table_of_contents.ipynb)
# The Extended Kalman Filter
```
#format the book
%matplotlib inline
from __future__ import division, print_function
from book_format import load_style
load_style()
```
At this poi... | github_jupyter |
# Examples of usage of Gate Angle Placeholder
The word "Placeholder" is used in Qubiter (we are in good company, Tensorflow uses this word in the same way) to mean a variable for which we delay/postpone assigning a numerical value (evaluating it) until a later time. In the case of Qubiter, it is useful to define gates... | github_jupyter |
# The art of using pipelines
Pipelines are a natural way to think about a machine learning system. Indeed with some practice a data scientist can visualise data "flowing" through a series of steps. The input is typically some raw data which has to be processed in some manner. The goal is to represent the data in such ... | github_jupyter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.