Spaces:
Sleeping
Sleeping
Commit
·
0aa9585
1
Parent(s):
9eca625
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,7 +4,6 @@ from neuralprophet import NeuralProphet
|
|
| 4 |
import io
|
| 5 |
import warnings
|
| 6 |
from torch.optim.lr_scheduler import OneCycleLR
|
| 7 |
-
from torch.optim.optimizer import Optimizer
|
| 8 |
|
| 9 |
warnings.filterwarnings("ignore", category=UserWarning)
|
| 10 |
|
|
@@ -42,14 +41,14 @@ m = CustomNeuralProphet(
|
|
| 42 |
)
|
| 43 |
|
| 44 |
# Set the custom LR scheduler
|
| 45 |
-
optimizer = m.
|
| 46 |
optimizer.lr_scheduler = {
|
| 47 |
"scheduler": OneCycleLR(optimizer, max_lr=0.1, steps_per_epoch=100, epochs=10),
|
| 48 |
"interval": "step",
|
| 49 |
"frequency": 1,
|
| 50 |
}
|
| 51 |
|
| 52 |
-
m.fit(df, freq='D')
|
| 53 |
|
| 54 |
future = m.make_future_dataframe(df, periods=30, n_historic_predictions=True)
|
| 55 |
forecast = m.predict(future)
|
|
|
|
| 4 |
import io
|
| 5 |
import warnings
|
| 6 |
from torch.optim.lr_scheduler import OneCycleLR
|
|
|
|
| 7 |
|
| 8 |
warnings.filterwarnings("ignore", category=UserWarning)
|
| 9 |
|
|
|
|
| 41 |
)
|
| 42 |
|
| 43 |
# Set the custom LR scheduler
|
| 44 |
+
optimizer = m.optimizer
|
| 45 |
optimizer.lr_scheduler = {
|
| 46 |
"scheduler": OneCycleLR(optimizer, max_lr=0.1, steps_per_epoch=100, epochs=10),
|
| 47 |
"interval": "step",
|
| 48 |
"frequency": 1,
|
| 49 |
}
|
| 50 |
|
| 51 |
+
m.fit(df, freq='D', epochs=10, validate_each_epoch=True, valid_p=0.2)
|
| 52 |
|
| 53 |
future = m.make_future_dataframe(df, periods=30, n_historic_predictions=True)
|
| 54 |
forecast = m.predict(future)
|