text stringlengths 2.5k 6.39M | kind stringclasses 3
values |
|---|---|
<i>Copyright (c) Microsoft Corporation. All rights reserved.</i>
<i>Licensed under the MIT License.</i>
# Evaluation
Evaluation with offline metrics is pivotal to assess the quality of a recommender before it goes into production. Usually, evaluation metrics are carefully chosen based on the actual application scena... | github_jupyter |
## <div style="text-align: center"> 20 ML Algorithms from start to Finish for Iris</div>
<div style="text-align: center"> I want to solve<b> iris problem</b> a popular machine learning Dataset as a comprehensive workflow with python packages.
After reading, you can use this workflow to solve other real problems and u... | github_jupyter |
# Writing Low-Level TensorFlow Code
**Learning Objectives**
1. Practice defining and performing basic operations on constant Tensors
2. Use Tensorflow's automatic differentiation capability
3. Learn how to train a linear regression from scratch with TensorFLow
## Introduction
In this notebook, we will start b... | github_jupyter |
# Simple Test between NumPy and Numba
$$
x = \exp(-\Gamma_s d)
$$
```
import numba
import cython
import numexpr
import numpy as np
%load_ext cython
from empymod import filters
from scipy.constants import mu_0 # Magn. permeability of free space [H/m]
from scipy.constants import epsilon_0 # Elec. permittivity o... | github_jupyter |
```
import argparse
import copy
import os
import os.path as osp
import pprint
import sys
import time
from pathlib import Path
import open3d.ml as _ml3d
import open3d.ml.tf as ml3d
import yaml
from open3d.ml.datasets import S3DIS, SemanticKITTI, SmartLab
from open3d.ml.tf.models import RandLANet
from open3d.ml.tf.pipel... | github_jupyter |
```
import numpy as np
import pandas as pd
import scipy
import pickle
import matplotlib.pyplot as plt
import seaborn as sns
import ipdb
```
# generate data
## 4 types of GalSim images
```
#### 1000 training images
with open("data/galsim_simulated_2500gals_lambda0.4_theta3.14159_2021-05-20-17-01.pkl", 'rb') as hand... | github_jupyter |
# Tracking Callbacks
```
from fastai.gen_doc.nbdoc import *
from fastai.vision import *
from fastai.callbacks import *
```
This module regroups the callbacks that track one of the metrics computed at the end of each epoch to take some decision about training. To show examples of use, we'll use our sample of MNIST and... | github_jupyter |
## Современные библиотеки градиентного бустинга
Ранее мы использовали наивную версию градиентного бустинга из scikit-learn, [придуманную](https://projecteuclid.org/download/pdf_1/euclid.aos/1013203451) в 1999 году Фридманом. С тех пор было предложено много реализаций, которые оказываются лучше на практике. На сегодняш... | github_jupyter |
```
%cd ../
from torchsignal.datasets import OPENBMI
from torchsignal.datasets.multiplesubjects import MultipleSubjects
from torchsignal.trainer.multitask import Multitask_Trainer
from torchsignal.model import MultitaskSSVEP
import numpy as np
import torch
import matplotlib.pyplot as plt
from matplotlib.pyplot import ... | github_jupyter |
```
# TODO
# 1. # of words
# 2. # of sensor types
# 3. how bag of words clustering works
# 4. how data feature classification works on sensor types
# 5. how data feature classification works on tag classification
# 6. # of unique sentence structure
import json
from functools import reduce
import os.path
import os
impor... | 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 |
Lambda School Data Science, Unit 2: Predictive Modeling
# Applied Modeling, Module 1
You will use your portfolio project dataset for all assignments this sprint.
## Assignment
Complete these tasks for your project, and document your decisions.
- [ ] Choose your target. Which column in your tabular dataset will you... | github_jupyter |
# Python Basics
## Variables
Python variables are untyped, i.e. no datatype is required to define a variable
```
x=10 # static allocation
print(x) # to print a variable
```
Sometimes variables are allocated dynamically during runtime by user input. Python not only creates a new variable on-demand, also, it assigns ... | github_jupyter |
```
import scipy.io as io
import matplotlib.pyplot as plt
import matplotlib.pylab as pylab
#Set up parameters for figure display
params = {'legend.fontsize': 'x-large',
'figure.figsize': (8, 10),
'axes.labelsize': 'x-large',
'axes.titlesize':'x-large',
'axes.labelweight': 'bold',
... | github_jupyter |
# sift down
```
# python3
class HeapBuilder:
def __init__(self):
self._swaps = [] #array of tuples or arrays
self._data = []
def ReadData(self):
n = int(input())
self._data = [int(s) for s in input().split()]
assert n == len(self._data)
def WriteResponse(self):
... | github_jupyter |
If you're opening this Notebook on colab, you will probably need to install 🤗 Transformers and 🤗 Datasets as well as other dependencies. Uncomment the following cell and run it.
```
#! pip install datasets transformers rouge-score nltk
```
If you're opening this notebook locally, make sure your environment has the ... | github_jupyter |
# Welcome to Python 101
<a href="http://pyladies.org"><img align="right" src="http://www.pyladies.com/assets/images/pylady_geek.png" alt="Pyladies" style="position:relative;top:-80px;right:30px;height:50px;" /></a>
Welcome! This notebook is appropriate for people who have never programmed before. A few tips:
- To ex... | github_jupyter |
# Part 4: Create an approximate nearest neighbor index for the item embeddings
This notebook is the fourth of five notebooks that guide you through running the [Real-time Item-to-item Recommendation with BigQuery ML Matrix Factorization and ScaNN](https://github.com/GoogleCloudPlatform/analytics-componentized-patterns... | github_jupyter |
# Day 24 - Cellular automaton
We are back to [cellar automatons](https://en.wikipedia.org/wiki/Cellular_automaton), in a finite 2D grid, just like [day 18 of 2018](../2018/Day%2018.ipynb). I'll use similar techniques, with [`scipy.signal.convolve2d()`](https://docs.scipy.org/doc/scipy-0.18.1/reference/generated/scipy.... | github_jupyter |
```
"""
Please run notebook locally (if you have all the dependencies and a GPU).
Technically you can run this notebook on Google Colab but you need to set up microphone for Colab.
Instructions for setting up Colab are as follows:
1. Open a new Python 3 notebook.
2. Import this notebook from GitHub (File -> Upload N... | github_jupyter |
# Quantum Counting
To understand this algorithm, it is important that you first understand both Grover’s algorithm and the quantum phase estimation algorithm. Whereas Grover’s algorithm attempts to find a solution to the Oracle, the quantum counting algorithm tells us how many of these solutions there are. This algori... | github_jupyter |
# CORD-19 overview
In this notebook, we provide an overview of publication medatata for CORD-19.
```
%matplotlib inline
import matplotlib.pyplot as plt
# magics and warnings
%load_ext autoreload
%autoreload 2
import warnings; warnings.simplefilter('ignore')
import os, random, codecs, json
import pandas as pd
import... | github_jupyter |
### 2.2 CNN Models - Test Cases
The trained CNN model was performed to a hold-out test set with 10,873 images.
The network obtained 0.743 and 0.997 AUC-PRC on the hold-out test set for cored plaque and diffuse plaque respectively.
```
import time, os
import torch
torch.manual_seed(42)
from torch.autograd import Var... | github_jupyter |
TSG023 - Get all BDC objects (Kubernetes)
=========================================
Description
-----------
Get a summary of all Kubernetes resources for the system namespace and
the Big Data Cluster namespace
Steps
-----
### Common functions
Define helper functions used in this notebook.
```
# Define `run` funct... | github_jupyter |
<a href="https://colab.research.google.com/github/araffin/rl-tutorial-jnrr19/blob/master/1_getting_started.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Stable Baselines Tutorial - Getting Started
Github repo: https://github.com/araffin/rl-tuto... | github_jupyter |
<img src="https://github.com/pmservice/ai-openscale-tutorials/raw/master/notebooks/images/banner.png" align="left" alt="banner">
# Working with Watson OpenScale - Custom Machine Learning Provider
This notebook should be run using with **Python 3.7.x** runtime environment. **If you are viewing this in Watson Studio an... | github_jupyter |
# ETS models
The ETS models are a family of time series models with an underlying state space model consisting of a level component, a trend component (T), a seasonal component (S), and an error term (E).
This notebook shows how they can be used with `statsmodels`. For a more thorough treatment we refer to [1], chapt... | github_jupyter |
## **Bootstrap Your Own Latent A New Approach to Self-Supervised Learning:** https://arxiv.org/pdf/2006.07733.pdf
```
# !pip install torch==1.6.0+cu101 torchvision==0.7.0+cu101 -f https://download.pytorch.org/whl/torch_stable.html
# !pip install -qqU fastai fastcore
# !pip install nbdev
import fastai, fastcore, torch
... | github_jupyter |
# Fitbit Data Analysis
## About Fitbit Data Analysis
This project provides some high-level data analysis of steps, sleep, heart rate and weight data from Fitbit tracking.
Please using fitbit_downloader file to first collect and export your data.
-------
### Dependencies and Libraries
```
import numpy as np
import... | github_jupyter |
# R API Serving Examples
In this example, we demonstrate how to quickly compare the runtimes of three methods for serving a model from an R hosted REST API. The following SageMaker examples discuss each method in detail:
* **Plumber**
* Website: [https://www.rplumber.io/](https://www.rplumber.io)
* SageMaker Exampl... | github_jupyter |
** Build Adjacency Matrix **
**Note:** You must put the generated JSON file into a zip file. We probably should code this in too.
```
import sqlite3
import json
# Progress Bar I found on the internet.
# https://github.com/alexanderkuk/log-progress
from progress_bar import log_progress
PLOS_PMC_DB = 'sqlite_data/data... | github_jupyter |
<a href="https://colab.research.google.com/github/skredenmathias/DS-Unit-2-Applied-Modeling/blob/master/module4/assignment_applied_modeling_1.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
Lambda School Data Science
*Unit 2, Sprint 3, Module 1*
-... | github_jupyter |
# KNN
Importing required python modules
---------------------------------
```
import matplotlib.pyplot as plt
from sklearn.neighbors import KNeighborsClassifier
from sklearn.cross_validation import train_test_split
from sklearn import metrics
from sklearn.preprocessing import normalize,scale
from sklearn.cross_valid... | github_jupyter |
# Jupyter Superpower - Extend SQL analysis with Python
> Making collboration with Notebook possible and share perfect SQL analysis with Notebook.
- toc: true
- badges: true
- comments: true
- author: noklam
- categories: ["python", "reviewnb", "sql"]
- hide: false
- canonical_url: https://blog.reviewnb.com/jupyter-s... | github_jupyter |
```
#Import Required Packages
import requests
import time
import schedule
import os
import json
import newspaper
from bs4 import BeautifulSoup
from datetime import datetime
from newspaper import fulltext
import newspaper
import pandas as pd
import numpy as np
import pickle
#Set Today's Date
#dates = [datetime.today().s... | github_jupyter |
Universidade Federal do Rio Grande do Sul (UFRGS)
Programa de Pós-Graduação em Engenharia Civil (PPGEC)
# PEC00144: Experimental Methods in Civil Engineering
### Reading the serial port of an Arduino device
---
_Prof. Marcelo M. Rocha, Dr.techn._ [(ORCID)](https://orcid.org/0000-0001-5640-1020)
_Porto Aleg... | github_jupyter |
```
%reload_ext autoreload
%autoreload 2
%matplotlib inline
from fastai.text import *
path = Path('./WikiTextTR')
path.ls()
LANG_FILENAMES = [str(f) for f in path.rglob("*/*")]
print(len(LANG_FILENAMES))
print(LANG_FILENAMES[:5])
LANG_TEXT = []
for i in LANG_FILENAMES:
try:
for line in open(i, encoding="utf... | github_jupyter |
```
import numpy as np
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
%matplotlib notebook
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
font = {'weight' : 'medium',
'size' : 13}
matplotlib.rc('font', **font)
import time
import concurrent.futures as cf
import warn... | github_jupyter |
# Data Analysis
# FINM September Launch
# Homework Solution 5
## Imports
```
import pandas as pd
import numpy as np
import statsmodels.api as sm
from sklearn.linear_model import LinearRegression
from sklearn.decomposition import PCA
from sklearn.cross_decomposition import PLSRegression
from numpy.linalg import svd
im... | github_jupyter |
# Training and Evaluating ACGAN Model
*by Marvin Bertin*
<img src="../../images/keras-tensorflow-logo.jpg" width="400">
# Imports
```
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import numpy as np
from collections import default... | github_jupyter |
# 自动微分
:label:`sec_autograd`
正如我们在 :numref:`sec_calculus`中所说的那样,求导是几乎所有深度学习优化算法的关键步骤。
虽然求导的计算很简单,只需要一些基本的微积分。
但对于复杂的模型,手工进行更新是一件很痛苦的事情(而且经常容易出错)。
深度学习框架通过自动计算导数,即*自动微分*(automatic differentiation)来加快求导。
实际中,根据我们设计的模型,系统会构建一个*计算图*(computational graph),
来跟踪计算是哪些数据通过哪些操作组合起来产生输出。
自动微分使系统能够随后反向传播梯度。
这里,*反向传播*(backpropagat... | github_jupyter |
# Rossman data preparation
To illustrate the techniques we need to apply before feeding all the data to a Deep Learning model, we are going to take the example of the [Rossmann sales Kaggle competition](https://www.kaggle.com/c/rossmann-store-sales). Given a wide range of information about a store, we are going to try... | github_jupyter |
* [1.0 - Introduction](#1.0---Introduction)
- [1.1 - Library imports and loading the data from SQL to pandas](#1.1---Library-imports-and-loading-the-data-from-SQL-to-pandas)
* [2.0 - Data Cleaning](#2.0---Data-Cleaning)
- [2.1 - Pre-cleaning, investigating data types](#2.1---Pre-cleaning,-investigatin... | github_jupyter |
```
import tensorflow as tf
import keras
import keras.backend as K
from sklearn.utils import shuffle
from sklearn.metrics import classification_report, confusion_matrix, accuracy_score, f1_score
from collections import Counter
from keras import regularizers
from keras.models import Sequential, Model, load_model, mo... | github_jupyter |
<figure>
<IMG SRC="https://raw.githubusercontent.com/mbakker7/exploratory_computing_with_python/master/tudelft_logo.png" WIDTH=250 ALIGN="right">
</figure>
# Exploratory Computing with Python
*Developed by Mark Bakker*
## Notebook 9: Discrete random variables
In this Notebook you learn how to deal with discrete ran... | github_jupyter |
Lambda School Data Science
*Unit 2, Sprint 3, Module 3*
---
# Permutation & Boosting
- Get **permutation importances** for model interpretation and feature selection
- Use xgboost for **gradient boosting**
### Setup
Run the code cell below. You can work locally (follow the [local setup instructions](https://lambd... | github_jupyter |
# Partial Correlation
The purpose of this notebook is to understand how to compute the [partial correlation](https://en.wikipedia.org/wiki/Partial_correlation) between two variables, $X$ and $Y$, given a third $Z$. In particular, these variables are assumed to be guassians (or, in general, multivariate gaussians).
W... | github_jupyter |
```
# Purpose: Analyze results from Predictions Files created by Models
# Inputs: Prediction files from Random Forest, Elastic Net, XGBoost, and Team Ensembles
# Outputs: Figures (some included in the paper, some in SI)
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import ... | github_jupyter |
# Benchmarking the Permanent
This tutorial shows how to use the permanent function using The Walrus, which calculates the permanent using Ryser's algorithm
### The Permanent
The permanent of an $n$-by-$n$ matrix A = $a_{i,j}$ is defined as
$\text{perm}(A)=\sum_{\sigma\in S_n}\prod_{i=1}^n a_{i,\sigma(i)}.$
The sum ... | github_jupyter |
```
#@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 agreed to in writing, software
# distributed u... | github_jupyter |
```
from keras import applications
# python image_scraper.py "yellow labrador retriever" --count 500 --label labrador
from keras.preprocessing.image import ImageDataGenerator
from keras_tqdm import TQDMNotebookCallback
from keras import optimizers
from keras.models import Sequential, Model
from keras.layers import (... | github_jupyter |
# Applying GrandPrix on the cell cycle single cell nCounter data of PC3 human prostate cancer
_Sumon Ahmed_, 2017, 2018
This notebooks describes how GrandPrix with informative prior over the latent space can be used to infer the cell cycle stages from the single cell nCounter data of the PC3 human prostate cancer cell... | github_jupyter |
# Sequences
## `sequence.DNA`
`coral.DNA` is the core data structure of `coral`. If you are already familiar with core python data structures, it mostly acts like a container similar to lists or strings, but also provides further object-oriented methods for DNA-specific tasks, like reverse complementation. Most desig... | github_jupyter |
```
import os
os.chdir('C:\\Users\\SHAILESH TIWARI\\Downloads\\Classification\\hr')
%matplotlib inline
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
train = pd.read_csv('train.csv')
# getting their shapes
print("Shape of train :", train.shape)
#print("Shape of test :", tes... | github_jupyter |
# 3. Image-Similar-FCNN-Binary
For landmark-recognition-2019 algorithm validation
## Run name
```
import time
project_name = 'Dog-Breed'
step_name = '3-Image-Similar-FCNN-Binary'
time_str = time.strftime("%Y%m%d-%H%M%S", time.localtime())
run_name = project_name + '_' + step_name + '_' + time_str
print('run_name: ' ... | github_jupyter |
# Support Vector Machine
```
from PIL import Image
import numpy as np
%matplotlib inline
import matplotlib
import matplotlib.pyplot as plt
from sklearn import datasets, svm, linear_model
matplotlib.style.use('bmh')
matplotlib.rcParams['figure.figsize']=(10,10)
```
### 2D Linear
```
# Random 2d X
X0 = np.random.norma... | github_jupyter |
```
import sys
import numpy as np
```
# Numpy
Numpy proporciona un nuevo contenedor de datos a Python, los `ndarray`s, además de funcionalidad especializada para poder manipularlos de forma eficiente.
Hablar de manipulación de datos en Python es sinónimo de Numpy y prácticamente todo el ecosistema científico de Pyth... | github_jupyter |
### Processing Echosounder Data from Ocean Observatories Initiative with `echopype`.
Downloading a file from the OOI website. We pick August 21, 2017 since this was the day of the solar eclipse which affected the traditional patterns of the marine life.
```
# downloading the file
!wget https://rawdata.oceanobservator... | github_jupyter |
Variables with more than one value
==================================
You have already seen ordinary variables that store a single value. However other variable types can hold more than one value. The simplest type is called a list. Here is a example of a list being used:
```
which_one = int(input("What month (1-12... | github_jupyter |
# Control of a hydropower dam
Consider a hydropower plant with a dam. We want to control the flow through the dam gates in order to keep the amount of water at a desired level.
<p><img src="hydropowerdam-wikipedia.png" alt="Hydro power from Wikipedia" width="400"></p>
The system is a typical integrator, and is given ... | github_jupyter |
```
import warnings
warnings.filterwarnings('ignore')
import nltk
nltk.download('stopwords')
nltk.download('punkt')
nltk.download('wordnet')
from nltk.corpus import stopwords
import pandas as pd
import numpy as np
from glove import Glove
from sklearn.preprocessing import LabelEncoder
from sklearn import metrics
from ... | github_jupyter |
```
# https://community.plotly.com/t/different-colors-for-bars-in-barchart-by-their-value/6527/7
%reset
# Run this app with `python app.py` ando
# visit http://127.0.0.1:8050/ in your web browser.
import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.express as px
import jupy... | github_jupyter |
# Hawaii - A Climate Analysis And Exploration
### For data between August 23, 2016 - August 23, 2017
---
```
# Import dependencies
%matplotlib inline
from matplotlib import style
style.use('fivethirtyeight')
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import datetime as dt
# Python SQL tool... | github_jupyter |
```
import os
import glob
base_dir = os.path.join('F:/0Sem 7/B.TECH PROJECT/0Image data/cell_images')
infected_dir = os.path.join(base_dir,'Parasitized')
healthy_dir = os.path.join(base_dir,'Uninfected')
infected_files = glob.glob(infected_dir+'/*.png')
healthy_files = glob.glob(healthy_dir+'/*.png')
print("Infected sa... | 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 pandas as pd
import numpy as np
import h5py
import matplotlib.pyplot as plt
import scipy
from PIL import Image
from scipy import ndimage
#from dnn_app_utils_v2 import *
import pandas as pd
%matplotlib inline
from pandas import ExcelWriter
from pandas import ExcelFile
%load_ext autoreload
%autoreload 2
from s... | github_jupyter |
# LKJ Cholesky Covariance Priors for Multivariate Normal Models
While the [inverse-Wishart distribution](https://en.wikipedia.org/wiki/Inverse-Wishart_distribution) is the conjugate prior for the covariance matrix of a multivariate normal distribution, it is [not very well-suited](https://github.com/pymc-devs/pymc3/is... | github_jupyter |
# Forecasting on Contraceptive Use - A Multi-step Ensemble Approach¶
Update: 09/07/2020
Github Repository: https://github.com/herbsh/USAID_Forecast_submit
## key idea
- The goal is to forecast on site_code & product_code level demand.
- The site_code & product_code level demand fluctuates too much and doesn't hav... | github_jupyter |
# Data Visualization With Safas
This notebook demonstrates plotting the results from Safas video analysis.
## Import modules and data
Import safas and other components for display and analysis. safas has several example images in the safas/data directory. These images are accessible as attributes of the data module... | github_jupyter |
```
from sys import modules
IN_COLAB = 'google.colab' in modules
if IN_COLAB:
!pip install -q ir_axioms[examples] python-terrier
# Start/initialize PyTerrier.
from pyterrier import started, init
if not started():
init(tqdm="auto", no_download=True)
from pyterrier.datasets import get_dataset, Dataset
# Load d... | github_jupyter |
```
# -*- coding: utf-8 -*-
"""
EVCのためのEV-GMMを構築します. そして, 適応学習する.
詳細 : https://pdfs.semanticscholar.org/cbfe/71798ded05fb8bf8674580aabf534c4dbb8bc.pdf
This program make EV-GMM for EVC. Then, it make adaptation learning.
Check detail : https://pdfs.semanticscholar.org/cbfe/71798ded05fb8bf8674580abf534c4dbb8bc.pdf
"""
... | github_jupyter |
Code:<a href="https://github.com/lotapp/BaseCode" target="_blank">https://github.com/lotapp/BaseCode</a>
多图旧排版:<a href="https://www.cnblogs.com/dunitian/p/9119986.html" target="_blank">https://www.cnblogs.com/dunitian/p/9119986.html</a>
在线编程:<a href="https://mybinder.org/v2/gh/lotapp/BaseCode/master" target="_blank">... | github_jupyter |
## Importing and mapping netCDF data with xarray and cartopy
- Read data from a netCDF file with xarray
- Select (index) and modify variables using xarray
- Create user-defined functions
- Set up map features with cartopy (lat/lon tickmarks, continents, country/state borders); create a function to automate these steps... | github_jupyter |
# Add external catalog for source matching: allWISE catalog
This notebook will create a dabase containing the allWISE all-sky mid-infrared catalog. As the catalogs grows (the allWISE catalog we are inserting contains of the order of hundreds of millions sources), using an index on the geoJSON corrdinate type to suppor... | github_jupyter |
<a id="title_ID"></a>
# JWST Pipeline Validation Testing Notebook: spec2, extract_2d step
<span style="color:red"> **Instruments Affected**</span>: NIRSpec
Tested on CV3 data
### Table of Contents
<div style="text-align: left">
<br> [Imports](#imports_ID) <br> [Introduction](#intro_ID) <br> [Testing Data Set](#da... | github_jupyter |
# Pump Calculations
```
import numpy as np
```
## Power Input
```
#Constants and inputs
g = 32.174; #gravitational acceleration, ft/s^2
rho_LOx = 71.27; #Density of Liquid Oxygen- lbm/ft^3
rho_LCH4 = 26.3; #Density of Liquid Methane- lbm/ft^3
Differential = #Desired pressure differential (psi)
mLOx = #Mass flow of... | github_jupyter |
```
import numpy as np
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
from functools import partial
n_inputs = 28*28
n_hidden1 = 100
n_hidden2 = 100
n_hidden3 = 100
n_hidden4 = 100
n_hidden5 = 100
n_outputs = 5
# Let's define the placeholders for the inputs and the targets
X = tf.pl... | github_jupyter |
# LB-Colloids Colloid particle tracking
LB-Colloids allows the user to perform colloid and nanoparticle tracking simulations on Computational Fluid Dynamics domains. As the user, you supply the chemical and physical properties, and the code performs the mathematics and particle tracking!
Let's set up our workspace to... | github_jupyter |
```
import os
path = '/home/yash/Desktop/tensorflow-adversarial/tf_example'
os.chdir(path)
# supress tensorflow logging other than errors
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import numpy as np
import tensorflow as tf
from tensorflow.contrib.learn import ModeKeys, Estimator
import matplotlib
matplotlib.use('Agg')
... | github_jupyter |
```
import ipywidgets
tabs = ipywidgets.Tab()
tabs.children = [ipywidgets.Label(value='tab1'), ipywidgets.Label(value='tab2'), ipywidgets.Label(value='tab3'), ipywidgets.Label(value='tab4')]
tabs.observe(lambda change: print(f"selected index: {change['new']}") , names='selected_index')
def change_children(_):
id ... | github_jupyter |
# Home Credit Default Risk
Can you predict how capable each applicant is of repaying a loan?
Many people struggle to get loans due to **insufficient or non-existent credit histories**. And, unfortunately, this population is often taken advantage of by untrustworthy lenders.
Home Credit strives to broaden financial i... | github_jupyter |
```
library(repr) ; options(repr.plot.width = 5, repr.plot.height = 6) # Change plot sizes (in cm)
```
# Bootstrapping using rTPC package
## Introduction
In this Chapter we will work through an example of model fitting using the rTPC package in R. This references the previous chapters' work, especially [Model Fitting... | github_jupyter |
# Targeting Direct Marketing with Amazon SageMaker XGBoost
_**Supervised Learning with Gradient Boosted Trees: A Binary Prediction Problem With Unbalanced Classes**_
---
## Background
Direct marketing, either through mail, email, phone, etc., is a common tactic to acquire customers. Because resources and a customer'... | github_jupyter |
# Machine Learning
## Types of learning
- Whether or not they are trained with human supervision (supervised, unsupervised, semisupervised, and Reinforcement Learning)
- Whether or not they can learn incrementally on the fly (online versus batch learning)
- Whether they work by simply comparing new data points to know... | github_jupyter |
<img src="https://raw.githubusercontent.com/Qiskit/qiskit-tutorials/master/images/qiskit-heading.png" 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">
## _*Superposition*_
The latest version of this notebook is available on ... | github_jupyter |
### Image Classification - Conv Nets -Pytorch
> Classifying if an image is a `bee` of an `ant` using `ConvNets` in pytorch
### Imports
```
import cv2
import matplotlib.pyplot as plt
import numpy as np
from sklearn.model_selection import train_test_split
import torch
from torch import nn
import torch.nn.functional as... | github_jupyter |
# Using Models as Layers in Another Model
In this notebook, we show how you can use Keras models as Layers within a larger model and still perform pruning on that model.
```
# Import required packages
import tensorflow as tf
import mann
from sklearn.metrics import confusion_matrix, classification_report
# Load the ... | github_jupyter |
```
import pathlib
import lzma
import re
import os
import datetime
import copy
import functools
import numpy as np
import pandas as pd
# Makes it so any changes in pymedphys is automatically
# propagated into the notebook without needing a kernel reset.
from IPython.lib.deepreload import reload
%load_ext autoreload
%a... | github_jupyter |
# Transform JD text files into an LDA model and pyLDAvis visualization
### Steps:
1. Use spaCy phrase matching to identify skills
2. Parse the job descriptions. A full, readable job description gets turned into a bunch of newline-delimited skills.
3. Create a Gensim corpus and dictionary from the parsed skills
4. Trai... | github_jupyter |
# Unconstrainted optimization with NN models
In this tutorial we will go over type 1 optimization problem which entails nn.Module rerpesented cost function and __no constarint__ at all. This type of problem is often written as follows:
$$ \min_{x} f_{\theta}(x) $$
we can find Type1 problems quite easily. For instance... | github_jupyter |
# Function Practice Exercises
Problems are arranged in increasing difficulty:
* Warmup - these can be solved using basic comparisons and methods
* Level 1 - these may involve if/then conditional statements and simple methods
* Level 2 - these may require iterating over sequences, usually with some kind of loop
* Chall... | github_jupyter |
*This notebook contains an excerpt from the [Whirlwind Tour of Python](http://www.oreilly.com/programming/free/a-whirlwind-tour-of-python.csp) by Jake VanderPlas; the content is available [on GitHub](https://github.com/jakevdp/WhirlwindTourOfPython).*
*The text and code are released under the [CC0](https://github.com/... | github_jupyter |
<!-- :Author: Arthur Goldberg <Arthur.Goldberg@mssm.edu> -->
<!-- :Date: 2020-08-02 -->
<!-- :Copyright: 2020, Karr Lab -->
<!-- :License: MIT -->
# DE-Sim: Ordering simultaneous events
DE-Sim makes it easy to build and simulate discrete-event models.
This notebook discusses DE-Sim's methods for controlling the execut... | github_jupyter |
```
%matplotlib inline
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import cm
import pandas as pd
import matplotlib as mpl
mpl.rcParams['text.usetex'] = True
mpl.rcParams['text.latex.unicode'] = True
blues = cm.get_cmap(plt.get_cmap('Blues'))
greens = cm.get_cmap(plt.get_cmap('Greens'))
reds... | github_jupyter |
# HandGestureDetection using OpenCV
This code template is for Hand Gesture detection in a video using OpenCV Library.
### Required Packages
```
!pip install opencv-python
!pip install mediapipe
import cv2
import mediapipe as mp
import time
```
### Hand Detection
For detecting hands in the image, we use the detectM... | github_jupyter |
The purpose of this notebook is to convert the wide-format car data to long-format. The car data comes from the mlogit package. The data description is reproduced below. Note the data originally comes from McFadden and Train (2000).
#### Description
- Cross-Sectional Dataset
- Number of Observations: 4,654
- Unit of O... | github_jupyter |
# Score for the Fed's dual mandate
The U.S. Congress established three key objectives for monetary policy
in the Federal Reserve Act: *Maximum employment, stable prices*, and
moderate long-term interest rates. The first two objectives are
sometimes referred to as the Federal Reserve's **dual mandate**.
Here we ex... | github_jupyter |
# <center>Welcome to Supervised Learning</center>
## <center>Part 2: How to prepare your data for supervised machine learning</center>
## <center>Instructor: Andras Zsom</center>
### <center>https://github.com/azsom/Supervised-Learning<center>
## The topic of the course series: supervised Machine Learning (ML)
- how t... | github_jupyter |
## 2. Random Forest
### a)
```
import pandas as pd
headers = ["Number of times pregnant",
"Plasma glucose concentration a 2 hours in an oral glucose tolerance test",
"Diastolic blood pressure (mm Hg)",
"Triceps skinfold thickness (mm)",
"2-Hour serum insulin (mu U/ml)",
... | github_jupyter |
# Similarity Encoders with Keras
## using the model definition from `simec.py`
```
from __future__ import unicode_literals, division, print_function, absolute_import
from builtins import range
import numpy as np
np.random.seed(28)
import matplotlib.pyplot as plt
from sklearn.manifold import Isomap
from sklearn.decompo... | github_jupyter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.