mirror of
https://github.com/webclinic017/drift.git
synced 2026-08-07 16:17:49 +00:00
25b64f5a3d
* refactor(Reporting): only report the last model's results, moved wandb-related functions to `reporting` * fix(Reporting): use .mean() on axis 1 to retain the metrics, fixed get_model_name() * fix(Config): sweep file syntax * fix(Config): changed hyperparameter search method to "bayes" * chore(Sweep): adjusted sweep config based on the results we saw (removed Momentum as well) * fix(Sweep): only use classification method for now, we're not yet prepared for regression
43 lines
1.4 KiB
Python
43 lines
1.4 KiB
Python
import pandas as pd
|
|
from typing import Optional
|
|
|
|
def launch_wandb(project_name:str, default_config:dict, sweep:bool=False):
|
|
from wandb_setup import get_wandb
|
|
wandb = get_wandb()
|
|
|
|
if wandb is None:
|
|
return None
|
|
elif sweep:
|
|
wandb.init(project=project_name, config = default_config)
|
|
return wandb
|
|
else:
|
|
wandb.init(project=project_name, config = default_config, reinit=True)
|
|
return wandb
|
|
|
|
|
|
def seperate_configs(wandb: Optional[object], model_config:dict, training_config:dict, data_config:dict) -> tuple[dict,dict,dict]:
|
|
config: dict = wandb.config
|
|
|
|
if type(wandb) is not type(None):
|
|
for k in training_config: training_config[k] = config[k]
|
|
for k in model_config: model_config[k] = config[k]
|
|
# for k in data_config: data_config[k] = config[k]
|
|
|
|
return model_config, training_config, data_config
|
|
|
|
|
|
def send_report_to_wandb(results: pd.DataFrame, wandb:Optional[object], project_name: str, model_name: str):
|
|
if wandb is None: return
|
|
|
|
run = wandb.init(project=project_name, config={"model_type": model_name}, reinit=True)
|
|
wandb.run.name = model_name+ "-" + wandb.run.id
|
|
wandb.run.save()
|
|
|
|
mean_results = results.mean(axis = 1)
|
|
for key, value in mean_results.iteritems():
|
|
run.log({"model_type": model_name, key: value })
|
|
|
|
run.finish()
|
|
|
|
|
|
|