TuanScientist commited on
Commit
aa9eeb1
·
1 Parent(s): 81e6ab5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -20
app.py CHANGED
@@ -13,26 +13,15 @@ df = df.rename(columns={"Date": "ds", "Price": "y"})
13
  df.fillna(method='ffill', inplace=True)
14
  df.dropna(inplace=True)
15
 
16
- m = NeuralProphet(
17
- n_forecasts=45,
18
- n_lags=30,
19
- changepoints_range=1.2,
20
- num_hidden_layers=6,
21
- daily_seasonality=False,
22
- weekly_seasonality=True,
23
- yearly_seasonality=True,
24
- n_changepoints=150,
25
- trend_reg_threshold=False, # Disable trend regularization threshold
26
- d_hidden=6,
27
- global_normalization=True,
28
- seasonality_reg=1,
29
- unknown_data_normalization=True,
30
- seasonality_mode="multiplicative",
31
- drop_missing=True,
32
- learning_rate=0.07
33
  )
34
 
35
- m.fit(df, freq='D')
36
 
37
  future = m.make_future_dataframe(df, periods=30, n_historic_predictions=True)
38
  forecast = m.predict(future)
@@ -57,11 +46,11 @@ if __name__ == "__main__":
57
  dropdown = gr.inputs.Dropdown(["VNIndex"], label="Choose an option", default="VNIndex")
58
  outputs = [
59
  gr.outputs.Image(type="filepath", label="Lịch sử VNIndex và dự đoán"),
60
- gr.outputs.Image(type="filepath", label="Dự đoán VNIndex cho 45 ngày tới"),
61
  gr.outputs.Textbox(label="Mô tả"),
62
  gr.outputs.Textbox(label="Disclaimer")
63
  ]
64
- interface = gr.Interface(fn=predict_vn_index, inputs=dropdown, outputs=outputs, title="Dự báo VN Index 45 ngày tới")
65
  interface.launch()
66
 
67
 
 
13
  df.fillna(method='ffill', inplace=True)
14
  df.dropna(inplace=True)
15
 
16
+ m = NeuralProphet(n_forecasts= 3,
17
+ n_lags=12,
18
+ changepoints_range=5, num_hidden_layers=6, daily_seasonality= False, weekly_seasonality = False, yearly_seasonality = True, ar_reg=True,
19
+ n_changepoints=150, trend_reg_threshold=True, d_hidden=9, global_normalization=True, global_time_normalization=True, seasonality_reg=1, unknown_data_normalization=True,
20
+ seasonality_mode="multiplicative", drop_missing=True,
21
+ learning_rate=0.1
 
 
 
 
 
 
 
 
 
 
 
22
  )
23
 
24
+ m.fit(df, freq='M')
25
 
26
  future = m.make_future_dataframe(df, periods=30, n_historic_predictions=True)
27
  forecast = m.predict(future)
 
46
  dropdown = gr.inputs.Dropdown(["VNIndex"], label="Choose an option", default="VNIndex")
47
  outputs = [
48
  gr.outputs.Image(type="filepath", label="Lịch sử VNIndex và dự đoán"),
49
+ gr.outputs.Image(type="filepath", label="Dự đoán VNIndex cho 90 ngày tới"),
50
  gr.outputs.Textbox(label="Mô tả"),
51
  gr.outputs.Textbox(label="Disclaimer")
52
  ]
53
+ interface = gr.Interface(fn=predict_vn_index, inputs=dropdown, outputs=outputs, title="Dự báo VN Index 90 ngày tới")
54
  interface.launch()
55
 
56