Skip to content
Lucd Python Client | Lucd Machine Learning API | 1.0.1

Machine Learning API

eda.lib.lucd_ml

confusion_matrix()

eda.lib.lucd_ml.confusion_matrix(predicted_labels, actual_labels, label_mapping)

Returns a confusion matrix in format required for displaying in the Lucd GUI.

Parameters

  • predicted_labels (list) – List of predicted labels (integers) as output by a classifier on a given dataset.

  • actual_labels (list) – List of actual labels (integers) of same dataset of associated with predicted_labels; must be in same order as predicted_labels.

  • label_mapping (dict) – Dict mapping integer labels to string labels, for better interpretation when confusion matrix is displayed in Lucd GUI.

Returns

String representing confusion matrix (str).


get_predictions_classification()

eda.lib.lucd_ml.get_predictions_classification(_estimator, input_fn, mode, binary_threshold=None)
Returns a list of predicted values & related scores using a TensorFlow estimator on a given TensorFlow DataSet.

Parameters

  • estimator – TensorFlow estimator to use for getting predictions.

  • input_fn (func) – TensorFlow input function feeding DataSet with testing/hold-out data.

  • mode (str) – String indicating type of classification done by the estimator: “binary,” “multiclass,” or “tf_premade_multiclass” (the last if a pre-made TF estimator was used for classification)

  • binary_threshold (float) – Float defining probability threshold for positive classification if “mode=binary.”

Returns

List of predictions & list of scores used to make the predictions (list).


get_predictions_regression()

eda.lib.lucd_ml.get_predictions_regression(_estimator, input_fn)

Returns a list of predicted values using a TensorFlow estimator on a given TensorFlow DataSet.

Parameters

  • estimator – TensorFlow estimator.

  • input_fn (func) – TensorFlow input function feeding DataSet with testing/hold-out data.

Returns

List of predictions (list).

Comments