Objective: investigate the relationship between drug dosage and the efficacy
Objective: investigate the relationship between drug dosage and the efficacy
Objective: investigate the relationship between drug dosage and the efficacy
Terminology Alert🤯!!!
That is, to minimize the loss function
SSR= Σni=1(Observedi−Predictedi)2
Predicted ~ σ1∗w3+σ2∗w4 σ(z)=log(1+ez)
z=w1∗x
derivative = dSSRdw1 = dSSRdpred dpreddσ dσdz* dzdw1
new w1 = old w1 - α * derivative
Amazing, this box of cereal gave me a perfectly balanced breakfast, as all things should be. I only ate half of it but will definitely be buying again!
Example 2: stock price prediction
company 1: Day1, Day2 , Day3 , Day4 ,... Dayn;
company 2: Day1001, Day1002 , Day1003 , Day1004 ,... Day100...
Different amounts of input
Based on historical information (correlation)
So, traditional NN does not work in these scenarios
Given yesterday's and today's stock prices (i.e., time series data), noted as xt−1 and xt, we want to predict tomorrow's stock price.
Given yesterday's and today's stock prices (i.e., time series data), noted as xt−1 and xt, we want to predict tomorrow's stock price.
Given yesterday's and today's stock prices (i.e., time series data), noted as xt−1 and xt, we want to predict tomorrow's stock price.
A little bit of formulation...
Given yesterday's and today's stock prices (i.e., time series data), noted as xt−1 and xt, we want to predict tomorrow's stock price.
A little bit of formulation...
ht−1 = tanh(w1∗xt−1+b1)
Given yesterday's and today's stock prices (i.e., time series data), noted as xt−1 and xt, we want to predict tomorrow's stock price.
A little bit of formulation...
ht−1 = tanh(w1∗xt−1+b1)
ht= tanh(w2∗ht−1 + w1∗xt + b1)
Given yesterday's and today's stock prices (i.e., time series data), noted as xt−1 and xt, we want to predict tomorrow's stock price.
A little bit of formulation...
ht−1 = tanh(w1∗xt−1+b1)
ht= tanh(w2∗ht−1 + w1∗xt + b1)
btw ht is called the hidden state
ht−1 = tanh(w1∗xt−1+b1)
ht= tanh(w2∗ht−1 + w1∗xt + b1)
RNNs have the following properties:
(Reminder: skip the following two pages if not interested)
Taken the stock price prediction task, suppose we had 100 sequential days of stock price data
The gradient/step size: dSSRdw1 = dSSRdpred dpreddh dhdz dzdw1, where z = w1 x1 + b1
h1 = tanh(w1∗x1+b1);
h2= tanh(w2∗h1 + w1∗x2 + b1)
h3 = tanh(w2∗h2 + w1∗x3 + b1)
simplified: h3 ~ f[w2∗f[w2∗f(w1∗x1)]]
... ...
h100 ~ f[w2∗f[w2∗f[w2∗f[w2∗....f[w2∗f(w1∗x1)]]]]] ~ ffff...f(w992∗w1∗x1)
continued, see next page
The gradient: dSSRdw1 = dSSRdpred dpreddh dhdz dzdw1, where z = w1 x1 + b1
h100 ~ f[w2∗f[w2∗f[w2∗f[w2∗....f[w2∗f(w1∗x1)]]]]] ~ ffff...f(w992∗w1∗x1)
dzdw1 = x1∗w992,so the gradient will be like: dSSRdw1 = something* w992
new w = old w - α * derivative
If w2>1, gradient explodes; if w2<1, gradient vanishes
Previous example: Amazing, this box of cereal gave me a perfectly balanced breakfast, as all things should be. I only ate half of it but will definitely be buying again!
import numpy as npfrom keras.models import Sequentialfrom keras.layers import LSTMfrom keras.layers import Dense, Dropoutimport pandas as pdfrom matplotlib import pyplot as pltfrom sklearn.preprocessing import StandardScalerimport seaborn as sns
df = pd.read_csv("data/GE.csv")train_datesdates = pd.to_datetime(df['Date'])cols = list(df)[1:6]df_for_training = df[cols].astype(float)## scale the datascaler = StandardScaler()scaler = scaler.fit(df_for_training)df_for_training_scaled = scaler.transform(df_for_training)
## preview first five rowsdf_for_training.head(5)
## Open High Low Close Adj Close## 0 101.290001 103.510002 101.059998 103.269997 102.884109## 1 103.360001 105.129997 102.550003 104.699997 104.308762## 2 104.459999 104.620003 102.839996 103.379997 102.993690## 3 103.900002 106.150002 103.900002 106.089996 105.693565## 4 106.330002 106.459999 104.800003 105.190002 104.796944
Objective: investigate the relationship between drug dosage and the efficacy
Keyboard shortcuts
↑, ←, Pg Up, k | Go to previous slide |
↓, →, Pg Dn, Space, j | Go to next slide |
Home | Go to first slide |
End | Go to last slide |
Number + Return | Go to specific slide |
b / m / f | Toggle blackout / mirrored / fullscreen mode |
c | Clone slideshow |
p | Toggle presenter mode |
t | Restart the presentation timer |
?, h | Toggle this help |
o | Tile View: Overview of Slides |
s | Toggle scribble toolbox |
Alt + f | Fit Slides to Screen |
Esc | Back to slideshow |
Objective: investigate the relationship between drug dosage and the efficacy
Objective: investigate the relationship between drug dosage and the efficacy
Objective: investigate the relationship between drug dosage and the efficacy
Terminology Alert🤯!!!
That is, to minimize the loss function
SSR= Σni=1(Observedi−Predictedi)2
Predicted ~ σ1∗w3+σ2∗w4 σ(z)=log(1+ez)
z=w1∗x
derivative = dSSRdw1 = dSSRdpred dpreddσ dσdz* dzdw1
new w1 = old w1 - α * derivative
Amazing, this box of cereal gave me a perfectly balanced breakfast, as all things should be. I only ate half of it but will definitely be buying again!
Example 2: stock price prediction
company 1: Day1, Day2 , Day3 , Day4 ,... Dayn;
company 2: Day1001, Day1002 , Day1003 , Day1004 ,... Day100...
Different amounts of input
Based on historical information (correlation)
So, traditional NN does not work in these scenarios
Given yesterday's and today's stock prices (i.e., time series data), noted as xt−1 and xt, we want to predict tomorrow's stock price.
Given yesterday's and today's stock prices (i.e., time series data), noted as xt−1 and xt, we want to predict tomorrow's stock price.
Given yesterday's and today's stock prices (i.e., time series data), noted as xt−1 and xt, we want to predict tomorrow's stock price.
A little bit of formulation...
Given yesterday's and today's stock prices (i.e., time series data), noted as xt−1 and xt, we want to predict tomorrow's stock price.
A little bit of formulation...
ht−1 = tanh(w1∗xt−1+b1)
Given yesterday's and today's stock prices (i.e., time series data), noted as xt−1 and xt, we want to predict tomorrow's stock price.
A little bit of formulation...
ht−1 = tanh(w1∗xt−1+b1)
ht= tanh(w2∗ht−1 + w1∗xt + b1)
Given yesterday's and today's stock prices (i.e., time series data), noted as xt−1 and xt, we want to predict tomorrow's stock price.
A little bit of formulation...
ht−1 = tanh(w1∗xt−1+b1)
ht= tanh(w2∗ht−1 + w1∗xt + b1)
btw ht is called the hidden state
ht−1 = tanh(w1∗xt−1+b1)
ht= tanh(w2∗ht−1 + w1∗xt + b1)
RNNs have the following properties:
(Reminder: skip the following two pages if not interested)
Taken the stock price prediction task, suppose we had 100 sequential days of stock price data
The gradient/step size: dSSRdw1 = dSSRdpred dpreddh dhdz dzdw1, where z = w1 x1 + b1
h1 = tanh(w1∗x1+b1);
h2= tanh(w2∗h1 + w1∗x2 + b1)
h3 = tanh(w2∗h2 + w1∗x3 + b1)
simplified: h3 ~ f[w2∗f[w2∗f(w1∗x1)]]
... ...
h100 ~ f[w2∗f[w2∗f[w2∗f[w2∗....f[w2∗f(w1∗x1)]]]]] ~ ffff...f(w992∗w1∗x1)
continued, see next page
The gradient: dSSRdw1 = dSSRdpred dpreddh dhdz dzdw1, where z = w1 x1 + b1
h100 ~ f[w2∗f[w2∗f[w2∗f[w2∗....f[w2∗f(w1∗x1)]]]]] ~ ffff...f(w992∗w1∗x1)
dzdw1 = x1∗w992,so the gradient will be like: dSSRdw1 = something* w992
new w = old w - α * derivative
If w2>1, gradient explodes; if w2<1, gradient vanishes
Previous example: Amazing, this box of cereal gave me a perfectly balanced breakfast, as all things should be. I only ate half of it but will definitely be buying again!
import numpy as npfrom keras.models import Sequentialfrom keras.layers import LSTMfrom keras.layers import Dense, Dropoutimport pandas as pdfrom matplotlib import pyplot as pltfrom sklearn.preprocessing import StandardScalerimport seaborn as sns
df = pd.read_csv("data/GE.csv")train_datesdates = pd.to_datetime(df['Date'])cols = list(df)[1:6]df_for_training = df[cols].astype(float)## scale the datascaler = StandardScaler()scaler = scaler.fit(df_for_training)df_for_training_scaled = scaler.transform(df_for_training)
## preview first five rowsdf_for_training.head(5)
## Open High Low Close Adj Close## 0 101.290001 103.510002 101.059998 103.269997 102.884109## 1 103.360001 105.129997 102.550003 104.699997 104.308762## 2 104.459999 104.620003 102.839996 103.379997 102.993690## 3 103.900002 106.150002 103.900002 106.089996 105.693565## 4 106.330002 106.459999 104.800003 105.190002 104.796944