module testing.model_verification#

Short summary#

module mlprodict.testing.model_verification

Complex but recurring testing functions.

source on GitHub

Functions#

function

truncated documentation

check_is_almost_equal

Checks that two floats or two arrays are almost equal.

check_model_representation

Checks that a trained model can be exported in a specific list of formats and produces the same outputs if the representation …

iris_data

Returns (X, y) for iris data.

Documentation#

Complex but recurring testing functions.

source on GitHub

mlprodict.testing.model_verification.check_is_almost_equal(xv, exp, precision=1e-05, message=None)#

Checks that two floats or two arrays are almost equal.

Parameters:
  • xv – float or vector

  • exp – expected value

  • precision – precision

  • message – additional message

source on GitHub

mlprodict.testing.model_verification.check_model_representation(model, X, y=None, convs=None, output_names=None, only_float=True, verbose=False, suffix='', fLOG=None)#

Checks that a trained model can be exported in a specific list of formats and produces the same outputs if the representation can be used to predict.

Parameters:
  • model – model (a class or an instance of a model but not trained)

  • X – features

  • y – targets

  • convs – list of format to check, all possible by default ['json', 'c']

  • output_names – list of output columns (can be None, a default value is infered based on scikit-learn output then)

  • verbose – print some information

  • suffix – add this to disambiguate module

  • fLOG – logging function

Returns:

function to call to run the prediction

source on GitHub

mlprodict.testing.model_verification.iris_data()#

Returns (X, y) for iris data.

source on GitHub