Skip to content
Lucd Modeling Framework | Lucd Machine Learning API | 6.2.7

Machine Learning API

lucd_ml

get_predictions_classification()

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 premade TF estimator was used for classification) –
  • binary_threshold – 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()

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).


confusion_matrix()

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 order as predicted_labels.
  • label_mapping (dict) – Dict mapping integer labels to string labels, for better interpretation when confusion matrix is in Lucd GUI.

Returns

String representing confusion matrix (str).