Commit 61df182e authored by Ilya Prokhorov's avatar Ilya Prokhorov

csv format changed to original, input for filename, input for prophet days

parent 69447964
"ds","y","Open","High","Low","Vol.","Change %"
"Date","Price","Open","High","Low","Vol.","Change %"
"Jan 01, 2019","3,814.9","3,832.6","3,893.6","3,788.4","9.94K","-0.41%"
"Dec 31, 2018","3,830.5","3,976.7","3,986.9","3,779.5","15.79K","-3.72%"
"Dec 30, 2018","3,978.3","3,893.8","4,003.0","3,845.2","17.73K","2.35%"
......
......@@ -2,18 +2,24 @@ library(prophet)
library(anytime)
library(readr)
print("Facebook prophet example by Demens Deum (demensdeum@gmail.com)")
cat("Facebook prophet example by Demens Deum (demensdeum@gmail.com)\n")
cat("csv file (btc_usd.csv): ")
filename <- readLines("stdin", n = 1);
df <- read.csv(filename, colClasses = "character")
df <- read.csv("btc_usd.csv", colClasses = "character")
df$ds = anydate(df$ds)
df$y = parse_number(df$y)
cat("Prophet days (1-365): ")
prophetDays <- readLines("stdin", n = 1)
prophetDays = parse_number(prophetDays)
df$ds = anydate(df$Date)
df$y = parse_number(df$Price)
df$Open = parse_number(df$Open)
df$High = parse_number(df$High)
df$Low = parse_number(df$Low)
str(df)
m <- prophet(df)
future <- make_future_dataframe(m, periods = 365)
future <- make_future_dataframe(m, periods = prophetDays)
forecast <- predict(m, future)
tail(forecast[c('ds', 'yhat')])
prophet_plot_components(m, forecast)
\ No newline at end of file
"ds","y","Open","High","Low","Change"
"Date","Price","Open","High","Low","Change"
"Dec 29, 2018","69.8319","69.5012","69.9427","69.4057","0.48%"
"Dec 28, 2018","69.5012","69.5675","69.7009","69.2498","-0.10%"
"Dec 27, 2018","69.5675","68.6993","69.7500","68.5650","1.26%"
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment