socceraction.xthreat.ExpectedThreat.save_model

ExpectedThreat.save_model(filepath, overwrite=True)

Save the xT value surface in JSON format.

This stores only the xT value surface, which is all you need to compute xT values for new data. The value surface can be loaded back with the socceraction.xthreat.load_model() function.

Pickle the ExpectedThreat instance to store the entire model and to retain the transition, shot probability, move probability and scoring probability matrices.

Raises:
  • NotFittedError – If the model has not been fitted yet.

  • ValueError – If the specified output file already exists and “overwrite” is set to False.

Parameters:
  • filepath (str) – Path to the file to save the value surface to.

  • overwrite (bool) – Whether to silently overwrite any existing file at the target location.

Return type:

None