mirror of
https://github.com/webclinic017/drift.git
synced 2026-08-14 03:18:06 +00:00
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:
+13
-1
@@ -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
|
||||
Reference in New Issue
Block a user