Skip to content

Commit

Permalink
add compact LSTM example
Browse files Browse the repository at this point in the history
  • Loading branch information
briangu committed Dec 24, 2023
1 parent 175005d commit 52eaa4d
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions examples/stocks/yfinance/compact_lstm.kg
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,13 @@
fetch::{[args];args:::{};args,"tickers",,x;args,"start",,y;args,"end",,z;.pyc(download;[];args)}

T::.table(fetch("MSFT";"2020-01-01"; "2023-01-01"]))

close::T?"Close"
k::10;windows::mkwindows(close;k)
close::T?"Close";k::10;windows::mkwindows(close;k)
windows::mkwindows(close;k);labels::{x@-1}'1_windows;windows::(-1)_windows
wmax::{(x@>x)@0}'windows;windows::wmax{y%x}'windows;labels::wmax{y%x}'labels
trainx::(-1)_windows;trainy::(-1)_labels;testx::windows@-1;testy::labels@-1

m::model(1;10;1)
t::trainer(m)
p::predictor(m)
m::model(1;10;1);t::trainer(m);p::predictor(m)

loss::trainx t'trainy

.d("prediction: ");.d((wmax@-1)*p(testx));.d(" should be close to ");.p((wmax@-1)*testy)

0 comments on commit 52eaa4d

Please sign in to comment.