text stringlengths 2.5k 6.39M | kind stringclasses 3
values |
|---|---|
Deep Learning Models -- A collection of various deep learning architectures, models, and tips for TensorFlow and PyTorch in Jupyter Notebooks.
- Author: Sebastian Raschka
- GitHub Repository: https://github.com/rasbt/deeplearning-models
```
!pip install -q IPython
!pip install -q ipykernel
!pip install -q watermark
!p... | github_jupyter |
# Changing the input current when solving PyBaMM models
This notebook shows you how to change the input current when solving PyBaMM models. It also explains how to load in current data from a file, and how to add a user-defined current function. For more examples of different drive cycles see [here](https://github.com... | github_jupyter |
## Discretisation
Discretisation is the process of transforming continuous variables into discrete variables by creating a set of contiguous intervals that span the range of the variable's values. Discretisation is also called **binning**, where bin is an alternative name for interval.
### Discretisation helps handl... | github_jupyter |
This baseline has reached Top %11 with rank of #457/4540 Teams at Private Leader Board (missed Bronze with only 2 places)
```
import numpy as np
import pandas as pd
import sys
import gc
from scipy.signal import hilbert
from scipy.signal import hann
from scipy.signal import convolve
pd.options.display.precision = 15... | github_jupyter |
# Exercise 4 - Optimizing Model Training
In [the previous exercise](./03%20-%20Compute%20Contexts.ipynb), you created cloud-based compute and used it when running a model training experiment. The benefit of cloud compute is that it offers a cost-effective way to scale out your experiment workflow and try different alg... | github_jupyter |
# Numpy实现浅层神经网络
实践部分将搭建神经网络,包含一个隐藏层,实验将会展现出与Logistic回归的不同之处。
实验将使用两层神经网络实现对“花”型图案的分类,如图所示,图中的点包含红点(y=0)和蓝点(y=1)还有点的坐标信息,实验将通过以下步骤完成对两种点的分类,使用Numpy实现。
- 输入样本;
- 搭建神经网络;
- 初始化参数;
- 训练,包括前向传播与后向传播(即BP算法);
- 得出训练后的参数;
- 根据训练所得参数,绘制两类点边界曲线。
<img src="image/data.png" style="width:400px;height:300px;">
该实验将使用Python... | github_jupyter |
# Trump Tweets at the Internet Archive
So Trump's Twitter account is gone. At least at twitter.com. But (fortunately for history) there has probably never been a more heavily archived social media account at the Internet Archive and elsewhere on the web. There are also a plethora of online "archives" like [The Trump A... | github_jupyter |
## Bayesian Optimization with Scikit-Optimize
In this notebook, we will perform **Bayesian Optimization** with Gaussian Processes in Parallel, utilizing various CPUs, to speed up the search.
This is useful to reduce search times.
https://scikit-optimize.github.io/stable/auto_examples/parallel-optimization.html#exam... | github_jupyter |
## Control Flow
Generally, a program is executed sequentially and once executed it is not repeated again. There may be a situation when you need to execute a piece of code n number of times, or maybe even execute certain piece of code based on a particular condition.. this is where the control flow statements come in.
... | github_jupyter |
## MatrixTable Tutorial
If you've gotten this far, you're probably thinking:
- "Can't I do all of this in `pandas` or `R`?"
- "What does this have to do with biology?"
The two crucial features that Hail adds are _scalability_ and the _domain-specific primitives_ needed to work easily with biological data. Fear not!... | github_jupyter |
```
# 1. Loading Libraries
# Importing NumPy and Panda
import pandas as pd
import numpy as np
# ---------Import libraries & modules for data visualizaiton
from pandas.plotting import scatter_matrix
from matplotlib import pyplot
# Importing scit-learn module to split the dataset into train/test sub-datasets
from skle... | github_jupyter |
# COCO Reader
Reader operator that reads a COCO dataset (or subset of COCO), which consists of an annotation file and the images directory.
`DALI_EXTRA_PATH` environment variable should point to the place where data from [DALI extra repository](https://github.com/NVIDIA/DALI_extra) is downloaded. Please make sure tha... | github_jupyter |

<a href="https://hub.callysto.ca/jupyter/hub/user-redirect/git-pull?repo=https%3A%2F%2Fgithub.com%2Fcallysto%2Fcurriculum-notebooks&branch=master&subPath=Mathematics/PatternsAndRelations/patter... | github_jupyter |
# Python code til udregning af data fra ATP
```
#Imports
```
# Udregninger
## Alder for at kunne blive tilbudt tidlig pension
```
#Årgange født i 1955-1960 har adgang til at søge i 2021.
#Man skal være fyldt 61 for at søge.
print(2021-61, "kan anmode om tidlig pension")
#Der indgår personer fra 6 1⁄2 årgange
pr... | github_jupyter |
# Practice Notebook: Methods and Classes
The code below defines an *Elevator* class. The elevator has a current floor, it also has a top and a bottom floor that are the minimum and maximum floors it can go to. Fill in the blanks to make the elevator go through the floors requested.
```
class Elevator:
def __init_... | github_jupyter |
# Worksheet 0.1.2: Python syntax (`while` loops)
<div class="alert alert-block alert-info">
This worksheet will invite you to tinker with the examples, as they are live code cells. Instead of the normal fill-in-the-blank style of notebook, feel free to mess with the code directly. Remember that -- to test things out -... | github_jupyter |
# "# backtesting with grid search"
> "Easily backtest a grid of parameters in a given trading strategy"
- toc: true
- branch: master
- badges: true
- comments: true
- author: Jerome de Leon
- categories: [grid search, backtest]
<a href="https://colab.research.google.com/github/enzoampil/fastquant/blob/master/examples... | github_jupyter |
<h1>Table of Contents<span class="tocSkip"></span></h1>
<div class="toc"><ul class="toc-item"><li><span><a href="#Stop-Reinventing-Pandas" data-toc-modified-id="Stop-Reinventing-Pandas-1"><span class="toc-item-num">1 </span>Stop Reinventing Pandas</a></span></li><li><span><a href="#First-Hacks!" data-toc-mod... | github_jupyter |
<h2> 6. Bayes Classification </h2>
This notebook has the code for the charts in Chapter 6
### Install BigQuery module
You don't need this on AI Platform, but you need this on plain-old JupyterLab
```
!pip install google-cloud-bigquery
%load_ext google.cloud.bigquery
```
### Setup
```
import os
PROJECT = 'data-sci... | github_jupyter |
```
import pandas as pd
from datetime import timedelta, date
import matplotlib.pyplot as plt
def append_it(date, amount,treasury,Agency,MBS, duration):
append_data = {'Date':[date], 'Amount':[amount], 'Duration':[duration],'Treasury':[treasury],'Agency':[Agency], 'MBS':[MBS]}
append_df = pd.DataFrame(append_da... | github_jupyter |
# Time series analysis (Pandas)
Nikolay Koldunov
koldunovn@gmail.com
================
Here I am going to show just some basic [pandas](http://pandas.pydata.org/) stuff for time series analysis, as I think for the Earth Scientists it's the most interesting topic. If you find this small tutorial useful, I encourage y... | github_jupyter |
## 1. Google Play Store apps and reviews
<p>Mobile apps are everywhere. They are easy to create and can be lucrative. Because of these two factors, more and more apps are being developed. In this notebook, we will do a comprehensive analysis of the Android app market by comparing over ten thousand apps in Google Play a... | github_jupyter |
<a href="https://colab.research.google.com/github/ksetdekov/HSE_DS/blob/master/07%20NLP/kaggle%20hw/solution.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
```
# !pip3 install kaggle
from google.colab import files
files.upload()
!mkdir ~/.kaggle
!c... | github_jupyter |
# Minimal end-to-end causal analysis with ```cause2e```
This notebook shows a minimal example of how ```cause2e``` can be used as a standalone package for end-to-end causal analysis. It illustrates how we can proceed in stringing together many causal techniques that have previously required fitting together various alg... | github_jupyter |
# Training Keyword Spotting
This notebook builds on the Colab in which we used the pre-trained [micro_speech](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/micro/examples/micro_speech) example as well as the HarvardX [3_5_18_TrainingKeywordSpotting.ipynb](https://github.com/tinyMLx/colabs) and [4... | github_jupyter |
```
import pandas as pd
import numpy as np
import seaborn as sns
%matplotlib inline
cc = pd.read_csv('./posts_ccompare_raw.csv', index_col=0, encoding='utf-8')
cc['Timestamp'] = pd.to_datetime(cc['Timestamp'])
```
# Reaction features
```
features_reactions = pd.DataFrame(index=cc.index)
features_reactions['n_up'] = c... | github_jupyter |
```
import os
import json
import pandas as pd
from tqdm import tqdm_notebook
df_larval = pd.read_csv(os.path.join('..', 'data', 'breeding-sites', 'larval-survey-en.csv'))
df_larval.head()
```
## Shapefile
```
with open(os.path.join('..', 'data','shapefiles','Nakhon-Si-Thammarat.geojson')) as f:
data = json.load(... | github_jupyter |
```
# Les imports pour l'exercice
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import string
import random
from collections import deque
```
## Partie 1 : Code de César
### Implementation
Le code suivant contient deux fonctions principales : `encryptMessage` et `decryptMessage`.
Ces fonct... | github_jupyter |
```
# Run in python console
import nltk; nltk.download('stopwords')
```
Import Packages
```
import re
import numpy as np
import pandas as pd
from pprint import pprint
# Gensim
import gensim
import gensim.corpora as corpora
from gensim.utils import simple_preprocess
from gensim.models import CoherenceModel
# spacy ... | github_jupyter |
# Evaluate AminoAcids Prediction
```
%matplotlib inline
import pylab
pylab.rcParams['figure.figsize'] = (15.0, 12.0)
import os
import sys
import numpy as np
from shutil import copyfile
from src.python.aa_predict import *
import src.python.aa_predict as AA
checkpoint_path = "../../data/trained/aapred_cnn_lates... | github_jupyter |
# Nearest neighbors
This notebook illustrates the classification of the nodes of a graph by the [k-nearest neighbors algorithm](https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm), based on the labels of a few nodes.
```
from IPython.display import SVG
import numpy as np
from sknetwork.data import karate_clu... | github_jupyter |
```
import pandas as pd
from matplotlib.ticker import FuncFormatter
from Cohort import CohortTable
import numpy as np
import altair as alt
import math
from IPython.display import display, Markdown
# Pulled from class module; need to remove self references
def print_all_tables(self):
display(Markdown('## Product... | github_jupyter |
# WorkFlow
## Classes
## Load the data
## Test Modelling
## Modelling
**<hr>**
## Classes
```
NAME = "change the conv2d"
BATCH_SIZE = 32
import os
import cv2
import torch
import numpy as np
def load_data(img_size=112):
data = []
index = -1
labels = {}
for directory in os.listdir('./data/'):
... | github_jupyter |
# Modes of a Vibrating Building
In this notebook we will find the vibrational modes of a simple model of a building. We will assume that the mass of the floors are much more than the mass of the walls and that the lateral stiffness of the walls can be modeled by a simple linear spring. We will investigate how the buil... | github_jupyter |
<!-- dom:TITLE: Week 2 January 11-15: Introduction to the course and start Variational Monte Carlo -->
# Week 2 January 11-15: Introduction to the course and start Variational Monte Carlo
<!-- dom:AUTHOR: Morten Hjorth-Jensen Email morten.hjorth-jensen@fys.uio.no at Department of Physics and Center fo Computing in Sci... | github_jupyter |
## Step 1: Import Libraries
```
# All imports
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import missingno
import seaborn as sns
from sklearn.feature_selection import SelectKBest, f_regression
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import ... | github_jupyter |
```
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | github_jupyter |
```
#hide
#skip
! [ -e /content ] && pip install -Uqq fastai # upgrade fastai on colab
#default_exp data.transforms
#export
from fastai.torch_basics import *
from fastai.data.core import *
from fastai.data.load import *
from fastai.data.external import *
from sklearn.model_selection import train_test_split
#hide
from... | github_jupyter |

[](https://colab.research.google.com/github/JohnSnowLabs/nlu/blob/master/examples/webinars_conferences_etc/multi_lingual_webinar/4_Unsupervise_Chinese_Keyword_Extraction_NER_an... | github_jupyter |
# 📃 Solution for Exercise M1.04
The goal of this exercise is to evaluate the impact of using an arbitrary
integer encoding for categorical variables along with a linear
classification model such as Logistic Regression.
To do so, let's try to use `OrdinalEncoder` to preprocess the categorical
variables. This preproce... | github_jupyter |
## Face and Facial Keypoint detection
After you've trained a neural network to detect facial keypoints, you can then apply this network to *any* image that includes faces. The neural network expects a Tensor of a certain size as input and, so, to detect any face, you'll first have to do some pre-processing.
1. Detect... | github_jupyter |
```
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import gzip
#loading the data from the given file
image_size = 28
num_images = 55000
f = gzip.open('train-images-idx3-ubyte.gz','r')
f.read(16)
buf = f.read(image_size * image_size * num_images)
data = np.frombuffer(buf, dtype=np.uint8).astype... | 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 |
# NumPy
Numpy is the core library for scientific computing in Python. <br/>
It provides a high-performance multidimensional array object, and tools for working with these arrays. <br/>
Official NumPy Documentation: https://numpy.org/doc/stable/reference/
```
# Install NumPy
# ! pip install numpy
```
Since NumPy is n... | github_jupyter |
# Backtest Orbit Model
In this section, we will cover:
- How to create a TimeSeriesSplitter
- How to create a BackTester and retrieve the backtesting results
- How to leverage the backtesting to tune the hyper-paramters for orbit models
```
%matplotlib inline
import pandas as pd
import numpy as np
import matplotlib... | github_jupyter |
# Representação numérica de palavras e textos
Neste notebook iremos apresentação formas de representar valores textuais por meio de representação numérica. Iremos usar pandas, caso queira entender um pouco sobre pandas, [veja este notebook](pandas.ipynb). Por isso, não esqueça de instalar o módulo pandas:
``pip3 inst... | github_jupyter |
# Machine Learning Engineer Nanodegree
## Reinforcement Learning
## Project: Train a Smartcab to Drive
Welcome to the fourth project of the Machine Learning Engineer Nanodegree! In this notebook, template code has already been provided for you to aid in your analysis of the *Smartcab* and your implemented learning alg... | github_jupyter |
# Hash Codes
Consider the challenges associated with the 16-bit hashcode for a character string `s` that sums the Unicode values of the characters in `s`.
For example, let `s = "stop"`. It's unicode character representation is:
```
for char in "stop":
print(char + ': ' + str(ord(char)))
sum([ord(x) for x in "stop... | github_jupyter |
```
import tensorflow as tf
import matplotlib.pyplot as plt
from sklearn.pipeline import Pipeline
from sklearn import datasets, linear_model
from sklearn import cross_validation
import numpy as np
import pandas as pd
from sklearn import preprocessing
df = pd.read_excel("data0505.xlsx",header=0)
# clean up data
df = df... | github_jupyter |
```
import numpy as np
import scipy
from scipy import sparse
import scipy.sparse.linalg
import matplotlib.pyplot as plt
%matplotlib inline
# part a)
Id = sparse.csr_matrix(np.eye(2))
Sx = sparse.csr_matrix([[0., 1.], [1., 0.]])
Sz = sparse.csr_matrix([[1., 0.], [0., -1.]])
print(Sz.shape)
# part b)
def singesite_to_ful... | github_jupyter |
<center><img src="./images/logo_fmkn.png" width=300 style="display: inline-block;"></center>
## Машинное обучение
### Семинар 13. ЕМ-алгоритм
<br />
<br />
9 декабря 2021
Будем решать задачу восставновления картинки лица по набору зашумленных картинок (взято с курса deep bayes 2018 https://github.com/bayesgroup/dee... | github_jupyter |
# Project 3: Smart Beta Portfolio and Portfolio Optimization
## Overview
Smart beta has a broad meaning, but we can say in practice that when we use the universe of stocks from an index, and then apply some weighting scheme other than market cap weighting, it can be considered a type of smart beta fund. A Smart Bet... | github_jupyter |
# Homework: Basic Artificial Neural Networks
```
%matplotlib inline
from time import time, sleep
import numpy as np
import matplotlib.pyplot as plt
from IPython import display
```
# Framework
Implement everything in `Modules.ipynb`. Read all the comments thoughtfully to ease the pain. Please try not to change the pr... | github_jupyter |
```
!date
import numpy as np, pandas as pd, matplotlib.pyplot as plt, seaborn as sns
%matplotlib inline
sns.set_context('paper')
sns.set_style('darkgrid')
```
# Mixture Model in PyMC3
Original NB by Abe Flaxman, modified by Thomas Wiecki
```
import pymc3 as pm, theano.tensor as tt
# simulate data from a known mixtur... | github_jupyter |
### Neural style transfer in PyTorch
This tutorial implements the "slow" neural style transfer based on the VGG19 model.
It closely follows the official neural style tutorial you can find [here](http://pytorch.org/tutorials/advanced/neural_style_tutorial.html).
__Note:__ if you didn't sit through the explanation of ... | github_jupyter |
## Implementing a 1D convnet
In Keras, you would use a 1D convnet via the `Conv1D` layer, which has a very similar interface to `Conv2D`. It **takes as input 3D tensors with shape (samples, time, features) and also returns similarly-shaped 3D tensors**. The convolution window is a 1D window on the temporal axis, axis ... | github_jupyter |
<a href="https://colab.research.google.com/github/samarth0174/Face-Recognition-pca-svm/blob/master/Facial_Recognition(Exercise).ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# **In this project we implement the Identification system using Machine ... | github_jupyter |
```
!pip install torch # framework
!pip install --upgrade reedsolo
!pip install --upgrade librosa
!pip install torchvision
#!pip install torchaudio
#!pip install tensorboard
#!pip install soundfile
!pip install librosa==0.7.1
from google.colab import drive
drive.mount('/content/drive',force_remount=True)
%cd /content... | github_jupyter |
# **[Adversarial Disturbances for Controller Verification](http://proceedings.mlr.press/v144/ghai21a/ghai21a.pdf)**
[](https://colab.research.google.com/github/google/nsc-tutorial/blob/main/controller-verification.ipynb)
## Housekeeping
Imports... | github_jupyter |
## Appendix (Application of the mutual fund theorem)
```
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import FinanceDataReader as fdr
import pandas as pd
ticker_list = ['069500']
df_list = [fdr.DataReader(ticker, '2015-01-01', '2016-12-31')['Change'] for ticker in ticker_list]
df = pd.conc... | github_jupyter |
## 前言
本文主要讨论如何把pandas移植到spark, 他们的dataframe共有一些特性如操作方法和模式。pandas的灵活性比spark强, 但是经过一些改动spark基本上能完成相同的工作。
同时又兼具了扩展性的优势,当然他们的语法和用法稍稍有些不同。
## 主要不同处:
### 分布式处理
pandas只能单机处理, 把dataframe放进内存计算。spark是集群分布式地,可以处理的数据可以大大超出集群的内存数。
### 懒执行
spark不执行任何`transformation`直到需要运行`action`方法,`action`一般是存储或者展示数据的操作。这种将`transformation`延后的做法... | github_jupyter |
# Putting the "Re" in Reformer: Ungraded Lab
This ungraded lab will explore Reversible Residual Networks. You will use these networks in this week's assignment that utilizes the Reformer model. It is based on on the Transformer model you already know, but with two unique features.
* Locality Sensitive Hashing (LSH) Att... | github_jupyter |
The visualization used for this homework is based on Alexandr Verinov's code.
# Generative models
In this homework we will try several criterions for learning an implicit model. Almost everything is written for you, and you only need to implement the objective for the game and play around with the model.
**0)** Rea... | github_jupyter |
```
import sys
import os
import h5py
import json
import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
import IPython.display as ipd
from stimuli_f0_labels import get_f0_bins, f0_to_label
fn = '/om4/group/mcdermott/user/msaddler/pitchnet_dataset/pitchnetDataset/assets/data/processed/dataset_2019-11-22... | github_jupyter |
# Image Classification
The *Computer Vision* cognitive service provides useful pre-built models for working with images, but you'll often need to train your own model for computer vision. For example, suppose the Northwind Traders retail company wants to create an automated checkout system that identifies the grocery ... | github_jupyter |
## Deploy a simple S3 dispersed storage archive solution
#### Requirements
In order to be able to deploy this example deployment you will have to have the following components activated
- the 3Bot SDK, in the form of a local container with the SDK, or a grid based SDK container. Getting started instuctions are [here]... | github_jupyter |
```
%pylab inline
import numpy as np
import pandas as pd
import scipy.stats
from matplotlib.backends.backend_pdf import PdfPages
import sys
sys.path.append("../errortools/")
import errortools
```
# Fitting and predicting
```
ndim = 3
fit_intercept = True
ndata = 100
p_true = [2, 0, -2, 0]
np.random.seed(42)
X = np.r... | github_jupyter |
```
import this
print("this is my first program. ")
len("fazlullah")
a = 10
a
type(a)
b = 45.5
type(b)
c = "fazlullah"
type(c)
d = 5+6j
type(d)
g = True
type(g)
*a = 67
_a = 88
type(a)
a = 34
type(_a)
a, b, c, d, e = 124,"fazlullah",6+8j,False,88.2
a
b
c
a = "sudh"
a+str(4)
True + True
True - False
1 + True
a = input()... | github_jupyter |
# Deploy a Trained MXNet Model
In this notebook, we walk through the process of deploying a trained model to a SageMaker endpoint. If you recently ran [the notebook for training](get_started_mnist_deploy.ipynb) with %store% magic, the `model_data` can be restored. Otherwise, we retrieve the
model artifact from a publi... | github_jupyter |
```
%matplotlib inline
```
PyTorch 1.0 Distributed Trainer with Amazon AWS
===============================================
**Author**: `Nathan Inkawhich <https://github.com/inkawhich>`_
**Edited by**: `Teng Li <https://github.com/teng-li>`_
In this tutorial we will show how to setup, code, and run a PyTorch 1.0
di... | github_jupyter |
```
# Copyright 2021 Google LLC
# Use of this source code is governed by an MIT-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.
# Notebook authors: Kevin P. Murphy (murphyk@gmail.com)
# and Mahmoud Soliman (mjs@aucegypt.edu)
# This notebook reproduces figures for chap... | github_jupyter |
```
import xarray as xr
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
from scipy.io import loadmat
#where to find the data
adir= 'F:/data/fluxsat/WS_SST_Correlation/'
#read in the data
ds1=xr.open_dataset(adir+'Corr_High_redone.nc')
ds1.close()
ds2=xr.open_dataset(adir+'Corr_Full.nc') #Full: corelation... | github_jupyter |
# Copy Task Plots
```
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from glob import glob
import json
import os
import sys
sys.path.append(os.path.abspath(os.getcwd() + "./../"))
%matplotlib inline
```
## Load training history
To generate the models and training history used in this notebo... | github_jupyter |
# Imports & Installations
```
!pip install pyforest
!pip install plotnine
!pip install transformers
!pip install psycopg2-binary
!pip uninstall -y tensorflow-datasets
!pip install lit_nlp tfds-nightly transformers==4.1.1
# Automatic library importer (doesn't quite import everything yet)
from pyforest import *
# Expan... | github_jupyter |
### 1. Gradient Descent Tips
*Nhắc lại*: Công thức cập nhật $\theta$ ở vòng lặp thứ $t$:
<center>$\theta_{t+1} := \theta_t - \alpha \Delta_{\theta} f(\theta_t)$</center>
Trong đó:
- $\alpha$: learning rate - tốc độ học tập.
- $\Delta_{\theta} f(\theta_t)$: đạo hàm của hàm số tại điểm $\theta$.
Việc lựa chọn giá trị... | github_jupyter |
# Lecture 8: p-hacking and Multiple Comparisons
[J. Nathan Matias](https://github.com/natematias)
[SOC412](https://natematias.com/courses/soc412/), February 2019
In Lecture 8, we discussed Stephanie Lee's story about [Brian Wansink](https://www.buzzfeednews.com/article/stephaniemlee/brian-wansink-cornell-p-hacking#.bt... | github_jupyter |
# Measles Incidence in Altair
This is an example of reproducing the Wall Street Journal's famous [Measles Incidence Plot](http://graphics.wsj.com/infectious-diseases-and-vaccines/#b02g20t20w15) in Python using [Altair](http://github.com/ellisonbg/altair/).
## The Data
We'll start by downloading the data. Fortunately... | github_jupyter |
```
%matplotlib inline
%load_ext autoreload
%autoreload 2
from __future__ import print_function
import math
import matplotlib.pyplot as plt
import numpy as np
import os
import sys
import time
from pydrake.solvers.mathematicalprogram import MathematicalProgram, Solve
from pydrake.solvers.ipopt import IpoptSolver
mp = ... | github_jupyter |
# Using the Prediction Model
## Environment
```
import getpass
import json
import os
import sys
import time
import pandas as pd
from tqdm import tqdm_notebook as tqdm
from seffnet.constants import (
DEFAULT_EMBEDDINGS_PATH, DEFAULT_GRAPH_PATH,
DEFAULT_MAPPING_PATH, DEFAULT_PREDICTIVE_MODEL_PATH,
RESOURC... | github_jupyter |
# ex05-Filtering a Query with WHERE
Sometimes, you’ll want to only check the rows returned by a query, where one or more columns meet certain criteria. This can be done with a WHERE statement. The WHERE clause is an optional clause of the SELECT statement. It appears after the FROM clause as the following statement:
>... | github_jupyter |
```
!pip3 install qiskit
import qiskit
constant_index_dictionary = {}
constant_index_dictionary['0000'] = [0, 2]
constant_index_dictionary['0001'] = [2, 3]
constant_index_dictionary['0010'] = [0, 1]
constant_index_dictionary['0011'] = [1, 3]
constant_index_dictionary['0100'] = [2, 3]
constant_index_dictionary['0101'] =... | github_jupyter |
# Test web application locally
This notebook pulls some images and tests them against the local web app running inside the Docker container we made previously.
```
import matplotlib.pyplot as plt
import numpy as np
from testing_utilities import *
import requests
%matplotlib inline
%load_ext autoreload
%autoreload 2
... | github_jupyter |
# Data analysis with Python, Apache Spark, and PixieDust
***
In this notebook you will:
* analyze customer demographics, such as, age, gender, income, and location
* combine that data with sales data to examine trends for product categories, transaction types, and product popularity
* load data from GitHub as well a... | github_jupyter |
# REINFORCE in lasagne
Just like we did before for q-learning, this time we'll design a lasagne network to learn `CartPole-v0` via policy gradient (REINFORCE).
Most of the code in this notebook is taken from approximate qlearning, so you'll find it more or less familiar and even simpler.
__Frameworks__ - we'll accep... | github_jupyter |
# 📝 Exercise M3.02
The goal is to find the best set of hyperparameters which maximize the
generalization performance on a training set.
Here again with limit the size of the training set to make computation
run faster. Feel free to increase the `train_size` value if your computer
is powerful enough.
```
import num... | github_jupyter |
```
# Description: Plot Figure 3 (Overview of wind, wave and density stratification during the field experiment).
# Author: André Palóczy
# E-mail: paloczy@gmail.com
# Date: December/2020
import numpy as np
from matplotlib import pyplot as plt
import matplotlib.dates as mdates
from pandas import Timest... | github_jupyter |
## Stage 3: What do I need to install?
Maybe your experience looks like the typical python dependency management (https://xkcd.com/1987/):
<img src=https://imgs.xkcd.com/comics/python_environment.png>
Furthermore, data science packages can have all sorts of additional non-Python dependencies which makes things even m... | github_jupyter |
WKN strings can be converted to the following formats via the `output_format` parameter:
* `compact`: only number strings without any seperators or whitespace, like "A0MNRK"
* `standard`: WKN strings with proper whitespace in the proper places. Note that in the case of WKN, the compact format is the same as the standa... | github_jupyter |
```
from google.colab import drive
drive.mount('/content/gdrive')
!git clone https://github.com/NVIDIA/pix2pixHD.git
import os
os.chdir('pix2pixHD/')
# !chmod 755 /content/gdrive/My\ Drive/Images_for_GAN/datasets/download_convert_apples_dataset.sh
# !/content/gdrive/My\ Drive/Images_for_GAN/datasets/download_convert_ap... | github_jupyter |
<table class="ee-notebook-buttons" align="left">
<td><a target="_blank" href="https://github.com/giswqs/earthengine-py-notebooks/tree/master/Image/texture.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td>
<td><a target="_blank" href="https://... | github_jupyter |
## TFMA Notebook example
This notebook describes how to export your model for TFMA and demonstrates the analysis tooling it offers.
Note: Please make sure to follow the instructions in [README.md](https://github.com/tensorflow/tfx/blob/master/tfx/examples/chicago_taxi/README.md) when running this notebook
## Setup
I... | github_jupyter |
# Conservative remapping
```
import xgcm
import xarray as xr
import numpy as np
import xbasin
```
We open the example data and create 2 grids: 1 for the dataset we have and 1 for the remapped one.
Here '_fr' means *from* and '_to' *to* (i.e. remapped data).
```
ds = xr.open_dataset('data/nemo_output_ex.nc')
from xn... | github_jupyter |
# DeepDreaming with TensorFlow
>[Loading and displaying the model graph](#loading)
>[Naive feature visualization](#naive)
>[Multiscale image generation](#multiscale)
>[Laplacian Pyramid Gradient Normalization](#laplacian)
>[Playing with feature visualzations](#playing)
>[DeepDream](#deepdream)
This notebook demo... | github_jupyter |
**[Introduction to Machine Learning Home Page](https://www.kaggle.com/learn/intro-to-machine-learning)**
---
## Recap
Here's the code you've written so far.
```
# code you have previously used
# load data
import pandas as pd
iowa_file_path = '../input/home-data-for-ml-course/train.csv'
home_data = pd.read_csv(iowa_... | github_jupyter |
We will use this notebook to calculate and visualize statistics of our chess move dataset. This will allow us to better understand our limitations and help diagnose problems we may encounter down the road when training/defining our model.
```
import pdb
import numpy as np
import matplotlib.pyplot as plt
%matplotlib in... | github_jupyter |
This notebook will set up colab so that you can run the SYCL blur lab for the module "Introduction to SYCYL programming" created by the TOUCH project. (https://github.com/TeachingUndergradsCHC/modules/tree/master/Programming/sycl). The initial setup instructions are created following slides by Aksel Alpay
https://www... | github_jupyter |
# Classification of Chest and Abdominal X-rays
Code Source: Lakhani, P., Gray, D.L., Pett, C.R. et al. J Digit Imaging (2018) 31: 283. https://doi.org/10.1007/s10278-018-0079-6
The code to download and prepare dataset had been modified form the original source code.
```
# load requirements for the Keras library
from... | github_jupyter |
<a href="https://colab.research.google.com/github/hadisotudeh/zestyAI_challenge/blob/main/Zesty_AI_Data_Scientist_Assignment_%7C_Hadi_Sotudeh.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
<center> <h1><b>Zesty AI Data Science Interview Task - Hadi... | github_jupyter |
## Bengaluru House Price
```
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
pd.set_option("display.max_rows", None, "display.max_columns", None)
df1=pd.read_csv("Dataset/Bengaluru_House_Data.csv")
df1.head()
```
### Data Cleaning
```
df1.info()
df1.isnull().sum()
df1.groupby('area_type')['are... | github_jupyter |
```
from python_dict_wrapper import wrap
import sys
sys.path.append('../')
import torch
sys.path.append("../../CPC/dpc")
sys.path.append("../../CPC/backbone")
import matplotlib.pyplot as plt
import numpy as np
import scipy
def find_dominant_orientation(W):
Wf = abs(np.fft.fft2(W))
orient_sel = 1 - Wf[0, 0] / W... | github_jupyter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.