text stringlengths 2.5k 6.39M | kind stringclasses 3
values |
|---|---|
# Simulate and Generate Empirical Distributions in Python
## Mini-Lab: Simulations, Empirical Distributions, Sampling
Welcome to your next mini-lab! Go ahead an run the following cell to get started. You can do that by clicking on the cell and then clickcing `Run` on the top bar. You can also just press `Shift` + `Ent... | github_jupyter |
Cognizant Data Science Summit 2020 : July 1, 2020
Yogesh Deshpande [157456]
# Week 1 challenge - Python
Description
The eight queens puzzle is the problem of placing eight chess queens on an 8×8 chessboard so that no two queens threaten each other; thus, a solution requires that no two queens share the same row,... | github_jupyter |
# Language Translation
In this project, you’re going to take a peek into the realm of neural network machine translation. You’ll be training a sequence to sequence model on a dataset of English and French sentences that can translate new sentences from English to French.
## Get the Data
Since translating the whole lan... | github_jupyter |
# 🔬 Sequence Comparison of DNA using `BioPython`
### 🦠 `Covid-19`, `SARS`, `MERS`, and `Ebola`
#### Analysis Techniques:
* Compare their DNA sequence and Protein (Amino Acid) sequence
* GC Content
* Freq of Each Amino Acids
* Find similarity between them
* Alignment
* hamming distance
* 3D structure of each
|... | github_jupyter |
<span style="font-size:20pt;color:blue">Add title here</span>
This is a sample file of interactive stopped-flow data analysis. You do <b>NOT</b> need to understand python language to use this program. By replacing file names and options with your own, you can easily produce figures and interactively adjust plotting op... | github_jupyter |
# Monetary Economics: Chapter 5
### Preliminaries
```
# This line configures matplotlib to show figures embedded in the notebook,
# instead of opening a new window for each figure. More about that later.
# If you are using an old version of IPython, try using '%pylab inline' instead.
%matplotlib inline
import matp... | github_jupyter |
# `Cannabis (drug)`
#### `INFORMATION`:
### Everything we need to know about marijuana (cannabis)
>`Cannabis, also known as marijuana among other names, is a psychoactive drug from the Cannabis plant used for medical or recreational purposes. The main psychoactive part of cannabis is tetrahydrocannabinol (THC), one ... | github_jupyter |
##### week1-Q1.
What does the analogy “AI is the new electricity” refer to?
1. Through the “smart grid”, AI is delivering a new wave of electricity.
2. AI runs on computers and is thus powered by electricity, but it is letting computers do things not possible before.
3. Similar to electricity starting about 100 years... | github_jupyter |
```
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
%matplotlib inline
sns.set_style("whitegrid")
plt.style.use("fivethirtyeight")
df = pd.read_csv('diabetes.csv')
df[0:10]
pd.set_option("display.float", "{:.2f}".format)
df.describe()
df.info()
missing_values_count = df.isnu... | github_jupyter |
```
import sys
sys.path.append('../scripts/')
from mcl import *
from kf import *
class EstimatedLandmark(Landmark):
def __init__(self):
super().__init__(0,0)
self.cov = None
def draw(self, ax, elems):
if self.cov is None:
return
##推定位置に青い星を描く##
... | github_jupyter |
Put `coveval` folder into our path for easy import of modules:
```
import sys
sys.path.append('../')
```
# Load data
```
from coveval import utils
from coveval.connectors import generic
```
Let's load some data corresponding to the state of New-York and look at the number of daily fatalities:
```
df_reported = uti... | github_jupyter |
```
# default_exp dl_101
```
# Deep learning 101 with Pytorch and fastai
> Some code and text snippets have been extracted from the book [\"Deep Learning for Coders with Fastai and Pytorch: AI Applications Without a PhD\"](https://course.fast.ai/), and from these blog posts [[ref1](https://muellerzr.github.io/fastblo... | github_jupyter |
# CNN - Example 01
```
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
```
### Load Keras Dataset
```
from tensorflow.keras.datasets import mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()
```
#### Visualize data
```
print(x_train.shape)
single_image = x_train[0]
print(single_i... | github_jupyter |
## Data Distillation
In this notebook we train models using data distillation.
```
from google.colab import drive
drive.mount('/content/drive')
from google.colab import files
uploaded = files.upload()
!unzip dataset.zip -d dataset
import warnings
import os
import shutil
import glob
import random
import random
import ... | github_jupyter |
```
# default_exp utils_blitz
```
# uitls_blitz
> API details.
```
#export
#hide
from blitz.modules import BayesianLinear
from blitz.modules import BayesianEmbedding, BayesianConv1d, BayesianConv2d, BayesianConv3d
from blitz.modules.base_bayesian_module import BayesianModule
from torch import nn
import torch
from fa... | github_jupyter |
```
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import statistics
rep5_04_002_data = pd.read_csv('proc_rep5_04_002.csv')
del rep5_04_002_data['Unnamed: 0']
rep5_04_002_data
rgg_rgg_data = rep5_04_002_data.copy()
rgg_rand_data = rep5_04_002_data.copy()
rand_rgg_data = rep5_04_002_data.copy()
... | github_jupyter |
# 卷积神经网络示例与各层可视化
```
import os
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
%matplotlib inline
print ("当前TensorFlow版本为 [%s]" % (tf.__version__))
print ("所有包载入完毕")
```
## 载入 MNIST
```
mnist = input_data.read_data_sets('data/', ... | github_jupyter |
# TV Script Generation
In this project, you'll generate your own [Simpsons](https://en.wikipedia.org/wiki/The_Simpsons) TV scripts using RNNs. You'll be using part of the [Simpsons dataset](https://www.kaggle.com/wcukierski/the-simpsons-by-the-data) of scripts from 27 seasons. The Neural Network you'll build will gen... | github_jupyter |
```
%run startup.py
%%javascript
$.getScript('./assets/js/ipython_notebook_toc.js')
```
# A Decision Tree of Observable Operators
## Part 1: NEW Observables.
> source: http://reactivex.io/documentation/operators.html#tree.
> (transcribed to RxPY 1.5.7, Py2.7 / 2016-12, Gunther Klessinger, [axiros](http://www.axiro... | github_jupyter |
#### Copyright 2017 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 writin... | github_jupyter |
```
import phys
import phys.newton
import phys.light
import numpy as np
import time
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
class ScatterDeleteStep2(phys.Step):
def __init__(self, n, A):
self.n = n
self.A = A
self.built = False
def run(self, sim)... | github_jupyter |
# Testing cosmogan
Aug 25, 2020
Borrowing pieces of code from :
- https://github.com/pytorch/tutorials/blob/11569e0db3599ac214b03e01956c2971b02c64ce/beginner_source/dcgan_faces_tutorial.py
- https://github.com/exalearn/epiCorvid/tree/master/cGAN
```
import os
import random
import logging
import sys
import torch
im... | github_jupyter |
## Programming Exercise 1 - Linear Regression
- [warmUpExercise](#warmUpExercise)
- [Linear regression with one variable](#Linear-regression-with-one-variable)
- [Gradient Descent](#Gradient-Descent)
```
# %load ../../standard_import.txt
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from skl... | github_jupyter |
# BEL to Natural Language
**Author:** [Charles Tapley Hoyt](https://github.com/cthoyt/)
**Estimated Run Time:** 5 seconds
This notebook shows how the PyBEL-INDRA integration can be used to turn a BEL graph into natural language. Special thanks to John Bachman and Ben Gyori for all of their efforts in making this pos... | github_jupyter |
# Basic Examples with Different Protocols
## Prerequisites
* A kubernetes cluster with kubectl configured
* curl
* grpcurl
* pygmentize
## Examples
* [Seldon Protocol](#Seldon-Protocol-Model)
* [Tensorflow Protocol](#Tensorflow-Protocol-Model)
* [KFServing V2 Protocol](#KFServing-V2-Protocol-Model)
##... | github_jupyter |
# NumPy Array Basics - Multi-dimensional Arrays
```
import sys
print(sys.version)
import numpy as np
print(np.__version__)
npa = np.arange(25)
npa
```
We learned in the last video how to generate arrays, now let’s generate multidimensional arrays. These are, as you might guess, arrays with multiple dimensions.
We ca... | github_jupyter |
<a href="https://colab.research.google.com/github/RSid8/SMM4H21/blob/main/Task1a.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
#Importing the Libraries and Models
```
from google.colab import drive
drive.mount('/content/drive')
!pip install fairs... | github_jupyter |
```
import intake
import xarray as xr
import os
import pandas as pd
import numpy as np
import zarr
import rhg_compute_tools.kubernetes as rhgk
import warnings
warnings.filterwarnings("ignore")
write_direc = '/gcs/rhg-data/climate/downscaled/workdir'
client, cluster = rhgk.get_standard_cluster()
cluster
```
get some ... | github_jupyter |
# Gymnasion Data Processing
Here I'm going to mine some chunk of Project Gutenberg texts for `(adj,noun)` and `(noun,verb,object)` relations using mostly SpaCy and textacy. Extracting them is easy. Filtering out the chaff is not so easy.
```
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from tqdm import tqdm
import... | github_jupyter |
# T1129 - Shared Modules
Adversaries may abuse shared modules to execute malicious payloads. The Windows module loader can be instructed to load DLLs from arbitrary local paths and arbitrary Universal Naming Convention (UNC) network paths. This functionality resides in NTDLL.dll and is part of the Windows [Native API](... | github_jupyter |
# <center>Master M2 MVA 2017/2018 - Graphical models - HWK 3<center/>
### <center>WANG Yifan && CHU Xiao<center/>
```
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
from scipy.stats import multivariate_normal as norm
import warnings
warnings.filterwarnings("ignore")
# Data loading
data_pat... | github_jupyter |
# Predicting Heart Disease using Machine Learning
This notebook uses various Python based machine learning and data science libraries in an attempt to build a machine learning model capable of predicting whether or not someone has a Heart Disease based on their medical attributes.
We're going to take the following ap... | github_jupyter |
<pre>
Torch : Manipulating vectors like dot product, addition etc and using GPU
Numpy : Manipuliting vectors
Pandas : Reading CSV file
Matplotlib : Plotting figure
</pre>
```
import numpy as np
import torch
import pandas as pd
from matplotlib import pyplot as plt
```
<pre>
O
... | github_jupyter |
##### Copyright 2018 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 |
# 6. Pandas Introduction
In the previous chapters, we have learned how to handle Numpy arrays that can be used to efficiently perform numerical calculations. Those arrays are however homogeneous structures i.e. they can only contain one type of data. Also, even if we have a single type of data, the different rows or c... | github_jupyter |
<style>div.container { width: 100% }</style>
<img style="float:left; vertical-align:text-bottom;" height="65" width="172" src="../assets/holoviz-logo-unstacked.svg" />
<div style="float:right; vertical-align:text-bottom;"><h2>Tutorial 0. Setup</h2></div>
This first step to the tutorial will make sure your system is s... | github_jupyter |
### Seminar: Spectrogram Madness

#### Today you're finally gonna deal with speech! We'll walk you through all the main steps of speech processing pipeline and you'll get to do voice-warping. It's gonna be fun! ....and creepy. V... | github_jupyter |
# Deep Q-learning
In this notebook, we'll build a neural network that can learn to play games through reinforcement learning. More specifically, we'll use Q-learning to train an agent to play a game called [Cart-Pole](https://gym.openai.com/envs/CartPole-v0). In this game, a freely swinging pole is attached to a cart.... | github_jupyter |
# NASA Data Exploration
```
raw_data_dir = '../data/raw'
processed_data_dir = '../data/processed'
figsize_width = 12
figsize_height = 8
output_dpi = 72
# Imports
import os
import numpy as np
import pandas as pd
from datetime import datetime
import matplotlib.pyplot as plt
# Load Data
nasa_temp_file = os.path.join(raw_... | github_jupyter |
## Train a model with Iris data using XGBoost algorithm
### Model is trained with XGBoost installed in notebook instance
### In the later examples, we will train using SageMaker's XGBoost algorithm
```
# Install xgboost in notebook instance.
#### Command to install xgboost
!pip install xgboost==1.2
import sys
import... | github_jupyter |
# Handling uncertainty with quantile regression
```
%matplotlib inline
```
[Quantile regression](https://www.wikiwand.com/en/Quantile_regression) is useful when you're not so much interested in the accuracy of your model, but rather you want your model to be good at ranking observations correctly. The typical way to ... | github_jupyter |
<a id='1'></a>
# 1. Import packages
```
from keras.models import Sequential, Model
from keras.layers import *
from keras.layers.advanced_activations import LeakyReLU
from keras.activations import relu
from keras.initializers import RandomNormal
from keras.applications import *
import keras.backend as K
from tensorflow... | github_jupyter |
### Privatizing Histograms
Sometimes we want to release the counts of individual outcomes in a dataset.
When plotted, this makes a histogram.
The library currently has two approaches:
1. Known category set `make_count_by_categories`
2. Unknown category set `make_count_by`
The next code block imports just handles boi... | github_jupyter |
## Set up the dependencies
```
# for reading and validating data
import emeval.input.spec_details as eisd
import emeval.input.phone_view as eipv
import emeval.input.eval_view as eiev
# Visualization helpers
import emeval.viz.phone_view as ezpv
import emeval.viz.eval_view as ezev
# Metrics helpers
import emeval.metrics... | 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 |
# Explore the classification results
This notebook will guide you through different visualizations of the test set evaluation of any of the presented models.
In a first step you can select the result file of any of the models you want to explore.
```
model = 'vgg_results_sample.csv' #should be placed in the /eval/ f... | github_jupyter |
#### Setup
```
# standard imports
import numpy as np
import torch
import matplotlib.pyplot as plt
from torch import optim
from ipdb import set_trace
from datetime import datetime
# jupyter setup
%matplotlib inline
%load_ext autoreload
%autoreload 2
# own modules
from dataloader import CAL_Dataset
from net import ge... | github_jupyter |
```
%matplotlib widget
import os
import sys
sys.path.insert(0, os.getenv('HOME')+'/pycode/MscThesis/')
import pandas as pd
from amftrack.util import get_dates_datetime, get_dirname, get_plate_number, get_postion_number
import ast
from amftrack.plotutil import plot_t_tp1
from scipy import sparse
from datetime impo... | github_jupyter |
<a href="https://colab.research.google.com/github/wisrovi/pyimagesearch-buy/blob/main/visual_logging_example.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
 is a multi-purpose programming language created in 1989 by [Guido van Rossum](https://en.wikipedia.org/wiki/Guido_van_Rossum) and developed under a open source license.
It has the following characteristics:
- multi-para... | github_jupyter |
```
#coding:utf-8
import sys
import numpy as np
sys.path.append("..")
import argparse
from train_models.mtcnn_model import P_Net, R_Net, O_Net
from prepare_data.loader import TestLoader
from Detection.detector import Detector
from Detection.fcn_detector import FcnDetector
from Detection.MtcnnDetector import MtcnnDetec... | github_jupyter |
# Coronagraph Basics
This set of exercises guides the user through a step-by-step process of simulating NIRCam coronagraphic observations of the HR 8799 exoplanetary system. The goal is to familiarize the user with basic `pynrc` classes and functions relevant to coronagraphy.
```
# If running Python 2.x, makes print ... | github_jupyter |
```
# ignore this
%matplotlib inline
%load_ext music21.ipython21
```
# User's Guide, Chapter 15: Keys and KeySignatures
Music21 has two main objects for working with keys: the :class:`~music21.key.KeySignature` object, which handles the spelling of key signatures and the :class:`~music21.key.Key` object which does ev... | github_jupyter |
CER002 - Download existing Root CA certificate
==============================================
Use this notebook to download a generated Root CA certificate from a
cluster that installed one using:
- [CER001 - Generate a Root CA
certificate](../cert-management/cer001-create-root-ca.ipynb)
And then to upload the... | github_jupyter |
# Exploratory Data Analysis Case Study -
##### Conducted by Nirbhay Tandon & Naveen Sharma
## 1.Import libraries and set required parameters
```
#import all the libraries and modules
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import re
from scipy import stats
# Sup... | github_jupyter |
# Introduction to NumPy
Forked from [Lecture 2](https://github.com/jrjohansson/scientific-python-lectures/blob/master/Lecture-2-Numpy.ipynb) of [Scientific Python Lectures](http://github.com/jrjohansson/scientific-python-lectures) by [J.R. Johansson](http://jrjohansson.github.io/)
```
%matplotlib inline
import trace... | 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 |
<img width="100" src="https://carbonplan-assets.s3.amazonaws.com/monogram/dark-small.png" style="margin-left:0px;margin-top:20px"/>
# Forest Emissions Tracking - Validation
_CarbonPlan ClimateTrace Team_
This notebook compares our estimates of country-level forest emissions to prior estimates from other
groups. The ... | github_jupyter |
# Object Oriented Programming (OOP)
### classes and attributes
```
# definition of a class object
class vec3:
pass
# instance of the vec3 class object
a = vec3()
# add some attributes to the v instance
a.x = 1
a.y = 2
a.z = 2.5
print(a)
print(a.z)
print(a.__dict__)
# another instance of the vec3 class object
b... | github_jupyter |
```
from py2neo import Graph,Node,Relationship
import pandas as pd
import os
import QUANTAXIS as QA
import datetime
import numpy as np
import statsmodels.formula.api as sml
from QAStrategy.qastockbase import QAStrategyStockBase
import matplotlib.pyplot as plt
import scipy.stats as scs
import matplotlib.mlab as mlab
f... | github_jupyter |
# Integrating TAO Models in DeepStream
In the first of two notebooks, we will be building a 4-class object detection pipeline as shown in the illustration below using Nvidia's TrafficCamNet pretrained model, directly downloaded from NGC.
Note: This notebook has code inspired from a sample application provided by NVI... | github_jupyter |
# Importing libaries
```
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.linear_model import LinearRegression, BayesianRidge
from sklearn.model_selection import train_test_split
from sklearn.metrics import mean_squared_error, r2_score
from sklearn import linear... | github_jupyter |
```
import matplotlib as mpl
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
import nltk
from wordcloud import WordCloud, STOPWORDS, ImageColorGenerator
from sklearn.metrics import accuracy_score
from sklearn.feature_extraction.text import CountVectorizer... | github_jupyter |
Copyright 2020 Verily Life Sciences LLC
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file or at
https://developers.google.com/open-source/licenses/bsd
# Trial Specification Demo
The first step to use the Baseline Site Selection Tool is to specify your trial.
All data i... | 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 |
```
from matplotlib_venn import venn2, venn3
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
isaacs = pd.read_json('isaacs-reach.json', typ='series')
setA = set(isaacs)
mathias = pd.read_json('mathias-reach.json', typ='series')
setB = set(mathias)
packages = pd.read_json('latestPackages.json',... | github_jupyter |
```
import torch
import torchvision
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import matplotlib.pyplot as plt
import random
import backwardcompatibilityml.loss as bcloss
import backwardcompatibilityml.scores as scores
# Initialize random seed
random.seed(123)
torch.manual_seed(... | github_jupyter |
# 一等函数
函数是一等对象。
## 一等对象
一等对象:
- 在运行时创建
- 能赋值给变量或数据结构中的元素
- 能作为参数传给函数
- 能作为函数的返回结果
```
def factorial(n):
'''return n!'''
return 1 if n < 2 else n * factorial(n-1)
# 将函数看作是对象传入方法中:
list(map(factorial, range(11)))
dir(factorial)
```
## 可调用对象 Callable Object
### 一共7种:
- 用户定义的函数 : def或lambda
- 内置函数
- 内置方法
-... | github_jupyter |
## Dependencies
```
import json, warnings, shutil, glob
from jigsaw_utility_scripts import *
from scripts_step_lr_schedulers import *
from transformers import TFXLMRobertaModel, XLMRobertaConfig
from tensorflow.keras.models import Model
from tensorflow.keras import optimizers, metrics, losses, layers
SEED = 0
seed_ev... | github_jupyter |
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License.

# How to u... | github_jupyter |
# Softmax exercise
*Complete and hand in this completed worksheet (including its outputs and any supporting code outside of the worksheet) with your assignment submission. For more details see the [assignments page](http://vision.stanford.edu/teaching/cs231n/assignments.html) on the course website.*
This exercise is ... | github_jupyter |
# Poisson Regression, Gradient Descent
In this notebook, we will show how to use gradient descent to solve a [Poisson regression model](https://en.wikipedia.org/wiki/Poisson_regression). A Poisson regression model takes on the following form.
$\operatorname{E}(Y\mid\mathbf{x})=e^{\boldsymbol{\theta}' \mathbf{x}}$
wh... | github_jupyter |
# Unwetter Simulator
```
import os
os.chdir('..')
f'Working directory: {os.getcwd()}'
from unwetter import db, map
from datetime import datetime
from unwetter import config
config.SEVERITY_FILTER = ['Severe', 'Extreme']
config.STATES_FILTER = ['NW']
config.URGENCY_FILTER = ['Immediate']
severities = {
'Minor':... | github_jupyter |
# MLI BYOR: Custom Explainers
This notebook is a demo of MLI **bring your own explainer recipe** (BYOR) Python API.
**Ad-hoc OOTB and/or custom explainer run** scenario:
* **Upload** interpretation recipe.
* Determine recipe upload job **status**.
* **Run** ad-hoc recipe run job.
* Determine ad-hoc recipe job ... | github_jupyter |
# Sensitivity Analysis
```
import os
import itertools
import random
import pandas as pd
import numpy as np
import scipy
import matplotlib.pyplot as plt
import seaborn as sns
sns.set(style="whitegrid")
import sys
sys.path.insert(0, '../utils')
import model_utils
import geoutils
import logging
import warnings
loggin... | github_jupyter |
## KF Basics - Part I
### Introduction
#### What is the need to describe belief in terms of PDF's?
This is because robot environments are stochastic. A robot environment may have cows with Tesla by side. That is a robot and it's environment cannot be deterministically modelled(e.g as a function of something like time ... | github_jupyter |
```
import json
import pathlib
import numpy as np
import sklearn
import yaml
from sklearn.preprocessing import normalize
from numba import jit
from utils import get_weight_path_in_current_system
def load_features() -> dict:
datasets = ("cifar10", "cifar100", "ag_news")
epochs = (500, 500, 100)
features ... | github_jupyter |
```
"""
created by Arj at 16:28 BST
#Section
Investigating the challenge notebook and running it's code.
#Subsection
Running a simulated qubit with errors
"""
import matplotlib.pyplot as plt
import numpy as np
from qctrlvisualizer import get_qctrl_style, plot_controls
from qctrl import Qctrl
plt.style.use(get_qct... | github_jupyter |
```
import os
import pandas as pd
def load_data(path):
full_path = os.path.join(os.path.realpath('..'), path)
df = pd.read_csv(full_path, header=0, index_col=0)
print("Dataset has {} rows, {} columns.".format(*df.shape))
return df
df_train = load_data('data/raw/train.csv')
df_test = load_data('data/raw/... | github_jupyter |
## Sentiment Analysis with MXNet and Gluon
This tutorial will show how to train and test a Sentiment Analysis (Text Classification) model on SageMaker using MXNet and the Gluon API.
```
import os
import boto3
import sagemaker
from sagemaker.mxnet import MXNet
from sagemaker import get_execution_role
sagemaker_sessio... | github_jupyter |
```
from warnings import filterwarnings
import arviz as az
import matplotlib.pyplot as plt
import numpy as np
import pymc as pm
from sklearn.linear_model import LinearRegression
%load_ext lab_black
%load_ext watermark
filterwarnings("ignore")
```
# A Simple Regression
From [Codes for Unit 1](https://www2.isye.gatec... | github_jupyter |
# CSX46
## Class session 6: BFS
Objective: write and test a function that can compute single-vertex shortest paths in an unweighted simple graph. Compare to the results that we get using `igraph.Graph.get_shortest_paths()`.
We're going to need several packages for this notebook; let's import them first
```
import r... | github_jupyter |
# Robot Class
In this project, we'll be localizing a robot in a 2D grid world. The basis for simultaneous localization and mapping (SLAM) is to gather information from a robot's sensors and motions over time, and then use information about measurements and motion to re-construct a map of the world.
### Uncertainty
A... | github_jupyter |
## Классная работа
Является ли процесс ($X_n$) мартингалом по отношению к фильтрации $\mathcal{F}_n$?
1. $z_1,z_2,\ldots,z_n$ — независимы и $z_i\sim N(0,49)$, $X_n=\sum_{i=1}^n z_i$. Фильтрация: $\mathcal{F}_n=\sigma(z_1,z_2,\ldots,z_n);$
2. $z_1,z_2,\ldots,z_n$ — независимы и $z_i\sim U[0,1]$, $X_n=\sum_{i=1}^n z_... | github_jupyter |
# 2.3 Least Squares and Nearest Neighbors
### 2.3.3 From Least Squares to Nearest Neighbors
1. Generates 10 means $m_k$ from a bivariate Gaussian distrubition for each color:
- $N((1, 0)^T, \textbf{I})$ for <span style="color: blue">BLUE</span>
- $N((0, 1)^T, \textbf{I})$ for <span style="color: orange">ORANGE<... | github_jupyter |
```
import re
import json
import matplotlib.pylab as plt
import numpy as np
import glob
%matplotlib inline
all_test_acc = []
all_test_err = []
all_train_loss = []
all_test_loss = []
all_cardinalities = []
all_depths = []
all_widths = []
for file in glob.glob('logs_cardinality/Cifar2/*.txt'):
with open(file) as logs... | github_jupyter |
# Using an external master clock for hardware control of a stage-scanning high NA oblique plane microscope
Tutorial provided by [qi2lab](https://www.shepherdlaboratory.org).
This tutorial uses Pycro-Manager to rapidly acquire terabyte-scale volumetric images using external hardware triggering of a stage scan optimiz... | github_jupyter |
```
%load_ext autoreload
%autoreload 2
import os
import sys
from pathlib import Path
ROOT_DIR = os.path.abspath(os.path.join(Path().absolute(), os.pardir))
sys.path.insert(1, ROOT_DIR)
import numpy as np
import scipy
import matplotlib.pyplot as plt
from frequency_response import FrequencyResponse
from biquad import pea... | github_jupyter |
# Direct Grib Read
If you have installed more recent versions of pygrib, you can ingest grib mosaics directly without conversion to netCDF. This speeds up the ingest by ~15-20 seconds. This notebook will also demonstrate how to use MMM-Py with cartopy, and how to download near-realtime data from NCEP.
```
from __futu... | github_jupyter |
```
# header files
import torch
import torch.nn as nn
import torchvision
import numpy as np
from torch.utils.tensorboard import SummaryWriter
from google.colab import drive
drive.mount('/content/drive')
np.random.seed(1234)
torch.manual_seed(1234)
torch.cuda.manual_seed(1234)
# define transforms
train_transforms = torc... | github_jupyter |
```
import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
np.random.seed(0)
from statistics import mean
```
今回はアルゴリズムの評価が中心の章なので,学習アルゴリズム実装は後に回し、sklearnを学習アルゴリズムとして使用する。
```
import sklearn
```
今回、学習に使うデータはsin関数に正規分布$N(\varepsilon|0,0.05)$ノイズ項を加えたデータを使う
```
size = 100
max_degree = 11
x_data = np.rand... | github_jupyter |
___
<a href='https://www.udemy.com/user/joseportilla/'><img src='../Pierian_Data_Logo.png'/></a>
___
<center><em>Content Copyright by Pierian Data</em></center>
# Warmup Project Exercise
## Simple War Game
Before we launch in to the OOP Milestone 2 Project, let's walk through together on using OOP for a more robust... | github_jupyter |
```
from IPython.display import HTML
HTML('''<script>
code_show=true;
function code_toggle() {
if (code_show){
$('div.input').hide();
} else {
$('div.input').show();
}
code_show = !code_show
}
$( document ).ready(code_toggle);
</script>
The raw code for this IPython notebook is by default hidden for easier rea... | github_jupyter |
# H2O Tutorial: EEG Eye State Classification
Author: Erin LeDell
Contact: erin@h2o.ai
This tutorial steps through a quick introduction to H2O's R API. The goal of this tutorial is to introduce through a complete example H2O's capabilities from R.
Most of the functionality for R's `data.frame` is exactly the same s... | github_jupyter |
<a href="https://colab.research.google.com/github/issdl/from-data-to-solution-2021/blob/main/4_metrics.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Metrics
## Imports
```
import numpy as np
np.random.seed(2021)
import random
random.seed(2021)... | github_jupyter |
```
import pandas as pd
import numpy as np
import os
import matplotlib
import matplotlib.pyplot as plt
from xgboost.sklearn import XGBRegressor
from sklearn.model_selection import train_test_split
from sklearn.metrics import mean_squared_error, roc_auc_score, make_scorer, accuracy_score
from xgboost import XGBClassifi... | github_jupyter |
```
import re
from robobrowser import RoboBrowser
import urllib
import os
class ProgressBar(object):
"""
链接:https://www.zhihu.com/question/41132103/answer/93438156
来源:知乎
"""
def __init__(self, title, count=0.0, run_status=None, fin_status=None, total=100.0, unit='', sep='/', chunk_size=1.0):
... | github_jupyter |
# Character-based LSTM
## Grab all Chesterton texts from Gutenberg
```
from nltk.corpus import gutenberg
gutenberg.fileids()
text = ''
for txt in gutenberg.fileids():
if 'chesterton' in txt:
text += gutenberg.raw(txt).lower()
chars = sorted(list(set(text)))
char_indices = dict((c, i) for i, c i... | github_jupyter |
Check coefficients for integration schemes - they should all line up nicely for values in the middle and vary smoothly
```
from bokeh import plotting, io, models, palettes
io.output_notebook()
import numpy
from maxr.integrator import history
nmax = 5
figures = []
palette = palettes.Category10[3]
for n in range(1, nm... | github_jupyter |
### Notebook for the Udacity Project "Write A Data Science Blog Post"
#### Dataset used: "TripAdvisor Restaurants Info for 31 Euro-Cities"
https://www.kaggle.com/damienbeneschi/krakow-ta-restaurans-data-raw
https://www.kaggle.com/damienbeneschi/krakow-ta-restaurans-data-raw/downloads/krakow-ta-restaurans-data-raw.zip/... | github_jupyter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.