code stringlengths 2.5k 150k | kind stringclasses 1
value |
|---|---|
```
import os, sys, subprocess
# Colab setup ------------------
if "google.colab" in sys.modules:
# Mount drive
from google.colab import drive
print('Select your Caltech Google Account')
drive.mount('/content/drive/')
import numpy as np
import pandas as pd
from scipy.signal import filtfilt, butter... | 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 |
## Predicting Survival on the Titanic
### History
Perhaps one of the most infamous shipwrecks in history, the Titanic sank after colliding with an iceberg, killing 1502 out of 2224 people on board. Interestingly, by analysing the probability of survival based on few attributes like gender, age, and social status, we c... | github_jupyter |
# Data structures for fast infinte batching or streaming requests processing
> Here we dicuss one of the coolest use of a data structures to address one of the very natural use case scenario of a server processing streaming requests from clients in order.Usually processing these requests involve a pipeline of operati... | github_jupyter |
# 用飛槳+ DJL 實作人臉口罩辨識
在這個教學中我們將會展示利用 PaddleHub 下載預訓練好的 PaddlePaddle 模型並針對範例照片做人臉口罩辨識。這個範例總共會分成兩個步驟:
- 用臉部檢測模型識別圖片中的人臉(無論是否有戴口罩)
- 確認圖片中的臉是否有戴口罩
這兩個步驟會包含使用兩個 Paddle 模型,我們會在接下來的內容介紹兩個模型對應需要做的前後處理邏輯
## 導入相關環境依賴及子類別
在這個例子中的前處理飛槳深度學習引擎需要搭配 DJL 混合模式進行深度學習推理,原因是引擎本身沒有包含 NDArray 操作,因此需要藉用其他引擎的 NDArray 操作能力來完成。這邊我們導入 PyTorch ... | 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 |
# Keyboard shortcuts
In this notebook, you'll get some practice using keyboard shortcuts. These are key to becoming proficient at using notebooks and will greatly increase your work speed.
First up, switching between edit mode and command mode. Edit mode allows you to type into cells while command mode will use key p... | github_jupyter |
<a href="https://colab.research.google.com/github/alewis/AdvMPS/blob/master/jit_qr.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
```
# This is formatted as code
```
# Practice writing efficient Jit code on the Householder QR algorithm.
```
imp... | 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 |
<a href="https://colab.research.google.com/github/project-ccap/project-ccap.github.io/blob/master/2021notebooks/2021_1010facial_keypoints_detection.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
```
# -*- coding: utf-8 -*-
```
---
title: Getting S... | github_jupyter |
# Revisión Solver de Markowitz
**Código revisado**
## Librerias necesarias
```
#Librerias necesarias
!curl https://colab.chainer.org/install | sh -
import cupy as cp
import numpy as np
import pandas as pd
import fix_yahoo_finance as yf
import datetime
import matplotlib.pyplot as plt
import seaborn as sns
import... | 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 |
```
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
# Q3 API
from layers import dense
dataset = np.load('a1_dataset.npz')
dataset.files
# 80-10-10 split for train, validate and test images
train_till = int(.8 * dataset['x'].shape[0])
validate_till = int(.9 * dataset['x'].shape[0])
print(trai... | 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 |
```
import pickle
import warnings
warnings.filterwarnings('ignore')
from sklearn.preprocessing import StandardScaler, PolynomialFeatures
import pandas as pd
from pandas.plotting import scatter_matrix
import numpy as np
import matplotlib.pyplot as pl
from matplotlib import rcParams
from seaborn import PairGrid, heatmap,... | github_jupyter |
```
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import datetime
sp500 = pd.read_csv("https://raw.githubusercontent.com/labs13-quake-viewer/ds-data/master/S%26P%20500.csv")
sp500.shape
sp500.describe()
(sp500 == 0).sum()
sp500.info()
sp500.head(12)
dates=[]
for i in sp500... | github_jupyter |
# Getting Started with TensorFlow Hub
[TensorFlow Hub](https://tfhub.dev/) is a repository of reusable TensorFlow machine learning modules. A module is a self-contained piece of a TensorFlow graph, along with its weights and assets, that can be reused across different tasks. These modules can be reused to solve new ta... | 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 |
```
import pandas as pd
from glob import glob
from pypcleaner import convert_excel_time
df = pd.read_hdf('big_multi_index.h5')
scans = pd.read_pickle('scans.p')
imaging_id_codes = pd.read_pickle('imaging_id_codes.p')
id_codes = imaging_id_codes.loc[scans.index,'prefix']
scan_id_df = df.loc[scans.index]
scan_id_df.drop(... | github_jupyter |
```
import json
import requests
import pandas as pd
from tqdm import tqdm
from collections import Counter
import re
import Levenshtein
from cleanco import cleanco
import spacy
from spacy import displacy
nlp = spacy.load('en_core_web_lg')
doj_data = pd.read_json('combined.json', lines=True)
stock_ticker_data = requests.... | 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>

tokenizer = BertTokenizer.from_pretrained('bert-large-uncased-whole-word-masking-finetuned-squad')
```
#... | github_jupyter |
# Tune Hyperparameters
There are many machine learning algorithms that require *hyperparameters* (parameter values that influence training, but can't be determined from the training data itself). For example, when training a logistic regression model, you can use a *regularization rate* hyperparameter to counteract bi... | github_jupyter |
# 插值
```
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
```
设置 **`Numpy`** 浮点数显示格式:
```
np.set_printoptions(precision=2, suppress=True)
```
从文本中读入数据,数据来自 http://kinetics.nist.gov/janaf/html/C-067.txt ,保存为结构体数组:
```
data = np.genfromtxt("JANAF_CH4.txt",
delimiter="\t", # TA... | github_jupyter |
```
import tensorflow as tf
import numpy as np
import math
import scipy
goal_size = 4
batch_size = 10
example_goal = np.random.rand(batch_size, goal_size)
np.random.shuffle(example_goal)
print(example_goal)
arg_max = tf.argmax(example_goal, axis=1, output_type=tf.int32)
print(arg_max)
one_hot = tf.one_hot(arg_max, dept... | github_jupyter |
# The Python ecosystem
## Why Python?
### Python in a nutshell
[Python](https://www.python.org) 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 |
# Catboost Regression No. 2 (With GPU)
```
# Import the required libraries.
import pandas as pd
import numpy as np
# Read the train data.
data_train = pd.read_csv('train.csv')
# Read the first lines of the train data.
data_train.head()
# Print the shape of the train data.
data_train.shape
# Count the number of null va... | github_jupyter |
# **Python Basics**
**Values**
* A value is the fundamental thing that a program manipulates
* Values can be ‘Hello Python’, 1 , True
Values have types.
# **Variable**
1. One of the most basic and powerful concepts is
that of a variable.
2. A variable assigns a name to a value.
Variables are nothing more tha... | 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 |
# Import used modules
```
import pandas as pd
import sys
sys.path.insert(0, '../src')
import benchmark_utils as bu
import analysis_utils as au
```
# Run Alignments for OpenCADD.superposition for the CAMK and CMGC Structures
Perform all pairwise alignments for the given sample structures. Every method performs 2500 ... | 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 |
# Transporter analysis of bacillus mother-spore
```
from __future__ import print_function, division, absolute_import
import sys
import qminospy
from qminospy.me2 import ME_NLP
# python imports
from copy import copy
import re
from os.path import join, dirname, abspath
import sys
sys.path.append('/home/UCSD/cobra_uti... | github_jupyter |
# Data formats 1 - introduction
## [Download exercises zip](../_static/generated/formats.zip)
[Browse files online](https://github.com/DavidLeoni/softpython-en/tree/master/formats)
## Introduction
In these tutorials we will see how to load and write tabular data such as CSV, and we will mention tree-like data such ... | 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 |
```
import pandas as pd
df = pd.read_csv("https://archive.ics.uci.edu/ml/machine-learning-databases/00397/LasVegasTripAdvisorReviews-Dataset.csv", sep=';')
df.head()
df['Score'].value_counts(normalize=True)
from sklearn.model_selection import train_test_split
train, test = train_test_split(df, train_size=0.80, test_s... | 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 |
## Prettify Your Data Structures With Pretty Print in Python
Dealing with data is essential for any Pythonista, but sometimes that data is just not very pretty. Computers don’t care about formatting, but without good formatting, humans may find something hard to read. The output isn’t pretty when you use `print()` on ... | github_jupyter |
# Transformations Tutorial #1: Coordinate Systems
## Introduction
This tutorial is about the transformation packages `LocalCoordinateSystem` class which describes the orientation and position of a Cartesian coordinate system towards another reference coordinate system. The reference coordinate systems origin is always... | 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 |
# Customer segmentation using k-means clustering
Below is a demo applying automated feature engineering to a retail dataset to automatically segment customers based on historical behavior
```
import featuretools as ft
import pandas as pd
retail_es = ft.demo.load_retail()
```
## Use Deep Feature Synthesis
The input ... | github_jupyter |
```
from IPython.core.display import HTML, display
display(HTML("<style>.container { width:100% !important; }</style>"))
%load_ext autoreload
%autoreload 2
import sys
sys.path.append('..')
import logging
import pytorch_lightning as pl
import warnings
warnings.filterwarnings('ignore')
logging.getLogger("pytorch_light... | 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 |
<h1 class="maintitle">Raster Formats and Libraries</h1>
<blockquote class="objectives">
<h2>Overview</h2>
<div class="row">
<div class="col-md-3">
<strong>Teaching:</strong> 5 min
<br>
<strong>Exercises:</strong> 0 min
</div>
<div class="col-md-9">
<strong>Questions</strong>
<ul>
<li><p>What sorts of formats ar... | 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 |
#### 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 |
# Job Search - On-the-Job Search
<a id='index-1'></a>
```
import numpy as np
import scipy.stats as stats
from interpolation import interp
from numba import njit, prange
import matplotlib.pyplot as plt
%matplotlib inline
from math import gamma
class JVWorker:
r"""
A Jovanovic-type model of employment with on-... | github_jupyter |
##### Copyright 2018 The TF-Agents Authors.
```
#@title Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | github_jupyter |
# Ordering by metrics and retraining phase
## Dataset: Intel
## Configuration 2
2. Incremental guided retraining starting from the original model using the new adversarial inputs and original training set.
```
pip install --user tensorflow==2.5
import argparse
import numpy as np
import tensorflow as tf
import kera... | github_jupyter |
<img style="float: right;" src="./images/DataReading.png" width="120"/>
# Reading Data
* Python has a large number of different ways to read data from external files.
* Python supports almost any type of file you can think of, from simple text files to complex binary formats.
* In this class we are going to mainly u... | 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 |
# 3rd Homework of ADM
### Group members
#### 1. Mehrdad Hassanzadeh, 1961575, hassanzadeh.1961575@studenti.uniroma1.it
#### 2. Vahid Ghanbarizadeh, 2002527, ghanbarizdehv@gmail.com
#### 3. Andrea Giordano , 1871786, giordano.1871786@studenti.uniroma1.it
# Importing useful packages
```
import requests
from bs4 impor... | 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 |
# Constructing the musical scale
So far we have discovered two important facts about how we hear and interpret musical notes. We will call them axioms because they are fundamental to our task of constructing the music scale.
**Axiom 1** The ear compares different frequencies *multiplicatively* rather than *additively... | 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 |
```
from sklearn import datasets
from sklearn.cross_validation import cross_val_score, train_test_split
from sklearn.model_selection import cross_val_score
from sklearn.linear_model import LinearRegression,LogisticRegression
from sklearn.naive_bayes import GaussianNB
from sklearn.ensemble import RandomForestClassifier
... | 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 |
# 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 |
# Weight Sampling Tutorial
If you want to fine-tune one of the trained original SSD models on your own dataset, chances are that your dataset doesn't have the same number of classes as the trained model you're trying to fine-tune.
This notebook explains a few options for how to deal with this situation. In particular... | github_jupyter |
## 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 |
## Expectation Reflection for Classification
```
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.model_selection import KFold
from sklearn.metrics import accuracy_score
import expectation_reflection as ER
from sklearn.linear_model import LogisticRegression
import matplotlib.pyplo... | github_jupyter |
# Classifier Training
Make image size and crop size the same.
```
! rsync -a /kaggle/input/mmdetection-v280/mmdetection /
! pip install /kaggle/input/mmdetection-v280/src/mmpycocotools-12.0.3/mmpycocotools-12.0.3/
! pip install /kaggle/input/hpapytorchzoo/pytorch_zoo-master/
! pip install /kaggle/input/hpacellsegment... | github_jupyter |
```
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit # import the curve fitting function
import pandas as pd
%matplotlib inline
```
## Argon
```
Argon = pd.read_table('Ar.txt',delimiter=', ',engine='python', header=None)
Amu = Argon[0] #These are the value... | 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 |
```
from wikification import wikification, wikification_filter
TEST_PATH = "test.txt"
with open(TEST_PATH, "r") as f:
text = "\n".join(f.readlines())
len(text)
res = wikification(text[:10000],
wikification_type="FULL",
long_text_method_name="sum_classic_page_rank")
len(res["wor... | 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 |
"Geo Data Science with Python"
### Notebook Lesson 3
# Object Type: Dictionaries
This lesson discusses the Python object type **Dictionaries**. Carefully study the content of this Notebook and use the chance to reflect the material through the interactive examples.
### Sources
This lesson is an adaption of the les... | github_jupyter |
```
import numpy as np
from astropy import units as u
import matplotlib.pyplot as plt
from astroquery.gaia import Gaia
from astropy.coordinates import SkyCoord
from gaiadr2ruwetools import ruwetools
from astropy.table import Table, Column
from tqdm import tqdm_notebook
from ffd_tools import *
plt.rcParams['font.size']... | github_jupyter |
```
# required for jupyter notebook
%matplotlib inline
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
sns.set(rc={'figure.figsize':(8,6)}) # set sns figure size
import os
import math
def show_corr_heatmap(df):
# https://medium.com/@szabo.bibor/how-to-create-a-seabor... | github_jupyter |
<a href="https://www.bigdatauniversity.com"><img src="https://ibm.box.com/shared/static/cw2c7r3o20w9zn8gkecaeyjhgw3xdgbj.png" width="400" align="center"></a>
<h1><center>K-Means Clustering</center></h1>
## Introduction
There are many models for **clustering** out there. In this notebook, we will be presenting the mo... | 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 |
# Example Notebook for the tunneling Fermions
This Notebook is based on the following [paper](https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.114.080402) from the Jochim group. In these experiments two fermions of different spins are put into a single tweezer and then coupled to a second tweezer. The dynamic... | github_jupyter |
<!--BOOK_INFORMATION-->
<img align="left" style="padding-right:10px;" src="figures/PDSH-cover-small.png">
*This notebook contains an excerpt from the [Python Data Science Handbook](http://shop.oreilly.com/product/0636920034919.do) by Jake VanderPlas; the content is available [on GitHub](https://github.com/jakevdp/Pyth... | github_jupyter |
# scRNAseq Analysis of Tabula muris data
```
#
import matplotlib.pyplot as plt
import pandas as pd
import scanpy as sc
from sklearn.cluster import KMeans
from sklearn.metrics import adjusted_rand_score
from scipy.stats import ttest_ind
#
brain_counts = pd.read_csv("data/brain_counts.csv", index_col=0)
# check the dat... | 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 |
##### 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 |
# 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 |
# Matrix Solutions
## Introduction to Linear Programming
This gives some foundational methods of working with arrays to do matrix multiplication
```
import numpy as np
#Let's put in a m(rows) x n(columns)
quant = np.array([[8, 5, 8, 0],
[8, 2, 4, 0],
[8, 7, 7, 5]])
price = np.... | github_jupyter |
## Binary search
El método de búsqueda binaria funciona, únicamente, sobre conjunto de datos ordenados.
El método consiste en dividir el intervalo de búsqueda en dos partes y compara el elemento que ocupa la posición central del conjunto. Si el elemento del conjunto no es igual al elemento buscado se redefinen los ex... | github_jupyter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.