text stringlengths 2.5k 6.39M | kind stringclasses 3
values |
|---|---|
##### Copyright 2018 The TensorFlow Authors.
Licensed under the Apache License, Version 2.0 (the "License");
```
#@title Licensed under the Apache License, Version 2.0 (the "License"); { display-mode: "form" }
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at... | github_jupyter |
## Approximate Dynamic Programming Example
We consider an optimal control problem that is similar to that described in the [model predictive control example](https://github.com/cvxgrp/codegen/blob/main/examples/MPC.ipynb). However, we assume that the system matrices are functions of the state $x \in \mathbb{R}^n$, i.e... | github_jupyter |
## YoloV5 Pseudo Labeling + OOF Evaluation
This notebook is a clean up of [Yolov5 Pseudo Labeling](https://www.kaggle.com/nvnnghia/yolov5-pseudo-labeling), with OOF-evaluation to search the best `score_threshold` for final prediction.
References:
Awesome original Pseudo Labeling notebook: https://www.kaggle.com/... | github_jupyter |
# Plugwise data converter
This script has been written to convert the logged consumption data from the Plugwise Circle to the preferred structure for NILM-Eval (https://github.com/beckel/nilm-eval).
The data has been received from the Plugwise-2-py MQTT messages in Node-Red and saved in CSV files.
Input: CSV-files f... | github_jupyter |
```
import seaborn as sns
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.pylab as pylab
import scipy.io as io
sns.set_style("darkgrid", {"axes.facecolor": ".9"})
#Set up parameters for the figures..
params = {'legend.fontsize': 'x-large',
'figure.figsize': (12, 1),
... | github_jupyter |
1. Class human that gives out the names and age of a person
```
class human:
def __init__(self, name, age):
self.name=name
self.age=age
def output(self):
print(f"{self.name} is {self.age} years old")
my_human=human("Divyansh", 25)
my_human.output()
#my_human.age
#my_human.name
... | github_jupyter |
### Minigrad demo
https://github.com/karpathy/micrograd/
```
import random
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
from minigrad.engine import Value
from minigrad.nn import Neuron, Layer, MLP
np.random.seed(1337)
random.seed(1337)
# make up a dataset
from sklearn.datasets import make_mo... | github_jupyter |
# Extract relevant worksheets from ONS Excel data
---
## ONS API Website
- https://developer.ons.gov.uk/dataset/
## Checklist:
- [x] Multi-factor productivity estimates (7th July 2020)
- [x] UK business: activity, size and location (29th Sept 2020)
- [x] Regional gross value added (balanced) by industry: all NUTS leve... | github_jupyter |
## Load and Process Dataset
Dataset source: https://www.kaggle.com/snap/amazon-fine-food-reviews
```
import csv
from nltk import word_tokenize
import string
summaries = []
texts = []
def clean(text):
text = text.lower()
printable = set(string.printable)
text = "".join(list(filter(lambda x: x in printa... | github_jupyter |
# Basic EM workflow 3 (Restaurants data set)
# Introduction
This IPython notebook explains a basic workflow two tables using *py_entitymatching*. Our goal is to come up with a workflow to match restaurants from Fodors and Zagat sites. Specifically, we want to maximize F1. The datasets contain information about the re... | github_jupyter |
## Dependencies
```
import os
import cv2
import shutil
import random
import warnings
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn.utils import class_weight
from sklearn.model_selection import train_test_split
from sklearn.metrics import confusion_matrix, coh... | github_jupyter |
### An example dataset with country values
```
import pandas as pd
import numpy as np
df = pd.DataFrame({
"country": [
"Canada", "foo canada bar", "cnada", "northern ireland", " ireland ",
"congo, kinshasa", "congo, brazzaville", 304, "233", " tr ", "ARG",
"hello", np.nan, "NULL"
]
})
d... | github_jupyter |
```
import pandas as pd
import json
from prophet.serialize import model_to_json, model_from_json
from datetime import datetime
import sktime as skt
from sktime.forecasting.base import ForecastingHorizon
from sktime.forecasting.model_selection import temporal_train_test_split
from sktime.forecasting.theta import ThetaFo... | github_jupyter |
Code for generating results for the graph with two instrumental variables (Figure 2(b) and Figure 3(b)).
```
import numpy
import sympy
import pandas
import numpy as np
import pandas as pd
import datetime
import copy
import attr
import time
import logging
import itertools
import pickle
import sys
import os
import funct... | github_jupyter |
# Essential Exercises
Here are a list of exercises to check your knowledge of Python.
## Scalars, vectors and matrices
* Assign the result of $1 + 2.3^{3.4} - \tfrac{5}{6}$ to the variable `check1`.
```
check1 = 1 + 2.3**3.4 - 5/6
print("check1 is", check1)
```
* Enter the vector ${\bf x} = \begin{pmatrix} 1 & 2 \... | github_jupyter |
<a id='pd'></a>
<div id="qe-notebook-header" align="right" style="text-align:right;">
<a href="https://quantecon.org/" title="quantecon.org">
<img style="width:250px;display:inline;" width="250px" src="https://assets.quantecon.org/img/qe-menubar-logo.svg" alt="QuantEcon">
</a>
</div>
#... | github_jupyter |
# Setup
- Make sure to have a clock visible
- Check network connectivity
- Displays mirrored
- Slides up
- Empty notebook
- Ideally using 3.7-pre because it has better error messages: `python-37/bin/jupyter notebook`
- Full screened (F11)
- Hide header and toolbar
- Turn on line numbers
- This loaded in a tab ... | github_jupyter |
z# With lists
## Context
The algorithm did not work as well as expected out of the box.
Because of this, I decided to investigate if it could be a problem with the string distance threshold.
To do so, I manually labeled a bit less than a hundred html pages with the number of data records in them.
A page in a market p... | github_jupyter |
# Mastering PyTorch
## Supervised learning
### Use Google Collab
#### Accompanying notebook to Video 1.6
```
# Install Pytorch and torchvision
from os import path
from wheel.pep425tags import get_abbr_impl, get_impl_ver, get_abi_tag
platform = '{}{}-{}'.format(get_abbr_impl(), get_impl_ver(), get_abi_tag())
accele... | github_jupyter |
# Tutorial #4 HyperModel Cores
```
import matplotlib.pyplot as plt
%config InlineBackend.figure_format = 'retina'
%matplotlib inline
import numpy as np
import json, pickle, copy
import la_forge.diagnostics as dg
import la_forge.core as co
from la_forge.rednoise import plot_rednoise_spectrum, plot_free_spec
from la_fo... | github_jupyter |
# Basic SageMaker Processing Script
This notebook corresponds to the section "Preprocessing Data With The Built-In Scikit-Learn Container" in [this](https://aws.amazon.com/blogs/aws/amazon-sagemaker-processing-fully-managed-data-processing-and-model-evaluation/) blog post.
It shows a very basic example of using SageM... | github_jupyter |
<style>
pre {
white-space: pre-wrap !important;
}
.table-striped > tbody > tr:nth-of-type(odd) {
background-color: #f9f9f9;
}
.table-striped > tbody > tr:nth-of-type(even) {
background-color: white;
}
.table-striped td, .table-striped th, .table-striped tr {
border: 1px solid black;
border-collapse: co... | github_jupyter |
```
%load_ext autoreload
%autoreload 2
```
# Model MI for each species
1. load datasets
2. fit models to each language
3. calculate curvature for each model
```
import pandas as pd
import numpy as np
from parallelspaper.config.paths import DATA_DIR
from parallelspaper import model_fitting as mf
from tqdm.autonotebook... | github_jupyter |
<table class="tfo-notebook-buttons" align="left">
<td>
<a target="_blank" href="https://colab.research.google.com/github/notebookexplore/notebookexplore/blob/master/getting-started/tensorflow/handwritten_digit_classifier.ipynb"><img src="https://www.tensorflow.org/images/colab_logo_32px.png" />Run in Google Colab... | github_jupyter |
# Characterising trip distance of global regions
Fit the trip distance distribution using a few candidate theoretical distributions.
```
%load_ext autoreload
%autoreload 2
from tqdm import tqdm
import numpy as np
import pandas as pd
import math
import yaml
from scipy import stats
from scipy.stats import kurtosis
from... | github_jupyter |
# Introduction to Transmon Physics
## Contents
1. [Multi-level Quantum Systems as Qubits](#mlqsaq)
2. [Hamiltonians of Quantum Circuits](#hoqc)
3. [Quantizing the Hamiltonian](#qth)
4. [The Quantized Transmon](#tqt)
5. [Comparison of the Transmon and the Quantum Harmonic Oscillator](#cottatqho)
6. [Qubit Drive and th... | github_jupyter |
# Elasticsearch 日本語テキストの検索
3.2節で説明したElasticsearch サーバーの起動が前提です。
```
# Elasticsearchインスタンスの生成
from elasticsearch import Elasticsearch
es = Elasticsearch()
# インデックス作成用JSONの定義
create_index = {
"settings": {
"analysis": {
"filter": {
"synonyms_filter": { # 同義語フィルターの定義
... | github_jupyter |
# Interpretation
> Easy consine similarity search, search similar features among vectors is a frequently encountered situation
> Most of the code is from Ray's other library ```forgebox.cosine```
```
# default_exp interp.latent
# export
import numpy as np
import pandas as pd
from typing import Dict, List, Any
from fo... | github_jupyter |
# Ejercicio 1
En este ejercicio vas a realizar un programa ya algo más complejo, en el que tendrás que utilizar clases, bucles, listas, input y módulos de Python. Vas a trabajar con datos reales, de las estaciones de bicicleta de *BiciMAD*. Necesitarás implementar un par de clases para modelizar tus datos. Además, el p... | 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 |
<a href="https://colab.research.google.com/github/Tessellate-Imaging/monk_v1/blob/master/study_roadmaps/2_transfer_learning_roadmap/6_freeze_base_network/1.3)%20Understand%20the%20effect%20of%20freezing%20base%20model%20in%20transfer%20learning%20-%201%20-%20Keras.ipynb" target="_parent"><img src="https://colab.researc... | github_jupyter |
# Part 1: why objects?
Before we start getting into objects, let's establish a little toy problem.
```
Toy problem #1:
We want to store some information about some fruits.
There are only three products at our (crappy) supermarket, which are
- 10 apples, at 1 euro each, expire in 25 days
- 6 bananas, at 2 euros ea... | github_jupyter |
```
import tensorflow as tf
slim = tf.contrib.slim
import numpy as np
from IPython.display import clear_output
from sklearn.model_selection import train_test_split
from sklearn.utils import shuffle
# load and split train validation set
X = np.load('../data/features/data_x.npy')
Y = np.load('../data/features/data_y.npy'... | github_jupyter |
# Quantum Simulator:Cross-sell Recommender
This is a state of art quantum simulator-based solution that identifies the products that has a higher probability of purchase by a buyer based on the past purchase patterns. This solution helps businesses to achieve better cross-sell and improved customer life time value. Th... | github_jupyter |
---
_You are currently looking at **version 1.0** of this notebook. To download notebooks and datafiles, as well as get help on Jupyter notebooks in the Coursera platform, visit the [Jupyter Notebook FAQ](https://www.coursera.org/learn/python-data-analysis/resources/0dhYG) course resource._
---
# Merging Dataframes
... | github_jupyter |
# FloPy
### Lake Example
First set the path and import the required packages. The flopy path doesn't have to be set if you install flopy from a binary installer. If you want to run this notebook, you have to set the path to your own flopy path.
```
%matplotlib inline
import os
import sys
import numpy as np
import ma... | 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 |
```
import time
import os
import gzip
import pickle
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from torch.autograd import Variable
from torch.utils.data import DataLoader
from torchvision import datasets, transforms
```
## GAN
```
# 引数で指定したモデルの各層に対して特定の初期化を行う
def initialize_wei... | github_jupyter |
```
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
# matplotlib parameters to ensure correctness of Chinese characters
plt.rcParams["font.family"] = 'sans-serif'
plt.rcParams['font.sans-serif']=['Arial Unicode MS', 'SimHei'] # Chinese font
plt... | github_jupyter |
# Fully-Connected Neural Nets
In the previous homework you implemented a fully-connected two-layer neural network on CIFAR-10. The implementation was simple but not very modular since the loss and gradient were computed in a single monolithic function. This is manageable for a simple two-layer network, but would become... | github_jupyter |
# Off-policy Learning in Contextual Bandits
** *
This IPython notebook illustrates the usage of the [contextualbandits](https://www.github.com/david-cortes/contextualbandits) package's `offpolicy` module through a simulation with a public dataset.
**Small note: if the TOC here is not clickable or the math symbols ... | github_jupyter |
# Bayesian optimization
## Introduction
Many optimization problems in machine learning are black box optimization problems where the objective function $f(\mathbf{x})$ is a black box function<sup>[1][2]</sup>. We do not have an analytical expression for $f$ nor do we know its derivatives. Evaluation of the function ... | github_jupyter |
# EFF positions - baseline 01 vs baseline 02
This notebook compares time-stamps and positions of the Swarm EEFxTMS_2F product.
```
from numpy import asarray
from spacepy.pycdf import CDF, const
CDF_EPOCH_TYPE = const.CDF_EPOCH.value
CDF_EPOCH_1970 = 62167219200000.0
EEF_01_FILENAME = "SW_OPER_EEFATMS_2F_20160101T00... | github_jupyter |
# Dynamic Recurrent Neural Network.
TensorFlow implementation of a Recurrent Neural Network (LSTM) that performs dynamic computation over sequences with variable length. This example is using a toy dataset to classify linear sequences. The generated sequences have variable length.
- Author: Aymeric Damien
- Project: ... | github_jupyter |
# Part 5: Application using the Discretized Misfit calculation
By now, you should have looked through [Part 1](IntroductionToMetric.ipynb), [Part 2](IntroductionToResidual.ipynb) of the introductory notebook series, and [Part 3](OtherIO_options.ipynb) of the introductory notebook series. These introduced the umami `M... | github_jupyter |
# Character Sequence to Sequence
In this notebook, we'll build a model that takes in a sequence of letters, and outputs a sorted version of that sequence. We'll do that using what we've learned so far about Sequence to Sequence models. This notebook was updated to work with TensorFlow 1.1 and builds on the work of Dav... | github_jupyter |
# Import Basics
```
import pandas as pd
import numpy as np
from sklearn import metrics
from sklearn.model_selection import KFold
```
# Prepare Data
```
data = pd.read_csv(r"cm1.csv")
data = data.sample(frac = 1).reset_index(drop = True)
train = data.sample(frac = 0.7, random_state = 1)
test = data.loc[~data.index.i... | github_jupyter |
<a href="https://colab.research.google.com/github/NeuromatchAcademy/course-content/blob/master/tutorials/W3D4_ReinforcementLearning/student/W3D4_Tutorial1.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Tutorial 1: Learning to Predict
**Week 3, Da... | github_jupyter |
# Exploratory Data Analysis
First pass at analysing the output of blasting AML RNA-Seq data against the three tryptase sequences from Jonathon.
```
import pysam
import glob
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
def get_files(folder):
return glob.glob('{f... | github_jupyter |
## Daniel's comparison
```
import numpy as np
import pykat
import matplotlib.pyplot as plt
```
# Functions
Functions for doing the analytics:
```
# Speed of light
c = 299792458.0
# Propagation through vacuum
def space(phi, L, W=0):
return np.exp(-1j*W*L/c)*np.array([[np.cos(phi), -np.sin(phi)],
... | github_jupyter |
# Binary Classification using an SVM
We shall classify breast cancer as benign or malignant using a SVM built from scratch.
The dataset can be found [here](https://www.kaggle.com/uciml/breast-cancer-wisconsin-data).
```
# IMPORTS:
%matplotlib inline
from matplotlib import pyplot as plt
import numpy as np
import pan... | github_jupyter |
```
import glob, os
%matplotlib inline
import numpy as np
import IPython
from IPython.display import HTML
from matplotlib.ticker import FormatStrFormatter
import matplotlib.pyplot as plt
import matplotlib.ticker as mticker
import matplotlib
os.environ["CUDA_VISIBLE_DEVICES"]="0"
plt.rcParams.update({'font.size': 14}... | github_jupyter |
<img src="../../images/qiskit-heading.gif" alt="Note: In order for images to show up in this jupyter notebook you need to select File => Trusted Notebook" width="500 px" align="left">
# Quantum Process Tomography
* **Last Updated:** Feb 20, 2019
* **Requires:** qiskit-terra 0.7, qiskit-ignis 0.1, qiskit-aer 0.1
This... | github_jupyter |
# Quickstart
VIABEL currently supports both standard KL-based variational inference (KLVI) and chi-squared variational inference (CHIVI). Models are provided as Autograd-compatible log densities or can be constructed from PyStan fit objects.
As a simple example, we consider Neal's funnel distribution in 2 dimensions ... | github_jupyter |
# Analyzing Netflow Data with xGT
This sample script loads raw NetFlow data in an xGT graph structure and queries for a graph pattern.
The dataset used is from the CTU-13 open source project:
https://mcfp.weebly.com/the-ctu-13-dataset-a-labeled-dataset-with-botnet-normal-and-background-traffic.html
Raw data example:... | github_jupyter |
```
library(data.table)
library(Matrix)
library(proxy)
library(irlba)
library(umap)
library(data.table)
library(cowplot)
library(Matrix)
library(BuenColors)
library(scales)
library(SummarizedExperiment)
```
### Preprocess
```
df_count = readRDS('../../input/bonemarrow_noisy_p2.rds')
df_sample = read.table('../../inp... | github_jupyter |
CER041 - Install signed Knox certificate
========================================
This notebook installs into the Big Data Cluster the certificate signed
using:
- [CER031 - Sign Knox certificate with generated
CA](../cert-management/cer031-sign-knox-generated-cert.ipynb)
Steps
-----
### Parameters
```
app_na... | github_jupyter |
### Train with NeMo
[Neural Modules (NeMo)](https://nvidia.github.io/NeMo/index.html) is a framework-agnostic toolkit for building AI applications. It currently supports the PyTorch framework.
Using NeMo to train a PyTorch model is simple. In this notebook, we will demonstrate how to use NeMo to train the Asian Barri... | github_jupyter |
# Introduction to GANs - Notebook for Part 2
See the related medium article: **Comprehensive Introduction to Turing Learning and GANs: Part 2**
Link to article: https://medium.com/@matthew_stewart/comprehensive-introduction-to-turing-learning-and-gans-part-2-fd8e4a70775
**May 2019**<br>
**Author:** Matthew Stewart<b... | github_jupyter |
# No Fuss DML
Implementation of NCA Loss for Distance metric learning using Keras form : https://arxiv.org/pdf/1703.07464.pdf
Already applied it to various datasets, found it very useful especially when it's hard to mine hard negatives or triplets size is outrageously large.
The technique can produce high quality emb... | github_jupyter |
```
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow import keras
import scipy.io
import time
# Lets read our CFD results of lift-drag ratio data containing for different airfoils
data = scipy.io.loadmat('./data/1_300.mat')
# Seperating X, y values from the dictionary
X, y, r... | github_jupyter |
```
from finetwork.data_collector import FinData
from finetwork.transformer import MarketCycle, Split, NetTransformer
from finetwork.distance_calculator import CalculateDistance
from finetwork.clusterer import NetClusterer
from finetwork.optimiser import Validator, Optimiser
from finetwork.plotter import Plotter
impor... | github_jupyter |
# Grove RGB LED Stick module
---
## Aim
* This notebook illustrates how to use available APIs for the Grove RGB LED Stick module on PYNQ-Z2 PMOD and Arduino interfaces.
## References
* [Grove RGB LED Stick](https://www.seeedstudio.com/Grove-RGB-LED-Stick-10-WS2813-Mini.html)
* [PYNQ Grove Adapter](https://store... | github_jupyter |
# RadarCOVID-Report
## Data Extraction
```
import datetime
import json
import logging
import os
import shutil
import tempfile
import textwrap
import uuid
import matplotlib.pyplot as plt
import matplotlib.ticker
import numpy as np
import pandas as pd
import pycountry
import retry
import seaborn as sns
%matplotlib in... | github_jupyter |
# Example of integrating a network
This notebook illustrates how to create a python network and integrate
it with the scipy library.
```
import pynucastro as pyna
```
We'll start again with the basic CNO network explored earlier.
```
files = ["c12-pg-n13-ls09",
"c13-pg-n14-nacr",
"n13--c13-wc12",... | github_jupyter |
```
import pandas as pd
df_wines = pd.read_pickle("data/scraped/scraped_with_decs.pickle.gzip", compression='gzip')
print(df_wines.shape)
df_wines.head()
```
# Original Below
```
# Read data
DATA_PATH = 'data/scraped/names_prices_descriptions.pickle'
df_wines = pd.read_pickle(DATA_PATH)
# Clean pricing data
new_pric... | github_jupyter |
# Notebook Template
This Notebook is stubbed out with some project paths, loading of enviroment variables, and common package imports to speed up the process of starting a new project.
It is highly recommended you copy and rename this notebook following the naming convention outlined in the readme of naming notebooks... | github_jupyter |
# Navigating the Notebook - Instructor Script
To familiarise participants with the notebook environment, build up a simple notebook from scratch demonstrating the following operations:
- Insert & delete cells
- Change cell type (& know different cell types)
- Run a single cell from taskbar & keyboard shortcut (shift ... | github_jupyter |
<img src="https://github.com/pmservice/ai-openscale-tutorials/raw/master/notebooks/images/banner.png" align="left" alt="banner">
# IBM Watson OpenScale and Batch Processing:<br>Remote Spark
This notebook must be run in the Python 3.x runtime environment. It requires Watson OpenScale service credentials.
The notebook... | github_jupyter |
This notebook was prepared by [Donne Martin](http://donnemartin.com). Source and license info is on [GitHub](https://github.com/donnemartin/interactive-coding-challenges).
# Challenge Notebook
## Problem: Implement an algorithm to determine if a string has all unique characters.
* [Constraints](#Constraints)
* [Test... | github_jupyter |
```
from __future__ import division, print_function
```
## MNIST example
We will perform a simple analysis on MNIST to identify which pixels to erase to convert digits from one class into another class. We will compare importance scores computed using a variety of methods.
### Obtain data and keras model
We will load... | github_jupyter |
```
%load_ext autoreload
%autoreload 2
%matplotlib inline
from cbrain.imports import *
from cbrain.utils import *
from matplotlib.animation import FuncAnimation
from IPython.display import SVG, HTML
DATA_DIR = '/scratch/05488/tg847872/fluxbypass_aqua/'
ds = xr.open_mfdataset(DATA_DIR+'AndKua_aqua_SPCAM3.0_sp_fluxbp.cam... | github_jupyter |
<a href="https://colab.research.google.com/github/dafrie/fin-disclosures-nlp/blob/master/notebooks/CRO_Multi_Class_with_Transformers.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Multi-Class classification of Climate-related risks and opportunit... | github_jupyter |
# Dependencies
```
import os, warnings, shutil, re
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from transformers import AutoTokenizer
from sklearn.utils import shuffle
from sklearn.model_selection import StratifiedKFold
SEED = 0
warnings.filterwarnings("ignore")
pd.se... | github_jupyter |
```
%load_ext autoreload
%autoreload 2
%matplotlib inline
import numpy as np
import scipy
import menpo.io as mio
import scipy.io as sio
import functools
from pathlib import Path
from matplotlib import pyplot as plt
from menpo.image import Image
from menpo.shape import PointCloud
from menpofit.visualize import plot_cu... | github_jupyter |
```
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = 'all' # default is ‘last_expr'
%load_ext autoreload
%autoreload 2
import sys
sys.path.append('/home/mink/notebooks/CameraTraps') # append this repo to PYTHONPATH
sys.path.append('/home/mink/lib/ai4eutils')
import... | github_jupyter |
## What is Bias in ML?
- Bias is the error rate of your model on the training dataset.
- Bias is how much your model __under-fits__ the training data.
### How do you compute bias?
$$Bias = E[y_p - y_t]$$
Expected difference between predicted and observed
Bias is a learners' tendency to learn the wrong thing
----- ... | github_jupyter |
# A simple demo of reparameterizing the gamma distribution
First, check out our blog post for the complete scoop. Once you've read that, the
functions below will make sense.
```
import autograd.numpy as np
import autograd.numpy.random as npr
from autograd.scipy.special import gammaln, psi
from autograd import grad
f... | github_jupyter |
```
import cv2
import numpy as np
image = cv2.imread('./pictures/4shape.png')
cv2.imshow('Input Image',image)
cv2.waitKey(0)
gray = cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)
ret,thresh1 = cv2.threshold(gray,127,255,1)
contours,hierarchy = cv2.findContours(thresh1.copy(),cv2.RETR_LIST,cv2.CHAIN_APPROX_NONE)
cv2.drawContour... | github_jupyter |
```
import os
import cv2
import math
import warnings
import numpy as np
import pandas as pd
import seaborn as sns
import tensorflow as tf
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.metrics import confusion_matrix, fbeta_score
from keras import optimizers
from keras... | github_jupyter |
# Keras learning Rate Finder
> Automatically find optimal initial learning rate. See references.
- toc: true
- badges: true
- comments: true
- categories: [Keras]
- image: images/chart-preview.png
## 1. Automatical learning rate finder
Step 1: We start by defining an upper and lower bound on our learning rate. The... | github_jupyter |
# Implementing New Representations
As our solver treats objects very generally, implementing new representations is surprisingly easy. To implement a new [Representation](https://emlp.readthedocs.io/en/latest/package/emlp.solver.reps.html#emlp.reps.Rep) you need to implement a `rho(M)` which is a mapping from the grou... | github_jupyter |
# Använd riktig väderdata för att analysera hur temperaturen förändrats i Sverige de senaste 50 åren
I den här uppgiften kommer vi använda python för att analysera data som är jobbig att räkna på för hand.
Vi kommer att kolla på hur man kan använda data från filer i sitt program.
Om du inte vill använda Colaboratory ... | github_jupyter |
# Introducción a la sintaxis de Python
*En esta clase haremos una rápida introducción a la sintaxis de Python. Veremos cuáles son los tipos y estructuras básicas de este lenguaje. Seguro que ya has oído hablar mucho sobre las bondades de Python frente a otros lenguajes. Si no es así, échale un vistazo a [esto](http://... | github_jupyter |
# Read Colorado Medicaid Fee Schedules
The Colorado Department of Health Care Policy and Financing (HCPF) website for fee schedules is [here](https://www.colorado.gov/pacific/hcpf/provider-rates-fee-schedule).
* Fee schedules come in Excel format
* Fee schedules are biannual (January and July)
* Publicly available fe... | github_jupyter |
Lemiale et al 2008
=====
Shear banding analysis of plastic models formulated for incompressible viscous flows
-----
Uses underworld to simulate the deformation and failure of the lithosphere coupled with the mantle convection. Aim to reproduce the results for the angles of the shear bands for different initial param... | github_jupyter |
## Challenge 05: Quantum Machine Learning and Quantum Autoencoders
**_This challenge is brought to you by [@Shiro-Raven](https://github.com/Shiro-Raven) as a community contribution. Thank you!_**
In [Challenge 03](https://github.com/qosf/monthly-challenges/tree/main/challenge-2021.01-jan/challenge-2021.01-jan.ipynb),... | github_jupyter |
# Part 2: Logistic Regression
### Dataset
We will use the airline reviews dataset from https://github.com/quankiquanki/skytrax-reviews-dataset
```
import pandas as pd
df = pd.read_csv('data/airline.csv')
print(df.dtypes)
df.head()
```
To get total number of rows and check how much missing data we have.
```
print("A... | github_jupyter |
```
# -*- coding: utf-8 -*-
"""
Created on Sun august 13 12:35:39 2016
@author: Sidon
"""
%matplotlib inline
import pandas as pd
import numpy as np
from collections import OrderedDict
from tabulate import tabulate, tabulate_formats
import seaborn
import matplotlib.pyplot as plt
import scipy.stats
# bug fix for display... | github_jupyter |
## A quick example of the code for generating the mask for the North Atlantic (to be further used with fpost)
%matplotlib notebook
%load_ext autoreload
%autoreload 2
```
import sys
sys.path.append("../")
import pyfesom as pf
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
from matplotlib.col... | github_jupyter |
```
import PRF
from sklearn.ensemble import RandomForestClassifier
import numpy
X = numpy.load('data/bootstrap_X.npy')
y = numpy.load('data/bootstrap_y.npy')
y[y > 2] = 2
n_objects = X.shape[0]
n_features = X.shape[1]
print(n_objects, 'objects,', n_features, 'features')
shuffled_inds = numpy.random.choice(numpy.arang... | github_jupyter |
```
import os
from tensorflow.keras import layers
from tensorflow.keras import Model
!wget --no-check-certificate \
https://storage.googleapis.com/mledu-datasets/inception_v3_weights_tf_dim_ordering_tf_kernels_notop.h5 \
-O /tmp/inception_v3_weights_tf_dim_ordering_tf_kernels_notop.h5
from tensorflow.kera... | github_jupyter |
```
import pandas as pd
import numpy as np
import os
model_name = 'V100'
file_name = 'V100'
DATA_DIR = os.path.abspath("../../../prediction_model/data/raw_data")
SAVE_DIR = os.path.abspath("../../../prediction_model/data/")
```
## Dense Layer
```
dfDense = pd.read_pickle(os.path.join(DATA_DIR,'%s/0/benchmark_dense__2... | github_jupyter |
# Overview
- targetの情報を用いてgroupを作成する
- nb003では、696個にグルーピングした。
- all_target = 0 のグループがかなり多いのでそれを細かく分割しようと思う。
- how to
- group_0とgroup_not0分ける
- gourp_0を5fold, group_not0をgroup5foldする
- fold情報を合体させる
# Const
```
NB = '004'
PATH_TRAIN = '../data_ignore/input/train_features.csv'
PATH_TRAIN_SCORED = '../data_ig... | github_jupyter |
# Turbulence example
In this notebook we show how to perform a simulation using a soundspeed field based on a Gaussian turbulence spectrum.
```
import numpy as np
from pstd import PSTD, PML, Medium, Position2D, PointSource
from pstd import PSTD
from acoustics import Signal
from turbulence import Field2D, Gaussian2DTe... | github_jupyter |
# Distribute Filelist quotes back to invidual TXTs
```
filelist = """"""
print(filelist)
import os, codecs
wav_directory = r"/media/cookie/Samsung 860 QVO/ClipperDatasetV2/Anons/Rise Kujikawa"
for line in filelist.replace(";\n","\n").split("\n"):
path, quote, *_ = line.split("|")
filename = os.path.basename(pa... | github_jupyter |
# Creating an extension: prerequisites
* Click the **Not Trusted** button above to trust the notebook and enable command links.
* Follow along by [cloning the msbuild_ads_demo repo from github.com](https://github.com/kevcunnane/msbuild_ads_demo)
* Next <a href="command:workbench.action.installCommandLine">install az... | github_jupyter |
# Machine Learning with vaex.ml
If you want to try out this notebook with a live Python kernel, use mybinder:
<a class="reference external image-reference" href="https://mybinder.org/v2/gh/vaexio/vaex/latest?filepath=docs%2Fsource%2Ftutorial_ml.ipynb"><img alt="https://mybinder.org/badge_logo.svg" src="https://mybind... | github_jupyter |
# Practical: Data Analysis
In this assignment you will experiment with
- exploring the data collected at a home and a weather station around the Eindhoven area,
- building a predictive model for estimating the amount of electricity produced at the home given a weather forecast.
This notebook will guide you through t... | github_jupyter |
### Deeper Network Analysis
Now let us extract information from the popular cryptocurrency subreddits to find communities of influencial authors. We offer a list of top subreddits in the field, and then build a graph recursively.
Code adapted from: https://medium.com/social-media-theories-ethics-and-analytics/netwo... | github_jupyter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.