Files
drift/run_evaluate_robustness.py
T
Daniel Szemerey 55f083638f feature(Inference): Created the inference process, added model saving. (#153)
* feat: Basic scaffolding up for inference process after training.

* feat: Saving and loading models works. Inference works nearly.

* feat: Added inference pipeline.

* feat: Saving model now accoring to date and time; loading models now selects from latest file. Fixed the creation of dictionary of models.

* feat: Added lightweight asset config, but full pipeline.

* feat: Added new naming for dictionary.

* fix: Fixed dictionary naming convention.

* fix: Fixed naming again, now the model structure is good

* fix: Changed the output path and the return values from run_pipeline.

* feat: Added function to make sure folder exists for output models.

Co-authored-by: Daniel Szemerey <szemereydaniel@gmail.com>
2022-01-11 19:15:58 +01:00

24 lines
951 B
Python

from run_pipeline import run_pipeline
from config.config import get_default_ensemble_config, get_dev_config
import pandas as pd
all_results = []
all_predictions = []
for index in range(6):
_, _, _, results_1, predictions_1, _ = run_pipeline(project_name='price-prediction', with_wandb = False, sweep = False, get_config= get_default_ensemble_config)
all_results.append(results_1)
all_predictions.append(predictions_1)
correlations = pd.Series()
for asset_name in [c for c in all_predictions[0].columns if 'ensemble' in c]:
predictions_for_asset = pd.concat([preds[asset_name] for preds in all_predictions], axis=1)
correlations[asset_name] = predictions_for_asset.corr().mean()[0]
print("Correlation for asset ", asset_name, ": ", correlations[asset_name])
correlations["Overall"] = correlations.mean()
print("Average correlation across all assests: ", correlations.mean())
correlations.to_csv("output/correlations.csv")