Trainer

flood_forecast.trainer.handle_model_evaluation1(trained_model, params: Dict, model_type: str) None[source]

Utility function to help handle model evaluation. Primarily used at the moment for forcast

Parameters
  • trained_model (PyTorchForecast) – A PyTorchForecast model that has already been trained.

  • params (Dict) – A dictionary of the trained model parameters

  • model_type (str) – The type of model. Almost always PyTorch in practice.

flood_forecast.trainer.train_function(model_type: str, params: Dict) flood_forecast.time_model.PyTorchForecast[source]

Function to train a Model(TimeSeriesModel) or da_rnn. Will return the trained model

Parameters
  • model_type (str) – Type of the model. In almost all cases this will be ‘PyTorch’

  • params – Dictionary containing all the parameters needed to run the model

Returns

A trained model

with open("model_config.json") as f: 
    params_dict = json.load(f)
train_function("PyTorch", params_dict)

For information on what this params_dict should include see Confluence pages on training models.

flood_forecast.trainer.main()[source]

Main fundection which is called from the command line. Entrypoint for training all TS ML models.