dump module

The dump module defines the dump() function.

surprise.dump.dump(file_name, predictions=None, algo=None, verbose=0)[source]

A basic wrapper around Pickle to serialize a list of prediction and/or an algorithm on drive.

What is dumped is a dictionary with keys 'predictions' and 'algo'.

Parameters
  • file_name (str) – The name (with full path) specifying where to dump the predictions.

  • predictions (list of Prediction) – The predictions to dump.

  • algo (Algorithm, optional) – The algorithm to dump.

  • verbose (int) – Level of verbosity. If 1, then a message indicates that the dumping went successfully. Default is 0.

surprise.dump.load(file_name)[source]

A basic wrapper around Pickle to deserialize a list of prediction and/or an algorithm that were dumped on drive using dump().

Parameters

file_name (str) – The path of the file from which the algorithm is to be loaded

Returns

A tuple (predictions, algo) where predictions is a list of Prediction objects and algo is an Algorithm object. Depending on what was dumped, some of these may be None.