feat: Added Weight and Biases single run logging. (#58)

* feat: initial wandb configured. Sweep parameters aren't configured yet.

* feat: Wandb logs now results.

* feat: gitignore.

* fix: Took out print()

* feat: Changed default value of wandb to False.

* feat: Added wandb to turn of automatically if there is no environment variable to start it (when we push it). Added environment configuration aswell.

* feat: Each assets model is seperated into a run that tracks the results.

* fix: Nonetype error, truncated assets.

* fix: Fixed the logging to wandb.
This commit is contained in:
Daniel Szemerey
2021-12-20 17:49:11 +01:00
committed by GitHub
parent 122b7bb128
commit 52268d0141
2 changed files with 140 additions and 116 deletions
+13 -1
View File
@@ -25,6 +25,7 @@ def run_single_asset_trainig_pipeline(
sliding_window_size: int,
retrain_every: int,
scaler: Literal['normalize', 'minmax', 'standardize', 'none'],
wandb
) -> tuple[pd.DataFrame, pd.DataFrame]:
@@ -32,9 +33,10 @@ def run_single_asset_trainig_pipeline(
results = pd.DataFrame()
predictions = pd.DataFrame()
wandb_active = type(wandb) is not type(None)
for model_name, model in models:
model_over_time, preds = walk_forward_train_test(
model_name=model_name,
model = model,
@@ -55,5 +57,15 @@ def run_single_asset_trainig_pipeline(
column_name = ticker_to_predict + "_" + model_name
results[column_name] = result
predictions[column_name] = preds
if wandb_active:
run = wandb.init(project="price-forecasting", config={"model_type": model_name, "ticker": ticker_to_predict}, reinit=True)
wandb.run.name = ticker_to_predict + "-" + model_name+ "-" + wandb.run.id
wandb.run.save()
for rownum,(indx,val) in enumerate(result.iteritems()):
run.log({"model_type": model_name, indx:val })
run.finish()
return results, predictions