mirror of
https://github.com/webclinic017/drift.git
synced 2026-08-13 10:58:06 +00:00
Feature: Added sweep functionality (#65)
* feat: Parametricized model selection works now. * feat: Fixed errors. Sweep generates and you can run it, but it gives an error for model.only_columns attribute. * feat: Factored the wandb management, default config managment and the model_dictionary out of the run_pipeline to a seperate file. * fix: Took out prints and fixed the mismatch of ensemble models when classifing. * fix(Models): added StaticMomentum model to the dictionary, hopefully fixed sklearn-ex RandomForestRegressor problem * fix(Dependencies): pin scikit-learn-ex's version, moved map_model_name_to_function to `models` * feat(Sweep): added `run_sweep.py` shortcut * feat(Pipeline): skip training a meta model if array is empty Co-authored-by: Mark Aron Szulyovszky <mark.szulyovszky@gmail.com>
This commit is contained in:
co-authored by
Mark Aron Szulyovszky
parent
d3d7184ea4
commit
1c1b8b2e54
@@ -15,7 +15,7 @@ def __get_scaler(type: Literal['normalize', 'minmax', 'standardize', 'none']):
|
||||
else:
|
||||
return None
|
||||
|
||||
def run_single_asset_trainig_pipeline(
|
||||
def run_single_asset_trainig(
|
||||
ticker_to_predict: str,
|
||||
X: pd.DataFrame,
|
||||
y: pd.Series,
|
||||
@@ -25,7 +25,9 @@ def run_single_asset_trainig_pipeline(
|
||||
sliding_window_size: int,
|
||||
retrain_every: int,
|
||||
scaler: Literal['normalize', 'minmax', 'standardize', 'none'],
|
||||
wandb
|
||||
wandb,
|
||||
project_name:str,
|
||||
sweep:bool
|
||||
) -> tuple[pd.DataFrame, pd.DataFrame]:
|
||||
|
||||
|
||||
@@ -59,14 +61,21 @@ def run_single_asset_trainig_pipeline(
|
||||
# column names for model outputs should be different, so we can differentiate between original data and model predictions later, where necessary
|
||||
predictions["model_" + 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()
|
||||
if wandb_active and not sweep:
|
||||
run = wandb.init(project=project_name, 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()
|
||||
for rownum,(indx,val) in enumerate(result.iteritems()):
|
||||
run.log({"model_type": model_name, indx:val })
|
||||
|
||||
run.finish()
|
||||
|
||||
if wandb_active and sweep:
|
||||
mean_results = results.mean()
|
||||
|
||||
wandb.log({"model_type": 'avarage_model', 'results':results })
|
||||
for rownum,(indx,val) in enumerate(mean_results.iteritems()):
|
||||
wandb.log({"model_type": 'avarage_model', indx:val })
|
||||
|
||||
return results, predictions
|
||||
Reference in New Issue
Block a user