dscience.ml.decision_frame
¶
Module Contents¶
-
class
dscience.ml.decision_frame.
DecisionFrame
¶ Bases:
OrganizingFrame
An n × m matrix of probabilities (or scores) from a classifier. The n rows are samples, and the m columns are predictions. The values are the confidence or pobability of prediction. The single index column is named ‘correct_label’, and the single column name is named ‘label’. Practically, this is a Pandas wrapper around a scikit-learn decision_function that also has the predicted and correct class labels.
-
classmethod
required_index_names
(cls)¶
-
classmethod
of
(cls, correct_labels: Sequence[str], labels: Sequence[str], decision_function: np.array, sample_ids: Sequence[Any])¶ Wraps a decision function numpy array into a DecisionFrame instance complete with labels as names and columns. :param correct_labels: A length-n list of the correct labels for each of the n samples :param labels: A length-m list of class labels matching the predictions (columns) on probabilities :param decision_function: An n × m matrix of probabilities (or scores) from the classifier.
The rows are samples, and the columns are predictions. scikit-learn decision_functions (ex model.predict_proba) will output this.Parameters: sample_ids – IDs (or names) of training examples for later reference; should be unique Returns: A DecisionFrame
-
confusion
(self)¶
-
accuracy
(self)¶
-
classmethod
read_csv
(cls, path: PathLike, *args, **kwargs)¶
-
to_csv
(self, path: PathLike, *args, **kwargs)¶
-
classmethod