text stringlengths 2.5k 6.39M | kind stringclasses 3
values |
|---|---|
10 Minutes to cuDF and Dask-cuDF
=======================
Modeled after 10 Minutes to Pandas, this is a short introduction to cuDF and Dask-cuDF, geared mainly for new users.
### What are these Libraries?
[cuDF](https://github.com/rapidsai/cudf) is a Python GPU DataFrame library (built on the Apache Arrow columnar me... | github_jupyter |
# Problem Simulation Tutorial
```
import pyblp
import numpy as np
import pandas as pd
pyblp.options.digits = 2
pyblp.options.verbose = False
pyblp.__version__
```
Before configuring and solving a problem with real data, papers such as :ref:`references:Armstrong (2016)` recommend performing Monte Carlo analysis on si... | 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 |
```
import io
import sqlite3
import pandas as pd
import matplotlib.pyplot as plt
```
# Inicialização
## Criação da conexão
```
conn = sqlite3.connect('tp1.db')
cursor = conn.cursor()
```
## Carga dos dados
```
# ! sqlite3 tp1.db < despesas_publicas_tp1.sql
```
## Teste dos dados
```
df = pd.read_sql_query("SELEC... | github_jupyter |
```
from tensorflow.python.client import device_lib
print(device_lib.list_local_devices())
import os
os.environ["CUDA_VISIBLE_DEVICES"]="0,1,2"
# cd /media/datastorage/Phong/svhn_v2
ls
mkdir svhn_v2
!wget http://ufldl.stanford.edu/housenumbers/train_32x32.mat
!wget http://ufldl.stanford.edu/housenumbers/extra_32x32.mat... | github_jupyter |
```
import keras
keras.__version__
```
# Predicting house prices: a regression example
This notebook contains the code samples found in Chapter 3, Section 6 of [Deep Learning with Python](https://www.manning.com/books/deep-learning-with-python?a_aid=keras&a_bid=76564dff). Note that the original text features far more... | github_jupyter |
# Structure queries with SQLAlchemy
Test use of SQLAlchemy expression constructs instead of raw SQL for molecular queries.
```
import pandas as pd
from pandas import DataFrame
from rdkit import Chem, rdBase
from rdkit.Chem import AllChem, Draw, rdqueries, rdMolDescriptors
from rdkit.Chem.Draw import IPythonConsole
... | github_jupyter |
```
# default_exp data
```
# neos.data
> Helper module to easily generate example data.
```
#export
import jax
import jax.numpy as jnp
def generate_blobs(
rng,
blobs,
NMC=500,
sig_mean=jnp.asarray([-1, 1]),
bup_mean=jnp.asarray([2.5, 2]),
bdown_mean=jnp.asarray([-2.5, -1.5]),
b_mean=jnp... | github_jupyter |
# *Desafio
Integrantes: \
-Hugo Rocha -- 201610531-K \
-Gabriel Vergara -- 201510519-7
Equipo: RNG
```
import warnings
warnings.filterwarnings("ignore")
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.preprocessing import La... | github_jupyter |
## Building a Custom Search Engine
### Step 3 - Query the Index and Retrieve Answers
- Submit a single search query
- Submit multiple queries in batch
**Note:** A command-line script version is included under the Python folder of this project.
- For interactive queries: azsearch_query.py
- For batch queries in a file:... | github_jupyter |
```
import pandas as pd
import numpy as np
df = pd.read_csv('MARUTI.csv')
df.head(5)
df.describe()
df.columns
data = df[['Date','Open','High','Low','Close','Volume','VWAP']]
data
data.info
data['Date'] = data['Date'].apply(pd.to_datetime)
data['Date'] = data['Date'].apply(pd.to_datetime)
data.set_index('Date',inplace=T... | github_jupyter |
```
import pandas as pd
import numpy as np
# Load full collection files into dataframes
df_closest = pd.read_csv("typeIII_submission_full_collection_closest.csv")
df_hungarian = pd.read_csv("typeIII_submission_full_collection_hungarian.csv")
```
## 1. Compare Closest and Hungarian Matching for Epik
Both Hungarian and ... | github_jupyter |
# Batch methods
```
# standard imports
import matplotlib.pyplot as plt
import pandas as pd
import os
import tempfile
%matplotlib inline
# import seaborn as sbn # can be used for getting nice colormaps and good settings of the matplotlib rc
# some tweaks to change the apperance of the notebook (you dont have to use the... | 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 |
##### 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 |
# Introduction:
Here we provide a tutorial making use of both the Dirchlet multinomial mixture model and the Poisson model. The objective here is perform topic modelling on a text file, in which each line in said file relates to one document.
# Preamble
We install the package itself, and then the relevant classes:
... | github_jupyter |
```
import io
import sys
import pdfminer
from pdfminer.pdfdocument import PDFDocument
from pdfminer.pdfparser import PDFParser
from pdfminer.converter import XMLConverter, HTMLConverter, TextConverter
from pdfminer.pdfpage import PDFPage
from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter
from pdfmine... | github_jupyter |
```
%matplotlib inline
import gym
import itertools
import matplotlib
import numpy as np
import sys
import sklearn.pipeline
import sklearn.preprocessing
if "../" not in sys.path:
sys.path.append("../")
from lib import plotting
from sklearn.linear_model import SGDRegressor
from sklearn.kernel_approximation import R... | github_jupyter |
<font style="font-size:96px; font-weight:bolder; color:#0040a0"><img src="http://montage.ipac.caltech.edu/docs/M51_logo.png" alt="M" style="float: left; padding: 25px 30px 25px 0px;" /></font>
<i><b>Montage</b> Montage is an astronomical image toolkit with components for reprojection, background matching, coaddition a... | github_jupyter |
# Ad-hoc A/B test evaluation using Ep-Stats
This is a simplified version of general manual [Using Ep-Stats in Jupyter](../user_guide/ep_in_python.html). In this case we assume simple DataFrame at the input. It should contain aggregated data of an A/B test in a wide format.
Next we define metrics and checks we are in... | github_jupyter |
# Programming with Python
## Episode 1b - Introduction to Plotting
Teaching: 60 min,
Exercises: 30 min
Objectives
- Perform operations on arrays of data.
- Plot simple graphs from data.
### Array operations
Often, we want to do more than add, subtract, multiply, and divide array elements. NumPy knows how to do m... | github_jupyter |
<a href="https://colab.research.google.com/github/letianzj/QuantResearch/blob/master/ml/reinforce.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
## Monte Carlo Policy Gradient CartPole
Use MC-PG, a.k.a REINFORCE, to solve CartPole game.
[OpenAI G... | github_jupyter |
```
"""
You can run either this notebook locally (if you have all the dependencies and a GPU) or on Google Colab.
Instructions for setting up Colab are as follows:
1. Open a new Python 3 notebook.
2. Import this notebook from GitHub (File -> Upload Notebook -> "GITHUB" tab -> copy/paste GitHub URL)
3. Connect to an in... | github_jupyter |
# 线性回归
## 问题设定
已知有$N$个$x, y$对构成数据集$X, Y$,他们在坐标轴上的分布如下图:
```
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
# 生成100对x, y
data_count = 100
x_data = np.linspace(-20, 20, data_count)
y_data = np.multiply(2, x_data) + 3 + np.random.normal(loc=0, scale=8.0, size=(data_count,))
plt.figure(figsize... | github_jupyter |
# Hack the Crisis - PandMinder
**Module:** Extraction of data by regions in Sweden.
```
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import requests # The requests library is an
import bs4 as bs # BeautifulSoup4 is a Python library
source = requests.get("https://www.folkhalsomyndighete... | github_jupyter |
# K-means clustering
When working with large datasets it can be helpful to group similar observations together. This process, known as clustering, is one of the most widely used in Machine Learning and is often used when our dataset comes without pre-existing labels.
In this notebook we're going to implement the cla... | github_jupyter |
# Fast creation of an Observation FST using pywrapfst
As shown in this [example](http://localhost:8888/?token=1d421e6e15e54748d58a361f3f06b85702bcb690033af54d), it is convevient to interpret some specific structure as a particular FST. Creating manually an FST object from our data structure may be a very expensive ope... | github_jupyter |
# Installation
- Run these commands
- git clone https://github.com/Tessellate-Imaging/Monk_Object_Detection.git
- cd Monk_Object_Detection/6_cornernet_lite/installation
- Select the right requirements file and run
- chmod +x install.sh
- ./install.sh
# About the network
1. P... | github_jupyter |
# **Notice:**
**the code in this notebook is not entirely correct. I just needed I workspace to test numba.**
# Benchmarks
In this notebook, I try different versions of the functions defined in pyFCI to optimize the usage of [numba](http://numba.pydata.org/)'s just-in-time compilation capabilities.
The main points a... | github_jupyter |
# Transformers
To understand anything that's going on below, check first the slides / video lesson.
```
import torch
from torch import nn
import torch.nn.functional as f
import numpy as np
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
nn_Softargmax = nn.Softmax # fix wrong name
```
## Multi ... | github_jupyter |
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License.
# ResNet50 Image Classification using ONNX and AzureML
This example shows how to deploy the ResNet50 ONNX model as a web service using Azure Machine Learning services and the ONNX Runtime.
## What is ONNX
ONNX is an open for... | github_jupyter |
## Dependencies
```
import json, glob
from tweet_utility_scripts import *
from tweet_utility_preprocess_roberta_scripts_aux import *
from transformers import TFRobertaModel, RobertaConfig
from tokenizers import ByteLevelBPETokenizer
from tensorflow.keras import layers
from tensorflow.keras.models import Model
```
# L... | github_jupyter |
```
import emat
emat.versions()
```
# Identifying Model Problems
Once a series of experiments has been conducted for a core model, it
is suggested that an analyst review the results to confirm that the
model is behaving as expected. TMIP-EMAT provides some visualization
tools to review results in a graphical manner... | github_jupyter |
# Exploración Inicial
__Descripción:__
Se obtiene el AGEB de origen y destino de los viajes de los viajes de ecobici y se obtiene el agregado primedio de los viajes entre AGEBS por hora.
__Input__
- Estaciones de ecobici: Estaciones de ecobici con clave AGEB obtenida de __Uber © 2019 Copyright Uber Technologies, In... | github_jupyter |
##### Copyright 2018 The TensorFlow Authors.
Licensed under the Apache License, Version 2.0 (the "License");
```
#@title Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.o... | github_jupyter |
# Predicting house prices using k-nearest neighbors regression
In this notebook, you will implement k-nearest neighbors regression. You will:
* Find the k-nearest neighbors of a given query input
* Predict the output for the query input using the k-nearest neighbors
* Choose the best value of k using a validation... | github_jupyter |
```
import os, pickle, sys
import matplotlib.pyplot as plt
from scipy import stats
import numpy as np
import glob
from prettytable import PrettyTable
root='../results_release/ptcv'
alld = [f'ptcv_seed{i}' for i in range(0,6)]
allm = []
for dirs in alld:
res = {}
print(dirs)
dirs = os.path.join(root,dirs)
... | github_jupyter |
# Hyperparameter Tuning Demo
### Matthew Epland, PhD
Adapted from:
* [Sklearn Documentation](https://scikit-learn.org/stable/auto_examples/model_selection/plot_randomized_search.html)
* [yandexdataschool/mlhep2018 Slides](https://github.com/yandexdataschool/mlhep2018/blob/master/day4-Fri/Black-Box.pdf)
* [Hyperparamete... | github_jupyter |
# Visualize BLEU Scores
```
!ls tabs
import pandas as pd
from matplotlib import pyplot as plt
import seaborn as sns
from pathlib import Path
#help(pd.read_csv)
path = 'tabs/BleuMacroFChrF.mixedcase.9L6L768d_bsize720k_step200k.txt'
tab = pd.read_csv(path,sep=r'\s+', names='Test BLEU MacroF1 ChrF'.split())
tab
tab['Test... | github_jupyter |
```
%matplotlib inline
# Assuming we are in the notebooks directory, we need to move one up:
%cd ../..
import numpy as np
import pandas as pd
import os
import seaborn as sns
import matplotlib.pyplot as plt
import statsmodels.api as sm
sns.set(font_scale=1.8)
sns.set_style('ticks')
# files for FSL: gain, loss, risk... | github_jupyter |
# Predicción de anomalías
```
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd
import warnings
warnings.simplefilter(action='ignore')
```
## Configuración del dataset: balance adecuado entre las dos clases
```
df = pd.read_pickle('sampledata2.pkl')
# Feature 'Problem': po... | github_jupyter |
# Tutorial 1: Usage of LanTiSEAA
The class lantiseaa.LanTiSEAA is a classifier implementing the Language Time Series Enriched Authorship Attribution method and can be integrated with the sklearn framework (as an Estimator and a Predictor). LanTiSEAA can take customized time series transformers, feature extractor, base... | github_jupyter |
# Blogging with RNNs 2.0: Transfer Learning
By Karl Heyer
This is a follow up to my first attempt at using blogs from the [Blog Authorship Corpus](http://u.cs.biu.ac.il/~koppel/BlogCorpus.htm) to first create a language model, then use that language model in a classification model to classify blog authors by gender. ... | github_jupyter |
# RMSProp --- 使用Gluon
在`Gluon`里,使用RMSProp很容易。我们无需重新实现它。
```
import mxnet as mx
from mxnet import autograd
from mxnet import gluon
from mxnet import ndarray as nd
import numpy as np
import random
mx.random.seed(1)
random.seed(1)
# 生成数据集。
num_inputs = 2
num_examples = 1000
true_w = [2, -3.4]
true_b = 4.2
X = nd.rand... | github_jupyter |
# 基于注意力的神经机器翻译
此笔记本训练一个将加泰罗尼亚语翻译为英语的序列到序列(sequence to sequence,简写为 seq2seq)模型。此例子难度较高,需要对序列到序列模型的知识有一定了解。
训练完此笔记本中的模型后,你将能够输入一个加泰罗尼亚语句子,例如 *"M'agraden els gats"*,并返回其英语翻译 *"I like cats."*
对于一个简单的例子来说,翻译质量令人满意。但是更有趣的可能是生成的注意力图:它显示在翻译过程中,输入句子的哪些部分受到了模型的注意。
<img src="https://tensorflow.google.cn/images/spanish-english... | github_jupyter |
#### New to Plotly?
Plotly's Python library is free and open source! [Get started](https://plot.ly/python/getting-started/) by downloading the client and [reading the primer](https://plot.ly/python/getting-started/).
<br>You can set up Plotly to work in [online](https://plot.ly/python/getting-started/#initialization-fo... | github_jupyter |
# Analyzing NEOs
NEO stands for near-Earth object. The Center for NEO Studies ([CNEOS](http://cneos.jpl.nasa.gov/)) defines NEOs as comets and asteroids that have been nudged by the gravitational attraction of nearby planets into orbits that allow them to enter the Earth’s neighborhood.
And what does "near" exactly m... | github_jupyter |
# Regridding by multiprocessing
Based on [chapter04](https://github.com/zxdawn/GEOSChem-python-tutorial/blob/master/Chapter04_regridding_WRFChem_part1.ipynb), we can regrid many files at the same time by `multiprocessing`.
Because there're so many files, it's better to comment the reminding of using `reuse_weights`.
... | github_jupyter |
## week 2, task 3
В одном из выпусков программы "Разрушители легенд" проверялось, действительно ли заразительна зевота. В эксперименте участвовало 50 испытуемых, проходивших собеседование на программу. Каждый из них разговаривал с рекрутером; в конце 34 из 50 бесед рекрутер зевал. Затем испытуемых просили подождать реш... | github_jupyter |
# afwTables: A Guided Tour
<br>Author(s): **Imran Hasan** ([@ih64](https://github.com/LSSTScienceCollaborations/StackClub/issues/new?body=@ih64))
<br>Maintainer(s): **Douglas Tucker** ([@douglasleetucker](https://github.com/LSSTScienceCollaborations/StackClub/issues/new?body=@douglasleetucker))
<br>Level: **Introductor... | github_jupyter |
# Dynamics 365 Business Central Troubleshooting Guide (TSG), data-related issues
This notebook contains Kusto queries that can help getting to the root cause of an data-related issue for an environment.
NB! Some of the signal used in this notebook is only available in newer versions of Business Central, so check the... | github_jupyter |
## Description:
This script produces Figure S7, Figure S8.
Input: 'data/AR_features/part2/%s.AR_events_feature.1981-2015.nc' % (method)
Output: 'data/AR_classification/AR_3class.%s.nc' % (method)
```
import numpy as np
import netCDF4 as nc
import datetime as dt
import pandas as pd
from sklearn.cluster import K... | github_jupyter |
# Application: Cavity Flow
One of the most common validation cases in CFD is the lid-driven cavity flow. We take a square cavity filled with a fluid and set the velocity of the lid to some constant value. The flow within the cavity is driven by the lid, a spiral flow pattern develops and two distinctive pressure zon... | github_jupyter |
```
# 0. 執行指令:
# !python predict.py -c config.json -i /path/to/image/or/video
# 輸入為 圖片: !python predict.py -c config.json -i ./o_input
# 輸入為 影片: !python predict.py -c config.json -i ./o_input/Produce.mp4
1. 輸入檔案擺放位置:
將要偵測的 影片或圖片 放到 資料夾 o_input (影片必須為mp4格式;圖片可以多張,必須為 '.jpg','.JPG','.png','JPEG' ... | github_jupyter |
*This notebook is part of course materials for CS 345: Machine Learning Foundations and Practice at Colorado State University.
Original versions were created by Asa Ben-Hur.
The content is availabe [on GitHub](https://github.com/asabenhur/CS345).*
*The text is released under the [CC BY-SA license](https://creativecom... | github_jupyter |
```
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from scipy.special import expit
X_train = np.genfromtxt('X_train.csv', delimiter=",")
y_train = np.genfromtxt('y_train.csv', delimiter=",")
X_test = np.genfromtxt('X_test.csv', delimiter=",")
y_test = np.genfromtxt('y_test.csv', delimiter=",")... | github_jupyter |
# k-Nearest Neighbor (kNN) exercise
*Complete and hand in this completed worksheet (including its outputs and any supporting code outside of the worksheet) with your assignment submission. For more details see the [assignments page](http://vision.stanford.edu/teaching/cs231n/assignments.html) on the course website.*
... | github_jupyter |
```
experiment_label = 'LSVC01a_abs_scale'
user_label = 'tay_donovan'
```
## **Aim**
Look for performance improvement in Linear SVC model:
1. Absolute values for negative values
2. Use GradientSearch
3. Scale the features
## **Findings**
* First pass: {'C': 10000, 'degree': 3, 'gamma': 1e-10, 'kernel': 'rbf'}
* Sec... | github_jupyter |
# Metric Calculations for Chest X-Ray Pneumonia Images
```
!pip install sewar
## Load all the necessary packages
%matplotlib inline
import matplotlib.pyplot as plt
import skimage.transform
from skimage import data, io, filters
import numpy as np
from numpy import array
from skimage.transform import rescale, resize
f... | github_jupyter |
*This notebook comes from [A Whirlwind Tour of Python](http://www.oreilly.com/programming/free/a-whirlwind-tour-of-python.csp) by Jake VanderPlas (OReilly Media, 2016). This content is licensed [CC0](https://github.com/jakevdp/WhirlwindTourOfPython/blob/master/LICENSE). The full notebook listing is available at https:/... | github_jupyter |
# How to use the Multiparameter Module Approximation library.
This notebook provides a detailed example using the main functions of this library.
## Setup
The easiest way to compile / install this python library is using pip :
```
# !MAKEFLAGS="-j$(nproc)" pip install --user custom_vineyards/
```
If you want to dir... | github_jupyter |
```
import torch
import torch.nn as nn
import torch.utils.data as Data
from torch.autograd import Variable
from statistics import mean
import matplotlib.pyplot as plt
import _pickle as cPickle
from tqdm import tqdm
from scipy.stats import spearmanr
def evaluate(model, inp, target):
loss_func = torch.nn.MSELoss()
... | 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 warnings
%load_ext autoreload
%autoreload 2
import numpy as np
import pandas as pd
from autogluon.tabular import TabularDataset, TabularPredictor
```
**load data**
```
# train data
train_data = TabularDataset('https://autogluon.s3.amazonaws.com/datasets/Inc/train.csv')
subsample_size = 100 # subsample sub... | github_jupyter |
<div class="contentcontainer med left" style="margin-left: -50px;">
<dl class="dl-horizontal">
<dt>Title</dt> <dd> HeatMap Element</dd>
<dt>Dependencies</dt> <dd>Bokeh</dd>
<dt>Backends</dt>
<dd><a href='./HeatMap.ipynb'>Bokeh</a></dd>
<dd><a href='../matplotlib/HeatMap.ipynb'>Matplotlib</a></dd>
<dd>... | github_jupyter |
# Using PyTorch DALI plugin: using various readers
### Overview
This example shows how different readers could be used to interact with PyTorch. It shows how flexible DALI is.
The following readers are used in this example:
- MXNetReader
- CaffeReader
- FileReader
- TFRecordReader
For details on how to use them pl... | github_jupyter |
##### Copyright 2018 The TensorFlow Hub Authors.
Licensed under the Apache License, Version 2.0 (the "License");
```
# Copyright 2018 The TensorFlow Hub Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
... | github_jupyter |
# Residual Networks (ResNet)
:label:`sec_resnet`
As we design increasingly deeper networks it becomes imperative to understand how adding layers can increase the complexity and expressiveness of the network.
Even more important is the ability to design networks where adding layers makes networks strictly more expressi... | github_jupyter |
# Tutorial: The Basic Tools of Private Deep Learning
Welcome to PySyft's introductory tutorial for privacy preserving, decentralized deep learning. This series of notebooks is a step-by-step guide for you to get to know the new tools and techniques required for doing deep learning on secret/private data/models without... | github_jupyter |
## Data drift monitoring with Amazon SageMaker Model Monitor
This notebook provides a walkthrough of the high level steps involved in monitoring a production ML model with SageMaker Model Monitor for data drift. To demonstrate the data drift monitoring we will use a pre-trained model to deploy an endpoint. We provid... | github_jupyter |
**[PE4-01]**
Import modules.
```
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import matplotlib
matplotlib.rcParams['font.size'] = 12
```
**[PE4-02]**
Define the Gridworld class.
```
class Gridworld:
def __init__(self, size=8, goals=[7], penalty=0):
self.size = size
self.goals... | github_jupyter |
<a href="https://colab.research.google.com/github/yohanesnuwara/machine-learning/blob/master/datacamp_notebooks/DataCamp_01_SupervisedLearning.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# 01. Supervised Learning
## Set up.
```
import numpy as... | github_jupyter |
### Part II. Neural Networks and Deep Learning
# 10. Introduction to Artificial Neural Networks with Keras
Artificial Neural Networks (ANN) is a Machine Learning model inspired by the networks of biological neurons found in our brains.
Although they draw from our biological brains, they have slightly evolved to be... | github_jupyter |
### Алгоритмы и лямбды
<br />
##### Откуда ноги растут - из функторов
Во времена до С++11:
```c++
bool is_underage(const Person& person)
{
return person.age < 18;
}
std::vector<Person> people = { ... };
auto it = std::find_if(people.begin(), people.end(), is_underage);
```
Либо через функтор:
```c++
struct ... | github_jupyter |
```
# Load packages
import numpy as np
import matplotlib.pyplot as plt
import dpmm
%matplotlib inline
# Define a mixture model of N-dimensional Gaussians to play with.
class gaussND(object):
def __init__(self, mu, Sigma):
self.mu = mu
self.Sigma = Sigma
self.d = len(self.mu)
def sample... | github_jupyter |
# AEDI - Análise Estatística de Dados e Informações
```
import numpy as np
import pandas as np
```
``` Imagine que em um campo de boliche contém 5 bolas pretas e 6 bolas brancas, e a maquina de retorno de bolas apresenta aleatoriamente 2 bolas por vez, qual é a probabilidade de que uma bola sai branca e a outra preta... | github_jupyter |
# Vektorisering
Vektorisering brukes mye i beregninger, ettersom å regne med vektorer både blir raskere og gir mer kompakt kode enn å bruke lister. En matematisk operasjon utføres på hele vektoren som én enhet, og bruk av løkker er derfor ikke nødvendig. Mer at det er noen typer problem som ikke kan vektoriseres, som ... | 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 |
## Publishing
We're still in our working directory:
```
import os
top_dir = os.getcwd()
git_dir = os.path.join(top_dir, 'learning_git')
working_dir=os.path.join(git_dir, 'git_example')
os.chdir(working_dir)
working_dir
```
### Sharing your work
So far, all our work has been on our own computer. But a big part of th... | github_jupyter |
```
import pandas as pd
import datetime as dt
from dateutil.relativedelta import relativedelta
import seaborn as sns
import matplotlib.pyplot as plt
import h5py
import json
from pathlib import Path
print("Importing Complete")
# Let's take a look at how many tickers were avaliable on yahoo finance and those that were... | github_jupyter |
# Example 2: 1st-level Analysis
In this example, we will take the preprocessed output from the first example and run for each subject a 1st-level analysis. For this we need to do the following steps:
1. Extract onset times of stimuli from TVA file
2. Specify the model (TR, high pass filter, onset times, etc.)
3. Spec... | github_jupyter |
# Kqlmagic - __parametrization__ features
***
Explains how to emebed python values in kql queries
***
***
## Make sure that you have the lastest version of Kqlmagic
Download Kqlmagic from PyPI and install/update
(if latest version ims already installed you can skip this step)
```
#!pip install Kqlmagic --no-cache-... | github_jupyter |
```
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from keras.layers import Embedding, Dense, Permute, RepeatVector
from keras.layers import Lambda, Conv1D, Dropout, Activation, Multiply, Flatten
from keras.models import Sequential, Input, Model
from keras.models import K
... | github_jupyter |
# **AmilGan Detection using NASNET**
#### Amil Khan | March 1, 2019 | Version 2
***
```
import numpy as np
from collections import OrderedDict
import math
import torch
import torch.nn as nn
import torch.optim as optim
from torch.autograd import Variable
from functools import reduce
import torch.utils.model_zoo as mode... | github_jupyter |
# CycleFlow - an example
In this notebook, we use CycleFlow to determine the cell cycle parameters of the TET21N cell line as it grows exponentially in culture. The data was generated by the authors of the package. Cf. manuscript for more details.
## Package imports
General imports
```
import pandas as pd
import nu... | github_jupyter |
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License.

#... | github_jupyter |
```
pwd
import os
os.chdir(r'D:\Coursera\Python\code3')
os.getcwd()
```
###### Asks for an user input
```
input("Enter your name:")
```
###### Class of the object
```
x= "hello world"
# type gives you the class of the object
type(x)
```
###### methods for a particular data type
```
# gets the method of an object;... | github_jupyter |
# Membership Inference Attcak (MIA) Dataset D
```
#import libraries
import warnings
warnings.filterwarnings("ignore")
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
import seaborn as sns
import os
print('Libraries imported!!')
#define directory of functions and actual directory
HOME_PATH =... | github_jupyter |
<!--BOOK_INFORMATION-->
<img align="left" style="padding-right:10px;" src="fig/cover-small.jpg">
*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/jake... | github_jupyter |
```
import rlssm
import pandas as pd
import os
```
#### Import the grouped data
```
par_path = os.path.abspath(os.path.join(os.getcwd(), os.pardir))
data_path = os.path.join(par_path, 'data/data_experiment.csv')
data = pd.read_csv(data_path, index_col=0)
data = data[data.participant <3 ].reset_index(drop=True)
dat... | github_jupyter |
## Variable distribution
### Linear Regression Assumptions
Linear Regression has the following assumptions over the predictor variables X:
- Linear relationship with the outcome Y
- Multivariate normality
- No or little multicollinearity
- Homoscedasticity
Normality assumption means that every variable X should fo... | github_jupyter |
<table width="100%">
<tr style="border-bottom:solid 2pt #009EE3">
<td style="text-align:left" width="10%">
<a href="record_data.dwipynb" download><img src="../../images/icons/download.png"></a>
</td>
<td style="text-align:left" width="10%">
<a href="https://mybinder.o... | github_jupyter |
# Bevezetés
Sykora Henrik - BME-GPK Műszaki Mechanikai Tanszék (sykora@mm.bme.hu)
### Python programozási nyelv
A Python egy open-source (OS), interpretált, általános célú programozási nyelv (vagy script-nyelv).
**Tulajdonságai:**
- Objektum orientált
- Interpretált
- Nem szükséges fordítani (mint a pl a *C++*-t)... | github_jupyter |
# Basic core
This module contains all the basic functions we need in other modules of the fastai library (split with [`torch_core`](/torch_core.html#torch_core) that contains the ones requiring pytorch). Its documentation can easily be skipped at a first read, unless you want to know what a given function does.
```
f... | github_jupyter |
# A Humanist's Cookbook for Natural Language Processing in Python
Brandon Walsh and Rebecca Draughon
## Table of Contents
### Introduction
"How did I do that last time?" - Brandon to himself, every day
The project began with the goal of keeping Brandon from reinventing the wheel when working on natural languag... | github_jupyter |
# 비디오 데이터 생성 과정 예시
6시간 길이의 비디오를 구성할 때, 20개의 이미지로만 구성되도록 통일시킵니다.
따라서 6시간 내에 20개 초과 이미지로 구성되는 비디오의 경우, 이 중 무작위하게 20개를 골라 하나의 비디오로 구성합니다.
예시를 통해, 24개의 이미지로 구성된 비디오가 무작위 선택 후 20개의 이미지로 구성된 비디오로 통일됨을 보입니다.
```
import numpy as np
import os
from datetime import datetime, timedelta
import matplotlib.pyplot as plt
rawdatapa... | github_jupyter |
```
from google.colab import drive
drive.mount('/content/drive')
```
### Dependencies
```
!pip install keras-rectified-adam
!pip install segmentation-models
import os
import cv2
import math
import random
import shutil
import warnings
import numpy as np
import pandas as pd
import seaborn as sns
import multiprocessing ... | github_jupyter |
# Performance of XGBoost Emulator
- This script shows the performance of XGBoost emulators
```
import xgboost as xgb
from xgboost import XGBRegressor
from sklearn import model_selection, metrics
from sklearn.model_selection import GridSearchCV, train_test_split
from sklearn.model_selection import cross_validate
from ... | github_jupyter |
## SVM ModelFactory
```
#libraries for modeling
from multiprocessing.pool import ThreadPool
from pyspark import SparkContext
from pyspark.sql import SQLContext, SparkSession, Window, Row
from pyspark.ml.linalg import Vectors
from pyspark.ml.feature import VectorAssembler
from pyspark.ml.evaluation import RegressionEva... | github_jupyter |
# Nonlinear seismic response of a MRF
#### March 2020, By Amir Hossein Namadchi
This is an OpenSeesPy simulation of a moment resisting frame subjected to seismic excitation. The model was introduced by *C. Kolay* & *J. M. Ricles* in their paper entitled [Assessment of explicit and semi-explicit classes of model-based a... | github_jupyter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.