code stringlengths 2.5k 150k | kind stringclasses 1
value |
|---|---|
```
%load_ext autoreload
%autoreload 2
import numpy as np
import random
import torch
from collections import defaultdict
from scipy.sparse import csr_matrix
from sklearn.cluster import AgglomerativeClustering
from tqdm.auto import tqdm
from src.data.filesystem import fopen
from src.data.ancestry import load_train_test... | 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 |
```
#hide
#skip
! [ -e /content ] && pip install -Uqq fastai # upgrade fastai on colab
# default_exp losses
# default_cls_lvl 3
#export
from fastai.imports import *
from fastai.torch_imports import *
from fastai.torch_core import *
from fastai.layers import *
#hide
from nbdev.showdoc import *
```
# Loss Functions
> C... | 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">
# Qiskit Tutorials
***
Welcome Qiskitters.
The easiest way to get started is to use [the Binder image](https://mybinder.org/v2/gh/qiskit/... | github_jupyter |
```
# HIDDEN
from datascience import *
%matplotlib inline
import matplotlib.pyplot as plots
plots.style.use('fivethirtyeight')
import math
import numpy as np
from scipy import stats
import ipywidgets as widgets
import nbinteract as nbi
```
### The Central Limit Theorem ###
Very few of the data histograms that we have ... | github_jupyter |
# Plotting aggregate variables
Pyam offers many great visualisation and analysis tools. In this notebook we highlight the `aggregate` and `stack_plot` methods of an `IamDataFrame`.
```
import numpy as np
import pandas as pd
import pyam
%matplotlib inline
import matplotlib.pyplot as plt
```
Here we provide some samp... | github_jupyter |
Author: Saeed Amen (@thalesians) - Managing Director & Co-founder of [the Thalesians](http://www.thalesians.com)
## Introduction
With the UK general election in early May 2015, we thought it would be a fun exercise to demonstrate how you can investigate market price action over historial elections. We shall be using ... | github_jupyter |
# Introduction to Bayesian Optimization with GPyOpt
### Written by Javier Gonzalez, Amazon Research Cambridge
*Last updated Monday, 22 May 2017.*
=====================================================================================================
1. **How to use GPyOpt?**
2. **The Basics of Bayesian Optimization... | github_jupyter |
<a href="https://colab.research.google.com/github/Cloblak/aipi540_deeplearning/blob/main/1D_CNN_Attempts/1D_CNN_asof_111312FEB.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
```
!pip install alpaca_trade_api
```
Features To Consider
- Targets are... | github_jupyter |
# Spark on Kubernetes
Preparing the notebook https://towardsdatascience.com/make-kubeflow-into-your-own-data-science-workspace-cc8162969e29
## Setup service account permissions
https://github.com/kubeflow/kubeflow/issues/4306 issue with launching spark-operator from jupyter notebook
Run command in your shell (not i... | github_jupyter |
```
from Maze import Maze
from sarsa_agent import SarsaAgent
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import animation
from IPython.display import HTML
```
## Designing the maze
```
arr=np.array([[0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0],
[0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,... | github_jupyter |
## VAE MNIST example: BO in a latent space
In this tutorial, we use the MNIST dataset and some standard PyTorch examples to show a synthetic problem where the input to the objective function is a `28 x 28` image. The main idea is to train a [variational auto-encoder (VAE)](https://arxiv.org/abs/1312.6114) on the MNIST... | github_jupyter |
```
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import matplotlib
%matplotlib inline
matplotlib.rcParams['figure.figsize'] = (12, 8) # set default figure size, 8in by 6in
```
# Ensemble Learning
Sometimes aggregrates or ensembles of many different opinions on a question can perform as well ... | github_jupyter |
<a href="https://colab.research.google.com/github/NeuromatchAcademy/course-content/blob/master/tutorials/W1D2_ModelingPractice/student/W1D2_Tutorial2.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Neuromatch Academy: Week1, Day 2, Tutorial 2
#Tu... | github_jupyter |
# Welcome to nbdev
> Create delightful python projects using Jupyter Notebooks
- image:images/nbdev_source.gif
`nbdev` is a library that allows you to develop a python library in [Jupyter Notebooks](https://jupyter.org/), putting all your code, tests and documentation in one place. That is: you now have a true [liter... | github_jupyter |
# Study Path And Where To Find Resources
**Author: Yulun Wu**
Welcome aboard!
AI is one of the most prospective fields today. Personally I believe AI technology will start a technology revolution and totally revamp the world as well as our lives.
The definition of AI is broad, in AIwaffle Courses, *AI*, *Machine Le... | github_jupyter |
```
from nbdev import *
%nbdev_default_export merge
#export
from nbdev.imports import *
```
# Fix merge conflicts
> Fix merge conflicts in jupyter notebooks
When working with jupyter notebooks (which are json files behind the scenes) and GitHub, it is very common that a merge conflict (that will add new lines in the... | github_jupyter |
<a href="https://colab.research.google.com/github/Ivan-Nebogatikov/HumanActivityRecognitionOutliersDetection/blob/main/Processing.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
Скачиваем данные, преобразуем их в одну таблицу
```
import numpy as np... | github_jupyter |
# SF Salaries Exercise - Solutions
Welcome to a quick exercise for you to practice your pandas skills! We will be using the [SF Salaries Dataset](https://www.kaggle.com/kaggle/sf-salaries) from Kaggle! Just follow along and complete the tasks outlined in bold below. The tasks will get harder and harder as you go along... | github_jupyter |
$\newcommand{\xv}{\mathbf{x}}
\newcommand{\wv}{\mathbf{w}}
\newcommand{\yv}{\mathbf{y}}
\newcommand{\zv}{\mathbf{z}}
\newcommand{\uv}{\mathbf{u}}
\newcommand{\vv}{\mathbf{v}}
\newcommand{\Chi}{\mathcal{X}}
\newcommand{\R}{\rm I\!R}
\newcommand{\sign}{\text{sign}}
\newcommand{\Tm}{\mathbf{T}}
\newcommand{\Xm}{... | github_jupyter |
# GOOGLE PLAYSTORE ANALYSIS
The dataset used in this analysis is taken from [kaggle datasets](https://www.kaggle.com/datasets)
In this analysis we took a raw data which is in csv format and then converted it into a dataframe.Performed some operations, cleaning of the data and finally visualizing some necessary conclu... | github_jupyter |
_Lambda School Data Science_
# Make explanatory visualizations
Tody we will reproduce this [example by FiveThirtyEight:](https://fivethirtyeight.com/features/al-gores-new-movie-exposes-the-big-flaw-in-online-movie-ratings/)
```
from IPython.display import display, Image
url = 'https://fivethirtyeight.com/wp-cont... | github_jupyter |
# Exam 2 - Gema Castillo García
```
%load_ext sql
%config SqlMagic.autocommit=True
%sql mysql+pymysql://root:root@127.0.0.1:3306/mysql
```
## Problem 1: Controls
Write a Python script that proves that the lines of data in Germplasm.tsv, and LocusGene are in the same sequence, based on the AGI Locus Code (ATxGxxxxx... | github_jupyter |
# Quick Multi-Processing Tests
```
import numpy as np
import matplotlib.pyplot as plt
from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor
import time
import numba
import pandas as pd
import pyspark
from pyspark.sql import SparkSession
```
Defining a an arbitrary function for testing. The function ... | github_jupyter |
```
# Import the libraries
import numpy as np
import pandas as pd
import os
import seaborn as sns
import matplotlib.pyplot as plt
import warnings
import numpy as np
import itertools
import statsmodels.api as sm
import matplotlib
from textwrap import wrap
from matplotlib import ticker
from datetime import datetime
war... | github_jupyter |
# Bayesian Randomized Benchmarking Demo
This is a bayesian pyMC3 implementation on top of frequentist interleaved RB from qiskit experiments
Based on this [WIP tutorial](https://github.com/Qiskit/qiskit-experiments/blob/main/docs/tutorials/rb_example.ipynb)
on july 10 2021
```
import numpy as np
import copy
import... | github_jupyter |
<a href="https://colab.research.google.com/github/DSNortsev/CSE-694-Case-Studies-in-Deep-Learning/blob/master/HW2/HW2.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
```
import seaborn as sns
import pandas as pd
import matplotlib.pyplot as plt
from ... | github_jupyter |
```
import numpy as np
import xarray as xr
import math
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
import os
import f90nml
from salishsea_tools import metric_tools_5x5 as met
%matplotlib inline
plt.rcParams['image.cmap'] = 'jet'
plt.rc('xtick', labelsize=20)
plt.rc('ytick', labelsize=20)... | github_jupyter |
# Plagiarism Detection, Feature Engineering
In this project, you will be tasked with building a plagiarism detector that examines an answer text file and performs binary classification; labeling that file as either plagiarized or not, depending on how similar that text file is to a provided, source text.
Your first ... | github_jupyter |
# **Optimización - Actividad 3**

* Estudiante: Alejandro Jesús Manotas Marmolejo
* Código: 200108289
# **Pregunta 1.**
Considere $N$ funciones convexas $f_i(x):\Re\Rightarrow \Re$, para $1 \le i \le N$, demuestre ... | github_jupyter |
... ***CURRENTLY UNDER DEVELOPMENT*** ...
## Obtain synthetic waves and water level timeseries under a climate change scenario (future AWTs occurrence probability)
inputs required:
* Historical DWTs (for plotting)
* Historical wave families (for plotting)
* Synthetic DWTs climate change
* Historical intrada... | github_jupyter |
# Strings in Python
## What is a string?
A "string" is a series of characters of arbitrary length.
Strings are immutable - they cannot be changed once created. When you modify a string, you automatically make a copy and modify the copy.
```
s1 = 'Godzilla'
print s1, s1.upper(), s1
```
## String literals
A "literal... | github_jupyter |
# Intel® Distribution for GDB*
In this notebook, we will cover using the Intel® Distribution for GDB* to debug oneAPI applications on the GPU.
##### Sections
- [Intel Distribution for GDB Overview](#Intel-Distribution-for-GDB-Overview)
- [How does the Intel Distribution for GDB debug GPUs?](#How-does-Intel-Distributi... | github_jupyter |
# RefAssig V0.0
this is my faster simple version of the PMI and Abstract gene count scoring system.
Improvements:
* rapid access
* streamlined function calls
* clean data output
* xml abstract data parsing
---
## 1.0 Libraries and input
The work flow looks like this:
1. read in a list of chemicals as a csv with a ... | github_jupyter |
# Cyclical Systems: An Example of the Crank-Nicolson Method
## CH EN 2450 - Numerical Methods
**Prof. Tony Saad (<a>www.tsaad.net</a>) <br/>Department of Chemical Engineering <br/>University of Utah**
<hr/>
```
import numpy as np
from numpy import *
# %matplotlib notebook
# %matplotlib nbagg
%matplotlib inline
%config... | github_jupyter |
# Unsupervised neural computation - Practical
Dependencies:
- Python (>= 2.6 or >= 3.3)
- NumPy (>= 1.6.1)
- SciPy (>= 0.12)
- SciKit Learn (>=0.18.1)
Just as there are different ways in which we ourselves learn from our own surrounding environments, so it is with neural networks. In a broad sense, we may categorize ... | github_jupyter |
# 2021-05-10 Daily Practice
- [x] Practice
- [ ] SQL
- [x] Algorithms
- [ ] Solve + Design
- [ ] Learn
- [ ] Write
- [ ] Build
---
## Practice
- [x] https://leetcode.com/problems/reverse-integer/
- [x] https://leetcode.com/problems/longest-common-prefix/
- [x] https://leetcode.com/problems/maximum-subarray/
-... | github_jupyter |
<table class="ee-notebook-buttons" align="left">
<td><a target="_parent" href="https://github.com/giswqs/geemap/tree/master/tutorials/Image/06_convolutions.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td>
<td><a target="_parent" href="https:... | github_jupyter |
<h1 align="center">Theano</h1>
```
!pip install numpy matplotlib
!pip install --upgrade https://github.com/Theano/Theano/archive/master.zip
!pip install --upgrade https://github.com/Lasagne/Lasagne/archive/master.zip
```
### Разминка
```
import theano
import theano.tensor as T
%pylab inline
```
#### будущий пар... | github_jupyter |
查看当前GPU信息
```
from tensorflow.python.client import device_lib
device_lib.list_local_devices()
!pip install bert-tensorflow
import pandas as pd
import tensorflow as tf
import tensorflow_hub as hub
import pickle
import bert
from bert import run_classifier
from bert import optimization
from bert import tokenization
def ... | github_jupyter |
# Anna KaRNNa
In this notebook, I'll build a character-wise RNN trained on Anna Karenina, one of my all-time favorite books. It'll be able to generate new text based on the text from the book.
This network is based off of Andrej Karpathy's [post on RNNs](http://karpathy.github.io/2015/05/21/rnn-effectiveness/) and [i... | github_jupyter |
## Change sys.path to use my tensortrade instead of the one in env
```
import sys
sys.path.append("/Users/jasonfiacco/Documents/Yale/Senior/thesis/deeptrader")
print(sys.path)
```
## Read PredictIt Data Instead
```
import ssl
import pandas as pd
ssl._create_default_https_context = ssl._create_unverified_context # O... | github_jupyter |
## 1. Convert pdf to image
```
## NOTE: install tesseract (https://github.com/UB-Mannheim/tesseract/wiki) and Poppler first
# !pip install pytesseract
# !pip install Pillow
# !pip install pdf2image
# import statements
from PIL import Image
from pdf2image import convert_from_path
import sys
import os
import numpy as np... | github_jupyter |
[Table of Contents](./table_of_contents.ipynb)
# Smoothing
```
#format the book
%matplotlib inline
from __future__ import division, print_function
from book_format import load_style
load_style()
```
## Introduction
The performance of the Kalman filter is not optimal when you consider future data. For example, suppo... | github_jupyter |
# 準備
```
# バージョン指定時にコメントアウト
#!pip install torch==1.7.0
#!pip install torchvision==0.8.1
import torch
import torchvision
# バージョンの確認
print(torch.__version__)
print(torchvision.__version__)
# Google ドライブにマウント
from google.colab import drive
drive.mount('/content/gdrive')
%cd '/content/gdrive/MyDrive/Colab Notebooks/gan_... | github_jupyter |
# Optimization and gradient descent method
```
from IPython.display import IFrame
IFrame(src="https://cdnapisec.kaltura.com/p/2356971/sp/235697100/embedIframeJs/uiconf_id/41416911/partner_id/2356971?iframeembed=true&playerId=kaltura_player&entry_id=1_wota11ay&flashvars[streamerType]=auto&flashvars[localizationCod... | github_jupyter |
```
import numpy as np
import pandas as pd
import random
df = pd.read_csv('/Users/josephbell/Downloads/iris.csv')
df = df.drop("Id", axis = 1)
df = df.rename(columns = {"Species" : "target"})
df.head()
# train test split
def train_test_split(df, target, test_size):
# shuffles data
random_df = df.sample(frac=1)
... | github_jupyter |
# One-step error probability
Write a computer program implementing asynchronous deterministic updates for a Hopfield network. Use Hebb's rule with $w_{ii}=0$. Generate and store p=[12,24,48,70,100,120] random patterns with N=120 bits. Each bit is either +1 or -1 with probability $\tfrac{1}{2}$.
For each value of ppp... | github_jupyter |
# Acquiring Data from open repositories
A crucial step in the work of a computational biologist is not only to analyse data, but acquiring datasets to analyse as well as toy datasets to test out computational methods and algorithms. The internet is full of such open datasets. Sometimes you have to sign up and make a u... | github_jupyter |
# View Campaign and Interactions
In the first notebook `Personalize_BuildCampaign.ipynb` you successfully built and deployed a recommendation model using deep learning with Amazon Personalize.
This notebook will expand on that and will walk you through adding the ability to react to real time behavior of users. If th... | github_jupyter |
```
import os
import math
import torch
from torch.autograd import Variable
from torch.optim import Adam
from torch import nn
import torch.nn.functional as F
from torchvision import transforms
from torch.utils.data import DataLoader, random_split, Dataset
from scipy.io import wavfile
import scipy.signal
import numpy as ... | github_jupyter |
## Import the Libraries
```
import os
import warnings
warnings.filterwarnings('ignore')
# importing packages
import pandas as pd
import re
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline
# sklearn packages
from sklearn import metrics
from sklearn.model_selection import t... | github_jupyter |
## The next step in the gap analysis is to calculate the Turbine Ideal Energy (TIE) for the wind farm based on SCADA data
```
%load_ext autoreload
%autoreload 2
```
This notebook provides an overview and walk-through of the turbine ideal energy (TIE) method in OpenOA. The TIE metric is defined as the amount of electr... | github_jupyter |
# Code Review #1
Purpose: To introduce the group to looking at code analytically
Created By: Hawley Helmbrecht
Creation Date: 10-12-21
# Introduction to Analyzing Code
All snipets within this section are taken from the Hitchhiker's Guide to Python (https://docs.python-guide.org/writing/style/)
### Example 1: Exp... | github_jupyter |
___
<img src='logo.png' /></a>
___
# Python Crash Course Exercises - Solutions
## Exercises
Answer the questions or complete the tasks outlined in bold below, use the specific method described if applicable.
** What is 7 to the power of 4?**
```
7**4
```
** Split this string:**
s = "Hi there Sam!"
**int... | github_jupyter |
# TV Script Generation
In this project, you'll generate your own [Seinfeld](https://en.wikipedia.org/wiki/Seinfeld) TV scripts using RNNs. You'll be using part of the [Seinfeld dataset](https://www.kaggle.com/thec03u5/seinfeld-chronicles#scripts.csv) of scripts from 9 seasons. The Neural Network you'll build will ge... | github_jupyter |
**Recursion and Higher Order Functions**
Today we're tackling recursion, and touching on higher-order functions in Python.
A **recursive** function is one that calls itself.
A classic example: the Fibonacci sequence.
The Fibonacci sequence was originally described to model population growth, and is self-refer... | github_jupyter |
# Introduction to `pandas`
```
import numpy as np
import pandas as pd
```
## Series and Data Frames
### Series objects
A `Series` is like a vector. All elements must have the same type or are nulls.
```
s = pd.Series([1,1,2,3] + [None])
s
```
### Size
```
s.size
```
### Unique Counts
```
s.value_counts()
```
... | github_jupyter |
```
import os, gc, sys
import pygrib
import regionmask
import cartopy
import cartopy.crs as ccrs
import numpy as np
import pandas as pd
import xarray as xr
import geopandas as gpd
import multiprocessing as mp
import matplotlib.pyplot as plt
from glob import glob
from functools import partial
from matplotlib import gr... | github_jupyter |
```
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
import os, sys
import argparse
import torch
from Code.Utils import from_pickle
from Code.models import cartpole
from Code.integrate_models import implicit_integration_DEL, integrate_ODE
from Code.symo import SyMo_RT
from Code.NN import LODE_RT, N... | github_jupyter |
# SLU13: Bias-Variance trade-off & Model Selection -- Examples
---
<a id='top'></a>
### 1. Model evaluation
* a. [Train-test split](#traintest)
* b. [Train-val-test split](#val)
* c. [Cross validation](#crossval)
### 2. [Learning curves](#learningcurves)
# 1. Model evaluation
```
import matplotlib.pyplot as plt
... | github_jupyter |
```
import matplotlib.pyplot as plt
import numpy as np
import scipy.io as scio
import linearRegCostFunction as lrcf
import trainLinearReg as tlr
import learningCurve as lc
import polyFeatures as pf
import featureNormalize as fn
import plotFit as plotft
import validationCurve as vc
plt.ion()
np.set_printoptions(formatte... | github_jupyter |
```
100+ Python challenging programming exercises
1. Level description
Level Description
Level 1 Beginner means someone who has just gone through an introductory Python course. He can solve some problems with 1 or 2 Python classes or functions. Normally, the answers could directly be found in the textbooks.
Level 2 In... | github_jupyter |
# Phi_K advanced tutorial
This notebook guides you through the more advanced functionality of the phik package. This notebook will not cover all the underlying theory, but will just attempt to give an overview of all the options that are available. For a theoretical description the user is referred to our paper.
The ... | github_jupyter |
## Support Vector Clustering visualized
To get started, please click on the cell with the code below and hit `Shift + Enter` This may take a while.
Support Vector Clustering(SVC) is a variation of Support Vector Machine (SVM).
SVC is a way of determining a boudary point between different labels. It utilizes a kern... | github_jupyter |
```
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
migration_patterns = pd.read_csv("./arctic_tern_migration.csv") #Data file, needs to be in working directory
#Adds "Month" column to pd dataframe - "Date" is a string: "DD/MM/YYYY", takes characters 3:5=3,4 -> MM and ... | github_jupyter |
```
import tabula
import numpy as np
import pandas as pd
import os
from pathlib import Path
import PyPDF2
import re
import requests
import json
import time
# filenames = [
# os.path.expanduser('/home/parth/Documents/USICT/it_res.pdf'),
# os.path.expanduser('/home/parth/Documents/USICT/cse_res... | github_jupyter |
```
import requests
from random import randint
from time import sleep
from bs4 import BeautifulSoup
import pandas as pd
# Maintenant nous avons un résumé au dessus de la fonction
def get_url_micro_onde_tunisianet():
url_micro_onde_details = []
urls = [
"https://www.tunisianet.com.tn/564-four-electrique... | github_jupyter |
# Description
This notebook runs some pre-analyses using DBSCAN to explore the best set of parameters (`min_samples` and `eps`) to cluster `pca` data version.
# Environment variables
```
from IPython.display import display
import conf
N_JOBS = conf.GENERAL["N_JOBS"]
display(N_JOBS)
%env MKL_NUM_THREADS=$N_JOBS
%en... | github_jupyter |
# Multi Investment Optimization
In the following, we show how PyPSA can deal with multi-investment optimization, also known as multi-horizon optimization.
Here, the total set of snapshots is divided into investment periods. For the model, this translates into multi-indexed snapshots with the first level being the in... | github_jupyter |
## Rhetorical relations classification used in tree building: ESIM
Prepare data and model-related scripts.
Evaluate models.
Make and evaluate ansembles for ESIM and BiMPM model / ESIM and feature-based model.
Output:
- ``models/relation_predictor_esim/*``
```
%load_ext autoreload
%autoreload 2
import os
import gl... | github_jupyter |
# Quantitative Value Strategy
"Value investing" means investing in the stocks that are cheapest relative to common measures of business value (like earnings or assets).
For this project, we're going to build an investing strategy that selects the 50 stocks with the best value metrics. From there, we will calculate rec... | github_jupyter |
<a href="https://colab.research.google.com/github/ebagdasa/propaganda_as_a_service/blob/master/Spinning_Language_Models_for_Propaganda_As_A_Service.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Experimenting with spinned models
This is a Colab ... | github_jupyter |
```
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import scipy as sp
import sympy as sy
sy.init_printing()
np.set_printoptions(precision=3)
np.set_printoptions(suppress=True)
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity =... | github_jupyter |
# Two Loop FDEM
```
from geoscilabs.base import widgetify
import geoscilabs.em.InductionLoop as IND
from ipywidgets import interact, FloatSlider, FloatText
```
## Parameter Descriptions
<img style="float: right; width: 500px" src="https://github.com/geoscixyz/geosci-labs/blob/master/images/em/InductionLoop.png?raw=t... | github_jupyter |
# Neural Network
**Learning Objectives:**
* Use the `DNNRegressor` class in TensorFlow to predict median housing price
The data is based on 1990 census data from California. This data is at the city block level, so these features reflect the total number of rooms in that block, or the total number of people who liv... | github_jupyter |
```
%run -p Attack_Foolbox_ResNet20.py --checkpoint "/tanresults/experiments-horesnet/cifar10-nagpreresnet20-basicblock-eta-0.999-x-baolr-pgd-seed-0/model_best.pth.tar" -a "nagpreresnet" --block-name "basicblock" --feature_vec "x" --dataset "cifar10" --eta 0.999 --depth 20 --method ifgsm --epsilon 0.031 --gpu-id 1
%run... | github_jupyter |
# Exploring Neural Audio Synthesis with NSynth
## Parag Mital
There is a lot to explore with NSynth. This notebook explores just a taste of what's possible including how to encode and decode, timestretch, and interpolate sounds. Also check out the [blog post](https://magenta.tensorflow.org/nsynth-fastgen) for more ... | github_jupyter |
### Multiple Regression
<br>
a - alpha<br>
b - beta<br>
i - ith user<br>
e - error term<br>
Equation - $y_{i}$ = $a_{}$ + $b_{1}$$x_{i1}$ + $b_{2}$$x_{i2}$ + ... + $b_{k}$$x_{ik}$ + $e_{i}$
beta = [alpha, beta_1, beta_2,..., beta_k]<br>
x_i = [1, x_i1, x_i2,..., x_ik]<br>
<br>
```
inputs = [[123,123,243],[234,455,5... | github_jupyter |
## A Two-sample t-test to find differentially expressed miRNA's between normal and tumor tissues in Lung Adenocarcinoma
```
import os
import pandas
mirna_src_dir = os.getcwd() + "/assn-mirna-luad/data/processed/miRNA/"
clinical_src_dir = os.getcwd() + "/assn-mirna-luad/data/processed/clinical/"
mirna_tumor_df = pand... | github_jupyter |
# Step 7: Serve data from OpenAgua into WEAP using WaMDaM
#### By Adel M. Abdallah, Dec 2020
Execute the following cells by pressing `Shift-Enter`, or by pressing the play button <img style='display:inline;padding-bottom:15px' src='play-button.png'> on the toolbar above.
## Steps
1. Import python libraries
2. Impor... | github_jupyter |
```
import argparse
import time
from collections import defaultdict
from pathlib import Path
import h5py
import fastmri
import fastmri.data.transforms as T
import numpy as np
import requests
import torch
from fastmri.data import SliceDataset
from fastmri.models import Unet
from tqdm import tqdm
# loading multi coil kn... | github_jupyter |
# Optimizing building HVAC with Amazon SageMaker RL
```
import sagemaker
import boto3
from sagemaker.rl import RLEstimator
from source.common.docker_utils import build_and_push_docker_image
```
## Initialize Amazon SageMaker
```
role = sagemaker.get_execution_role()
sm_session = sagemaker.session.Session()
# Sage... | github_jupyter |
# Spleen 3D segmentation with MONAI
This tutorial demonstrates how MONAI can be used in conjunction with the [PyTorch Lightning](https://github.com/PyTorchLightning/pytorch-lightning) framework.
We demonstrate use of the following MONAI features:
1. Transforms for dictionary format data.
2. Loading Nifti images with ... | github_jupyter |
# Westeros Tutorial Part 1 - Welcome to the MESSAGEix framework & Creating a baseline scenario
### *Integrated Assessment Modeling for the 21st Century*
For information on how to install *MESSAGEix*, please refer to [Installation page](https://message.iiasa.ac.at/en/stable/getting_started.html) and for getting *MESS... | github_jupyter |
## Set Up
Today you will create partial dependence plots and practice building insights with data from the [Taxi Fare Prediction](https://www.kaggle.com/c/new-york-city-taxi-fare-prediction) competition.
We have again provided code to do the basic loading, review and model-building. Run the cell below to set everythi... | github_jupyter |
```
Question 1
Create a function that takes an integer and returns a list from 1 to the given number, where:
1. If the number can be divided evenly by 4, amplify it by 10 (i.e. return 10 times the number).
2. If the number cannot be divided evenly by 4, simply return the number.
Examples
amplify(4) ➞ [1, 2, 3, 40]
amp... | github_jupyter |
```
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
from tqdm import tqdm as tqdm
%matplotlib inline
import torch
import torchvision
import torchvision.transforms as transforms
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import random
# from google.co... | github_jupyter |
# Statistical analysis on NEMSIS
## BMI 6106 - Final Project
#### Project by:
Anwar Alsanea <br>
Luz Gabriela Iorg <br>
Jorge Rojas <br>
## Abstract <br>
The National Emergency Medical Services Information System (NEMSIS) is a national database that contains Emergency Medical Services (EMS) data collected for the Un... | github_jupyter |
```
from tensorflow.python.client import device_lib
device_lib.list_local_devices()
import time
import copy
import numpy as np
import os
import subprocess
import sys
import torch
import torch.backends.cudnn as cudnn
import torch.nn as nn
import torch.optim as optim
from matplotlib import pyplot as plt
from torch.utils.... | github_jupyter |
```
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib import style
import matplotlib.ticker as ticker
import seaborn as sns
from sklearn.datasets import load_boston
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import accuracy_score
from sklearn.metrics im... | github_jupyter |
# Binary classification from 2 features using K Nearest Neighbors (KNN)
Classification using "raw" python or libraries.
The binary classification is on a single boundary defined by a continuous function and added white noise
```
import numpy as np
from numpy import random
import matplotlib.pyplot as plt
import matpl... | github_jupyter |
```
%matplotlib inline
```
=====================================================================
Compute Phase Slope Index (PSI) in source space for a visual stimulus
=====================================================================
This example demonstrates how the Phase Slope Index (PSI) [1]_ can be computed
i... | github_jupyter |
# 📝 Exercise M7.03
As with the classification metrics exercise, we will evaluate the regression
metrics within a cross-validation framework to get familiar with the syntax.
We will use the Ames house prices dataset.
```
import pandas as pd
import numpy as np
ames_housing = pd.read_csv("../datasets/house_prices.csv... | github_jupyter |
# Flights data preparation
```
from pyspark.sql import SQLContext
from pyspark.sql import DataFrame
from pyspark.sql import Row
from pyspark.sql.types import *
import pandas as pd
import StringIO
import matplotlib.pyplot as plt
hc = sc._jsc.hadoopConfiguration()
hc.set("hive.execution.engine", "mr")
```
## Function t... | github_jupyter |
<a href="https://colab.research.google.com/github/harnalashok/hadoop/blob/main/hadoop_spark_install_on_Colab.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
```
# Last amended: 30th March, 2021
# Myfolder: github/hadoop
# Objective:
# i) ... | github_jupyter |
# OBJECTF
Predire $\rho$, $\sigma_a$ et $\sigma_c$ en fonction de $E_r$, $F_r$, et $T_r$ a droite du domaine en toute temps
# PREPARATION
## Les imports
```
%reset -f
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from ast import literal_eval as l_eval
np.set_printoptions(precision = 3)
```
... | github_jupyter |
## Phase 3 - deployment
#### This notebook will provide and overview how to deploy and predict the CPE in two ways
- The model was build/export in the last notebook (Phase_2_Advanced_Analytics__predictions)
<br> This notebook show another option to save/export the model using the H2O flow UI and complement the inform... | github_jupyter |
# Comprehensive Example
```
# Enabling the `widget` backend.
# This requires jupyter-matplotlib a.k.a. ipympl.
# ipympl can be install via pip or conda.
%matplotlib widget
import matplotlib.pyplot as plt
import numpy as np
# Testing matplotlib interactions with a simple plot
fig = plt.figure()
plt.plot(np.sin(np.lins... | github_jupyter |
<a href="https://colab.research.google.com/github/jdz014/DS-Unit-2-Applied-Modeling/blob/master/module2-wrangle-ml-datasets/LS_DS12_232_assignment.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 ... | github_jupyter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.