Comments (3)
Hi @SyedKumailHussainNaqvi, this looks like there are some missing values either in your target or predicted series.
from darts.
Thank for your kind guidance, I fix this but i have another query about TransformerModel.
I have these train, validation and test series after scaling now i just predict the trained Transformer model on test series for forecasting without n – The number of time steps after the end of the training time series, how its possible?
scaler = MinMaxScaler(feature_range=(-1, 1))
scaler_target = Scaler(scaler)
scaler_input = Scaler(scaler)
Train_Target_Active_Power_scaled = scaler_target.fit_transform(Target_train_series)
Train_Input_Features_scaled = scaler_input.fit_transform(Input_train_series)
val_Target_Active_Power_scaled = scaler_target.transform(Target_val_series)
val_Input_Features_scaled = scaler_input.transform(Input_val_series)
Test_Target_Active_Power_scaled = scaler_target.transform(Target_test_series)
Test_Input_Features_scaled = scaler_input.transform(Input_test_series)
my_model = TransformerModel(
input_chunk_length=32,
output_chunk_length=288,
batch_size=128,
n_epochs=1,
#model_name="air_transformer",
nr_epochs_val_period=100,
d_model=32,
nhead=16,
num_encoder_layers=8,
num_decoder_layers=8,
dim_feedforward=256,
dropout=0.1,
activation="relu",
#random_state=42,
#save_checkpoints=True,
force_reset=True,
pl_trainer_kwargs={
"accelerator": "gpu",
"devices": 1
},
)
my_model.fit(
series=Train_Target_Active_Power_scaled,past_covariates=Train_Input_Features_scaled, val_series=val_Target_Active_Power_scaled,val_past_covariates=val_Input_Features_scaled,
verbose=True,
);
pred_series = my_model.predict(n=len(Test_Target_Active_Power_scaled), series=Test_Target_Active_Power_scaled, past_covariates=Test_Input_Features_scaled)
Actual_Pred= scaler_target.inverse_transform(pred_series)
Actual_val_Target_Active_Power= scaler_target.inverse_transform(Test_Target_Active_Power_scaled)
mape_score = mape(Actual_Pred,Actual_val_Target_Active_Power)
mse_score = mse(Actual_Pred,Actual_val_Target_Active_Power)
mae_score = mae(Actual_Pred, Actual_val_Target_Active_Power)
print(f'MAPE: {mape_score:.4f}')
print(f'RMSE: {mse_score:.4f}')
print(f'MAE: {mae_score:.4f}')
from darts.
I have these train, validation and test series after scaling now i just predict the trained Transformer model on test series for forecasting without n – The number of time steps after the end of the training time series, how its possible?
I don't understand what you mean by this, your code snippet is clearly relying on n
to indicate the length of the forecasts. This argument is mandatory.
If you want to forecast the series with the same index as your test series in order to compute metrics, you need to use my_model.predict(n=len(test_series), series=validation_series, covariates=...)
as the prediction time index will start where the input series
finishes.
from darts.
Related Issues (20)
- Translate the Darts documentation into Chinese HOT 3
- Add ExtraTreesRegressor HOT 2
- How to return standard deviation of posterior distribution from Bayesian Ridge Regression HOT 3
- [BUG] Monte Carlo dropout does not work with pytorch-lightning >=2.2.0
- Include validation series with hyperparameter optimization in Darts HOT 3
- [Question] Does backtest method automatically apply inverse transformation for mappings? HOT 3
- Support for adding static covariates included in each row of time series HOT 3
- [BUG] Codecov cannot upload report for PR based on branches coming from forks HOT 1
- [BUG] Optuna version? HOT 2
- [QUESTION] How can I use shapExplainer when using multi_models=False? HOT 2
- ATFNet
- Add Multi-Horizon Time Series Classification Support HOT 1
- Add IQR Anomaly Detector
- Nested Cross-validation HOT 1
- [BUG] FutureWarning: Series.fillna with 'method' is deprecated HOT 2
- [BUG]Cannot convert a MPS Tensor to float64 dtype as the MPS framework HOT 1
- While importing darts it throws cannot import name 'TypeAliasType' from 'typing_extensions' error HOT 1
- [Question] Extract training data and target from a model at timestep t HOT 1
- Static covariates with past or future covariates HOT 4
- [Question] How could I hide the "Finding best initial lr" message from pytorch_lightning when using Darts' Torch Forecasting Models? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from darts.