text stringlengths 2.5k 6.39M | kind stringclasses 3
values |
|---|---|
# Classification & Regression with Trees
**Aim**: The aim of this notebook is to provide code-based examples for the implementation of tree based algorithms using scikit-learn.
## Table of contents
1. Decision Tree Classifier
2. Random Forest Classifier
3. AdaBoost Classifier
4. Decision Tree Regressor
5. Random F... | github_jupyter |
# Importiere benötigte Bibliotheken
```
import pandas as pd
import numpy as np
import ast
from collections import defaultdict, OrderedDict
import matplotlib.pyplot as plt
pd.set_option('display.max_colwidth', 50)
```
# Importiere das Datenset
```
dataset = pd.read_csv("./jupyterTestFrame.csv")
#Vollständiges Dat... | github_jupyter |
```
import numpy as np
import json
import matplotlib.pyplot as plt
from collections import OrderedDict
from pprint import pprint
import matplotlib
file_name='./rgbjpg/skeletons2D.txt'
file_mobilenet='./Données/rgb_transformed.txt'
text=open(file_name,'r')
with open(file_mobilenet) as f2:
dataMobilenet = json.load(... | github_jupyter |
# Road Following - Live demo
In this notebook, we will use model we trained to move jetBot smoothly on track.
### Load Trained Model
We will assume that you have already downloaded ``best_steering_model_xy.pth`` to work station as instructed in "train_model.ipynb" notebook. Now, you should upload model file to JetBo... | github_jupyter |
# Language modeling approaches
Language Models (LMs) estimate the probability of different linguistic units: symbols, tokens, token sequences.
We see language models in action every day - look at some examples. Usually models in large commercial services are a bit more complicated than the ones we will discuss today,... | github_jupyter |
# Operazioni CRUD con Cassandra
Cassandra si installa dalla distribuzione [Datastax](https://downloads.datastax.com/#ddac) che consente di scaricare un archivio da posizionare dove si vuole nel percorso delle cartelle. In alternativa si può scaricare Cassandra direttamente da [Apache.org](https://cassandra.apache.org/... | github_jupyter |
# Dataset D1 - WGS E.coli
## Importing libraries
```
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import matplotlib.ticker as tkr
```
## Data reading and cleaning
```
data = pd.read_csv('../summary_data/D1_WGS_E.coli_summary.csv')
data['total_corrections'] = data['Base - TP']+ data['Ba... | github_jupyter |
# Python Basics with Numpy (optional assignment)
Welcome to your first assignment. This exercise gives you a brief introduction to Python. Even if you've used Python before, this will help familiarize you with functions we'll need.
**Instructions:**
- You will be using Python 3.
- Avoid using for-loops and while-lo... | github_jupyter |
# Introduction to Brian part 3: Simulations
If you haven’t yet read parts 1 and 2 on Neurons and Synapses, go read them first.
This tutorial is about managing the slightly more complicated tasks that crop up in research problems, rather than the toy examples we've been looking at so far. So we cover things like input... | github_jupyter |
# Quantum states with high dimensional entanglement
This notebook allows visualizing the 20 circuits of the second pilot study with mention of their depth and gate repartition.
At the end, a toy protocol of ballot transmission is presented with experimental verification.
```
import numpy as np
import copy
from qiski... | github_jupyter |
```
# default_exp layers
```
# Useful Layers
> Some Pytorch layers needed for MetNet
```
#export
from fastai.vision.all import *
from fastai.text.all import WeightDropout, RNNDropout
```
## ConvLSTM / ConvGRU layers
### CGRU
https://github.com/jhhuang96/ConvLSTM-PyTorch/blob/master/ConvRNN.py
In a GRU cell the ou... | github_jupyter |
# Transfer Learning
대부분의 경우, 전체 네트워크를 새로 학습하는 것은 시간, 자원, 노력등의 낭비를 초래합니다.
예를 들어 ImageNet과 같은 대규모 데이터셋에 대한 최신 ConvNets에 대한 훈련은 여러 GPU에서 몇 주가 걸립니다.
대신, 대부분의 사람들은 미리 훈련된 네트워크를 이용하여 feature extractor로 사용하거나 fine-tuning을 하기 위한 초기 네트워크로 사용합니다.
이 포스트에서는 미리 훈련된 VGGNet을 이용해서 꽃을 분류하는 Classifier를 만들어보겠습니다.
[VGGNet](https://arxi... | github_jupyter |
# 03. Deploying Jupyter
## Overview
In this notebook, you will learn how to:
- Configure remote Jupyter deployment.
- Deploy Jupyter on a compute node.
- Access deployed Jupyter Notebook.
## Import idact
It's recommended that *idact* is installed with *pip*. Alternatively, make sure the dependencies are install... | github_jupyter |
## Custom camera projection
User defined ray distribution: ray origins and directions in camera textures.
```
%matplotlib notebook
import matplotlib.pyplot as plt
import numpy as np
from plotoptix import NpOptiX
from plotoptix.materials import m_flat
from plotoptix.geometry import PinnedBuffer
```
Create the raytra... | github_jupyter |
# PeriodicityDetector QuickStart
-----------------------------------
##### In this notebook we will demonstrate initializing an Observations class - a time resolves observation series - and the PeriodicityDetector class to detect periodicity in the series.
### 1 Using the PeriodicityDetector class to run PDC on simul... | github_jupyter |
```
%load_ext autoreload
%autoreload 2
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import freqopttest.util as util
import freqopttest.data as data
import freqopttest.kernel as kernel
import freqopttest.tst as tst
import freqopttest.glo as glo
import sys
# sample source
m = 2000
dim = 200
n = ... | github_jupyter |
<a href="https://colab.research.google.com/github/moustafa-7/ChatBot-Project/blob/master/Code.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
```
import gc
gc.collect()
!pip install argparse
import os
import requests
import time
import argparse
impo... | github_jupyter |
# Equivalent layer technique for estimating total magnetization direction using
#### Importing libraries
```
% matplotlib inline
import sys
import numpy as np
import matplotlib.pyplot as plt
import cPickle as pickle
import datetime
import timeit
import string as st
from scipy.optimize import nnls
from fatiando.gridde... | github_jupyter |
```
#hide
#skip
! [ -e /content ] && pip install -Uqq fastai # upgrade fastai on colab
#all_slow
#default_exp vision.utils
#export
from fastai.torch_basics import *
from fastai.data.all import *
from fastai.vision.core import *
from pathlib import Path
#hide
from nbdev.showdoc import *
```
# Vision utils
> Some util... | github_jupyter |
# T81-558: Applications of Deep Neural Networks
**Module 12: Deep Learning and Security**
* Instructor: [Jeff Heaton](https://sites.wustl.edu/jeffheaton/), McKelvey School of Engineering, [Washington University in St. Louis](https://engineering.wustl.edu/Programs/Pages/default.aspx)
* For more information visit the [cl... | 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 |
# Connecting to a PostgreSQL database
In these exercises, you will be working with real databases hosted on the cloud via Amazon Web Services (AWS)!
Let's begin by connecting to a PostgreSQL database. When connecting to a PostgreSQL database, many prefer to use the psycopg2 database driver as it supports practically a... | 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">
## _*The Vaidman Detection Test: Interaction Free Measurement*_
The latest... | github_jupyter |
# Chapter 9 - Searching Data Structures and Finding Shortest Paths
This notebook contains code accompanying Chapter 9 Searching Data Structures and Finding Shortest Paths in *Practical Discrete Mathematics* by Ryan T. White and Archana Tikayat Ray
For most of the code in the chapter, we need to import the `NumPy` lib... | github_jupyter |
<!--BOOK_INFORMATION-->
<img align="left" style="padding-right:10px;" src="figures/PDSH-cover-small.png">
*This notebook contains an excerpt from the [Python Data Science Handbook](http://shop.oreilly.com/product/0636920034919.do) by Jake VanderPlas; the content is available [on GitHub](https://github.com/jakevdp/Pyth... | github_jupyter |
# Analytics and demand forecasting for a multi-national retail store
## Notebook by Edward Warothe
### Introduction
General information about this analysis is in the readme file.
There are 4 datasets in these analysis: stores -has location, type and cluster information about the 54 stores in check; items which... | github_jupyter |
<a href="https://colab.research.google.com/github/pabloderen/SightlineStudy/blob/master/Sightline.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
```
#!/usr/bin/env python
# coding: utf-8
# # Collision analysis
import pandas as pd
import numpy as n... | github_jupyter |
This notebook was prepared by [Donne Martin](http://donnemartin.com). Source and license info is on [GitHub](https://github.com/donnemartin/data-science-ipython-notebooks).
# Pandas
Credits: The following are notes taken while working through [Python for Data Analysis](http://www.amazon.com/Python-Data-Analysis-Wrang... | github_jupyter |
```
import os
import re
import pickle
import time
import datetime
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from scipy.sparse import csr_matrix, vstack
%matplotlib inline
# Custom modules
import const
import func
lut = pd.rea... | github_jupyter |
# Get data from CSVs
In this exercise, you'll create a data frame from a CSV file. The United States makes available CSV files containing tax data by ZIP or postal code, allowing us to analyze income information in different parts of the country. We'll focus on a subset of the data, vt_tax_data_2016.csv, which has sele... | github_jupyter |
# Microbiome experiment step-by-step analysis
This is a jupyter notebook example of how to load, process and plot data from a microbiome experiment using Calour.
## Setup
### Import the calour module
```
import calour as ca
```
### (optional) Set the level of feedback messages from calour
can use:
* 1 for debug (l... | github_jupyter |
```
import erppeek
from __future__ import print_function
SERVER = 'http://localhost:8069'
DATABASE = 'desarrollo'
USERNAME = 'companyfirebird@gmail.com'
PASSWORD = 'platano-1'
```
La documentación necesaria para poder superar este ejercicio se encuentra en la documentación de [ERPpeek](http://erppeek.readthedocs.org/e... | github_jupyter |
# Case Study 7
__Team Members:__ Amber Clark, Andrew Leppla, Jorge Olmos, Paritosh Rai
# Content
* [Objective](#objective)
* [Data Evaluation](#data-evaluation)
- [Loading Data](#loading-data)
- [Data Summary](#data-summary)
- [Missing Values](#missing-values)
- [Exploratory Data Analysis (EDA)](#eda... | github_jupyter |
```
import psycopg2
database = "rssfeed"
hostname="rssfeed.cjgj2uy1bapa.us-east-1.rds.amazonaws.com"
port="5432"
userid="postgres"
passwrd=""
conn_string = "host="+hostname+" port="+port+" dbname="+database+" user="+userid+" password="+passwrd
conn = psycopg2.connect(conn_string)
conn.autocommit=True
cursor = conn.cur... | github_jupyter |
The iexfinance API seems to be not working. For now, this example does not work.
```
%load_ext autoreload
%autoreload 2
import numpy as np; np.random.seed(1)
import matplotlib.pyplot as plt
import pandas as pd
from extquadcontrol import dp_finite, dp_infinite, ExtendedQuadratic, \
FiniteHorizonSystem, InfiniteHori... | github_jupyter |
```
import requests
import numpy as np
import pandas as pd
from pathlib import Path
from RISparser import read, TAG_KEY_MAPPING, LIST_TYPE_TAGS
# visualization
import matplotlib.pyplot as plt
from wordcloud import WordCloud, STOPWORDS
```
## Read files from Zenodo
```
url_included = "https://zenodo.org/record/362593... | github_jupyter |
# Methodological approach
### Models
- Baseline (TF-IDF + SVM with preprocessing): Train + Crossvalidation (default, 5-folds)
- Transformers: Validation is random sample of Train (10%). No cross-validation implemented yet, since not trivial
Both model classes use _class weights_ to address class imbalance problem an... | github_jupyter |
# Four Muon Spectrum
This code is another showcase of the awkward array toolset, and utilizing coffea histograms in addition to advanced functionality.
This shows the analysis object syntax implemented by coffea `JaggedCandidateArray`, along with a multi-tiered physics selection, and the usage of an accumulator class ... | github_jupyter |
# Neural Networks
G. Richards (2016,2018), where I found this video series particularly helpful in trying to simplify the explanation https://www.youtube.com/watch?v=bxe2T-V8XRs. Thanks also to Vince Baker (Drexel).
[Artificial Neural Networks](https://en.wikipedia.org/wiki/Artificial_neural_network) are a simplifie... | github_jupyter |
```
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from datetime import datetime
import os
import glob
import random
# from crf import do_crf,post_process_crf
import imgaug
from imgaug import augmenters as iaa
from PIL import Image
from tqdm import tqdm
im... | github_jupyter |
```
# Erasmus+ ICCT project (2018-1-SI01-KA203-047081)
# Toggle cell visibility
from IPython.display import HTML
tag = HTML('''<script>
code_show=true;
function code_toggle() {
if (code_show){
$('div.input').hide()
} else {
$('div.input').show()
}
code_show = !code_show
}
$( document... | github_jupyter |
# Collaborative Filtering Algorithm
## Movie Recommemder System using Collaborative Filtering Algorithm
### This is an implementation of Collaborative Filtering Algorithm from scratch, based on the lecture of Andrew NG on the corresponding topic in Coursera.
### Dataset source: https://www.kaggle.com/grouplens/movielen... | github_jupyter |
## Topic Modelling
The goal of this notebook is to find the topics on which people are talking within our dataset with tweets about vaccines. There are many models available for topic modelling, but in this Notebook we've focused only on **LDA (Latent Dirichlet Allocation)**.
For data protection purposes, the dataset... | github_jupyter |
# Running Code
First and foremost, the IPython Notebook is an interactive environment for writing and running code. IPython is capable of running code in a wide range of languages. However, this notebook, and the default kernel in IPython 2.0, runs Python code.
## Code cells allow you to enter and run Python code
Ru... | github_jupyter |
# Writing OSEM (or another reconstruction algorithm) yourself with SIRF
This notebook invites you to write MLEM and OSEM yourself using SIRF functionality, i.e. Do It Yourself OSEM!
You should have completed the [OSEM_reconstruction notebook](OSEM_reconstruction.ipynb) first. The [ML_reconstruction notebook](ML_recons... | github_jupyter |
# Multi-layer FNN on MNIST
This is MLP (784-X^W-10) on MNIST. SGD algorithm (lr=0.1) with 100 epoches.
```
import os, sys
import numpy as np
from matplotlib.pyplot import *
import locale
locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')
import matplotlib.cm as cm
import matplotlib.pyplot as plt
import matplotlib.font_m... | github_jupyter |
#**Part 1 - Data gathering and feature engineering**
**Libraries**
```
import numpy as np #Linear_Algebra
import matplotlib.pyplot as plt
import pandas as pd #Data_Processing
import pandas_datareader as pdr
from scipy import stats
%matplotlib inline
from IPython.core.interactiveshell import InteractiveShell
Interacti... | github_jupyter |
<a href="https://colab.research.google.com/github/probml/probml-notebooks/blob/main/notebooks/numpyro_intro.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
[NumPyro](https://github.com/pyro-ppl/numpyro) is probabilistic programming language built on... | github_jupyter |
## Description:
This script creates Figure S2
```
import numpy as np
import netCDF4 as nc
import datetime as dt
import pandas as pd
from sklearn.cluster import KMeans
#import mpl_toolkits.mplot3d as mpl3d
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
import cartopy
i... | github_jupyter |
<a href="https://colab.research.google.com/github/cbadenes/notebooks/blob/main/probabilistic_topic_models/TBFY_Crosslingual_SearchAPI.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
A **cross-lingual search API** for exploring public contracts in th... | github_jupyter |
```
Copyright 2021 IBM Corporation
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softwa... | github_jupyter |
# Trax : Ungraded Lecture Notebook
In this notebook you'll get to know about the Trax framework and learn about some of its basic building blocks.
## Background
### Why Trax and not TensorFlow or PyTorch?
TensorFlow and PyTorch are both extensive frameworks that can do almost anything in deep learning. They offer a... | github_jupyter |
## 今天的範例,帶著大家一起挖掘變數之間的關係
```
# library
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from scipy import stats
import math
import statistics
import seaborn as sns
from IPython.display import display
import sklearn
print(sklearn.__version__)
#如果只有 0.19 記得要更新至 最新版本
%matplotlib inline
```
## 產生一組資... | github_jupyter |
```
# Use in the google colab to connect the google cloud in order to get the dataset
!apt-get install -y -qq software-properties-common python-software-properties module-init-tools
!add-apt-repository -y ppa:alessandro-strada/ppa 2>&1 > /dev/null
!apt-get update -qq 2>&1 > /dev/null
!apt-get -y install -qq google-driv... | github_jupyter |
# DAIN Colab
*DAIN Colab, v1.7.1*
Based on the [original Colab file](https://github.com/baowenbo/DAIN/issues/44) by btahir.
Enhancements by [Styler00Dollar](https://github.com/styler00dollar), [Alpha](https://github.com/AlphaGit) and [JamesCullum](https://github.com/JamesCullum).
[Styler00Dollar's fork](https://g... | github_jupyter |
# Power and Influence: Central Positions in Networks
```
%%capture
# Housekeeping
# As explained before, it is best practice to load the modules at the start
import networkx as nx
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# This line allows visualizations within the notebook
%matplotlib i... | github_jupyter |
```
import os
import torch
import torch.nn as nn
import torchvision
import torchvision.transforms as transforms
from torchvision.datasets import MNIST
from torch.utils.data import DataLoader
from torch.autograd import Variable
from tqdm import tqdm
from sklearn.preprocessing import OneHotEncoder
# GPU Device
gpu_id = '... | github_jupyter |
# Project Proposal
In the heat of the moment, when the enemy missiles are bearing down, a human being will utilize their learned abilities to react, and come out on top. Action games are a perfect environment for this learned ability to react to shine, and have been shown to improve players' perception, attention, and... | github_jupyter |
PyGSLIB
========
Trans
---------------
The GSLIb equivalent parameter file is
```
Parameters for TRANS
********************
START OF PARAMETERS:
1 \1=continuous, 0=categorical
data/true.dat \file with reference distribution
1 0 ... | github_jupyter |
```
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
Pre_data = pd.read_csv("C:\\Users\\2019A00303\\Desktop\\Code\\Airbnb Project\\Data\\PreProcessingUK.csv")
Pre_data
Pre_data['Price'].plot(kind='hist', bins=100)
Pre_data['group'] = pd.cut(x=Pre_data['Price'],
bins=[0, 50, 100, 150, 200, 1000],
... | github_jupyter |
# k-Nearest Neighbors implementation
- Doesn't use any library to perform KNN.
- Uses scikit-learn library for calculating various metrics and confusion matrix.
It is possible to provide file name, k value and training-test data split ratio as arguments such as the following:
python knn.py data/iris.csv 5 0.6... | github_jupyter |
# AerisWeather Python SDK
----
The AerisWeather Python SDK is a coding toolkit created to streamline integrating data from the [AerisWeather API](https://www.aerisweather.com/support/docs/api/) into Python applications.
In other words, the goal of the SDK is to make it easier to get weather data into your Python... | github_jupyter |
SOP017 - Add app-deploy AD group
================================
Description
-----------
If the Big Data Cluster was installed without an Active Directory group,
you can add one post install using this notebook.
### Steps
### Parameters
```
user_or_group_name = "<INSERT USER/GROUP NAME>"
realm = "<INSERT REALM>" ... | github_jupyter |
```
import nengo
import numpy as np
import matplotlib.pyplot as plt
import gym
def softmax(x):
return np.exp(x)/sum(np.exp(x))
# master class that performs environment interaction and learning
class Master():
def __init__(self,
env,
dt,
stepSize=1):
... | github_jupyter |
# Melon Chart Scraping
아래 언급된 모든 사이트의 스크래핑은 오직 교육 목적으로만 사용되었습니다. <br>
https://www.melon.com/chart/
```
from bs4 import BeautifulSoup
import requests
res = requests.get('https://www.melon.com/chart/')
dir(res)
# response status 확인
res # Response [406]
res.raise_for_status ... | github_jupyter |
# Algo - distance d'édiction
La distance d'édition ou distance de [Levenshtein](https://en.wikipedia.org/wiki/Levenshtein_distance) permet de calculer une distance entre deux mots et par extension entre deux séquences.
```
from jyquickhelper import add_notebook_menu
add_notebook_menu()
%matplotlib inline
```
## Enon... | github_jupyter |
# Data Bootcamp: Exam practice & review
We review the material we've covered to date: Python fundamentals, data input with Pandas, and graphics with Matplotlib. Questions marked *Bonus* are more difficult and are there to give the experts something to do.
This IPython notebook was created by Dave Backus, Chase C... | github_jupyter |
Computers are designed to perform numerical calculations, but there are some important details about working with numbers that every programmer working with quantitative data should know. Python (and most other programming languages) distinguishes between two different types of numbers:
* Integers are called `int` val... | github_jupyter |
# Implementing a Route Planner
In this project you will use A\* search to implement a "Google-maps" style route planning algorithm.
```
# Run this cell first!
from helpers import Map, load_map, show_map
from student_code import shortest_path
%load_ext autoreload
%autoreload 2
```
### Map Basics
```
map_10 = load_m... | github_jupyter |
<img src="https://s8.hostingkartinok.com/uploads/images/2018/08/308b49fcfbc619d629fe4604bceb67ac.jpg" width=500, height=450>
<h3 style="text-align: center;"><b>Физтех-Школа Прикладной математики и информатики (ФПМИ) МФТИ</b></h3>
---
<h2 style="text-align: center;"><b>Домашнее задание: нейрон с разными функциями акти... | github_jupyter |
# Kalman Filters
In this lab you will:
- Estimate Moving Average
- Use Kalman Filters to calculate the mean and covariance of our time series
- Modify a Pairs trading function to make use of Kalman Filters
## What is a Kalman Filter?
The Kalman filter is an algorithm that uses noisy observations of a system over ti... | github_jupyter |
# GitHub Issue [#6](https://github.com/sassoftware/sasoptpy/issues/6)
```
import os
import sys
sys.path.insert(0, os.path.abspath('../..'))
import pandas as pd
import saspy
s = saspy.SASsession(cfgname='winlocal')
import sasoptpy as so
model = so.Model(name="Test Model", session=s)
x_data = pd.DataFrame([['x1',2],['... | github_jupyter |
<a href="https://qworld.net" target="_blank" align="left"><img src="../qworld/images/header.jpg" align="left"></a>
$ \newcommand{\bra}[1]{\langle #1|} $
$ \newcommand{\ket}[1]{|#1\rangle} $
$ \newcommand{\braket}[2]{\langle #1|#2\rangle} $
$ \newcommand{\dot}[2]{ #1 \cdot #2} $
$ \newcommand{\biginner}[2]{\left\langle... | github_jupyter |
```
from IPython.display import display, HTML
import pandas as pd
from os import listdir
from os.path import isfile, join
from pprint import pprint
import json
import seaborn as sns
import matplotlib.pyplot as plt
from matplotlib import gridspec
from matplotlib.font_manager import FontProperties
import numpy as np
... | github_jupyter |
```
%load_ext autoreload
%autoreload 2
import io, math, os, sys
from base64 import b64decode
from pathlib import Path
from IPython.core.display import HTML
import matplotlib.pyplot as plt
import numpy as np
import PIL
# Install daltonlens if necessary
try:
from daltonlens import convert, simulate, utils
except I... | github_jupyter |
# MOEA tutorial
In the previous assignments, we have been using sampling to investigate the uncertainty space and the lever space. However, we can also use optimization algorithms to search through these spaces. Most often, you would use optimization to search through the lever space in order to find promising policie... | github_jupyter |
```
from sklearn.preprocessing import MinMaxScaler
import pandas as pd
sp500_training_complete = pd.read_csv("GSPC.csv")
sp500_training_processed = sp500_training_complete.iloc[:, 4:5].values
scaler = MinMaxScaler(feature_range = (0, 1))
sp500_training_scaled = scaler.fit_transform(sp500_training_processed)
np.array(s... | github_jupyter |
```
from sklearn.ensemble import GradientBoostingClassifier
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import load_iris
dataset = load_iris()
X = pd.DataFrame(dataset['data'], columns=dataset['feature_names'])
X
y = pd.DataFrame(dataset['target'])
df = pd.concat([X, y],... | github_jupyter |
# Introduction to Overfit and Underfit
### Learning objectives
1. Use the Higgs Dataset.
2. Demonstrate overfitting.
3. Strategies to prevent overfitting.
## Introduction
In this notebook, we'll explore several common regularization techniques, and use them to improve on a classification model.
As always, the ... | github_jupyter |
## Keras rl-neural network models
# 1. Model
## Different models built on keras
```
# 1.1 Model
## DESCRIPTION : 6 layered Neural Network with dropout
from keras.models import Sequential
from keras.layers import Dense, Dropout
def create_model_1():
model = Sequential()
model.add(Dense(128, input_shape=(4,)... | github_jupyter |
For this computer lab, we'll be using the IRIS dataset. Initially, we'll only look at a subset of it, and perform linear regression on two features of a given class.
# 1. Loading the data
### 1.1 Import the necessary modules
We'll use these three different modules, and one of the functions from scikit-learn.
```
i... | github_jupyter |
```
from imports import *
from datasets.idd import *
from datasets.bdd import *
from detection.unet import *
from collections import OrderedDict
from torch_cluster import nearest
from fastprogress import master_bar, progress_bar
batch_size=8
num_epochs=1
path = '/home/jupyter/autonue/data'
root_img_path = os.path.join(... | github_jupyter |
```
!echo "Late updated:" `date`
```
Resources for learning TFP
- https://www.tensorflow.org/probability/api_docs/python/tfp/mcmc/NoUTurnSampler
- https://www.tensorflow.org/probability/overview
- https://www.tensorflow.org/probability/api_docs/python/tfp/mcmc
- https://www.tensorflow.org/probability/examples/Modeling... | 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 |
# Travel.State.Gov Visa Issuances
**Data Source:** [Monthly Immigrant Visa Issuance Statistics](https://travel.state.gov/content/travel/en/legal/visa-law0/visa-statistics/immigrant-visa-statistics/monthly-immigrant-visa-issuances.html) <br>
**Download the Output:** [here](../data/extracted_data/state-dept)
## Overv... | github_jupyter |
# Using the GrainSizeTools script through JupyterLab or the notebook: first steps
> IMPORTANT NOTE: This Jupyter notebook example only applies to GrainSizeTools v3.0+ Please check your script version before using this notebook. You will be able to reproduce all the results shown in this tutorial using the dataset prov... | github_jupyter |
# 2. Bayes Rule
The main goal of this post is to dig a bit further into Bayes rule, from a purely probabilistic perspective! Before we begin I do want to make one note; a great deal of the power of Bayes Rule comes in the form of bayesian inference and bayesian statistics, which can be found in the statistics section. ... | github_jupyter |
# Walmart data EDA
#### March 23, 2019
#### Luis Da Silva
```
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import datetime as dt
from sklearn.gaussian_process import GaussianProcessRegressor
from sklearn.ensemble import RandomForestRegressor
from sklearn.linear_model im... | github_jupyter |
# Testing a new contribution
```
import numpy as np
import pandas as pd
from deep_nilmtk.utils.templates import ExperimentTemplate
from deep_nilmtk.models.pytorch import Seq2Point
from deep_nilmtk.models.pytorch.layers import *
from deep_nilmtk.disaggregator import NILMExperiment
from deep_nilmtk.data.loader import G... | github_jupyter |
## Coding Exercise #0702
### 1. Linear regression:
```
import numpy as np
# import tensorflow as tf
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
```
#### 1.1. Data:
```
# Training data.
# hours of study (X) vs test score (y).
study = np.array([ 3, 4.5, 6, 1.2, 2, 6.9, 6.7, 5.5]) # Explanato... | 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 |
SAM008 - Spark using azdata
===========================
Description
-----------
### Parameters
```
spark_statement = "2+2"
max_tries_for_ready_state = 50
```
### Common functions
Define helper functions used in this notebook.
```
# Define `run` function for transient fault handling, suggestions on error, and scro... | github_jupyter |
```
# Install default libraries
import pathlib
import sys
# Import installed modules
import pandas as pd
import numpy as np
import imageio
from tqdm import tqdm
# Import the Python script from the auxiliary folder
sys.path.insert(1, "../auxiliary")
import data_fetch
# Set a local download path and the URL to the 67P... | github_jupyter |
# Text generation
```
import github_command as gt
gt.push(file_to_transfer="TD7_Text_Generation_With_LSTM.ipynb",
message="beam search",
repos="TDs_ESILV.git")
```
## Load Packages
```
import numpy
from keras.models import Sequential
from keras.layers import Dense
from keras.layers import Dropout
from ... | github_jupyter |
```
%matplotlib inline
import pandas as pd
import keras
import numpy
import sklearn
from sklearn.linear_model import LogisticRegression
import matplotlib.pyplot as plt
from sklearn.metrics import accuracy_score, confusion_matrix, precision_recall_curve, auc
from sklearn.utils import shuffle
from keras.models import Seq... | github_jupyter |
```
import numpy as np
import math
import tensorflow as tf
from tensorflow.contrib.layers import fully_connected
import time
# import subprocess
import random
%matplotlib inline
```
## Utils
```
def alter_coord(action, position, g_coord, dx=0.1, change_nodes=list(range(1,9))):
if action==0:
g_coo... | github_jupyter |
# ECCO-TCP
```
import lltk
# load corpus
C=lltk.load('ECCO_TCP')
# get some basic info
C.info()
```
## Install
### From pre-compiled zips
Only metadata and 1-gram counts are made available via download.
```
C.download(parts=['metadata','freqs'], force=False) # change force to True to redownload
```
## Preprocess... | github_jupyter |
# Final exercise
We've now covered all the topics on this course so to finish off, work through this final exercise. It is designed to give you a chance to practise what you've learned on some new code.
Make a new directory called `crypto`. In the Terminal change to that directory with `cd crypto` and in the Python C... | github_jupyter |
# Word Embeddings: Ungraded Practice Notebook
In this ungraded notebook, you'll try out all the individual techniques that you learned about in the lecture. Practicing on small examples will prepare you for the graded assignment, where you will combine the techniques in more advanced ways to create word embeddings fro... | github_jupyter |
```
# This Python 3 environment comes with many helpful analytics libraries installed
# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python
# For example, here's several helpful packages to load in
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file... | github_jupyter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.