Skip to content

Instantly share code, notes, and snippets.

@zilto
Created June 23, 2023 17:31
Show Gist options
  • Save zilto/2253a6c01caed951fa53181a3c344bfc to your computer and use it in GitHub Desktop.
Save zilto/2253a6c01caed951fa53181a3c344bfc to your computer and use it in GitHub Desktop.
How to use and call data savers
# from the function module
@save_to.csv(path=source("pred_path"), output_name_="save_validation_predictions")
def validation_predictions_table(y_validation: np.ndarray, val_pred: np.ndarray) -> pd.DataFrame:
"""Create a table with the model's predictions on the validation set"""
return pd.DataFrame({"y_validation": y_validation, "val_pred": val_pred})
# from the main process
results = dr.execute(
final_vars=[
"validation_predictions_table", # the function name
"save_validation_predictions", # the decorator `output_name_` argument
]
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment