probinet.evaluation.covariate_prediction

probinet.evaluation.covariate_prediction#

Module for extracting true labels and predicting labels.

Functions

compute_covariate_prediction_accuracy(X, u, ...)

Return the accuracy of the attribute prediction, computed as the fraction of correctly classified examples.

extract_true_label(X[, mask])

Extract true labels from the design matrix X.

predict_label(X, u, v, beta[, mask])

Compute predicted labels.

probinet.evaluation.covariate_prediction.compute_covariate_prediction_accuracy(X: DataFrame, u: ndarray, v: ndarray, beta: ndarray, mask: ndarray | None = None) float[source]#

Return the accuracy of the attribute prediction, computed as the fraction of correctly classified examples.

probinet.evaluation.covariate_prediction.extract_true_label(X: DataFrame, mask: ndarray | None = None) ndarray[source]#

Extract true labels from the design matrix X.

Parameters:
  • X – Pandas DataFrame object representing the one-hot encoding version of the design matrix.

  • mask – Mask for selecting a subset of the design matrix.

Returns:

Array of true labels.

Return type:

np.ndarray

probinet.evaluation.covariate_prediction.predict_label(X: DataFrame, u: ndarray, v: ndarray, beta: ndarray, mask: ndarray | None = None) List[str][source]#

Compute predicted labels.

Parameters:
  • X – Pandas DataFrame object representing the one-hot encoding version of the design matrix.

  • u (Membership matrix (out-degree).) – Membership matrix (out-degree).

  • v (Membership matrix (in-degree).) – Membership matrix (in-degree).

  • beta (Beta parameter matrix.) – Beta parameter matrix.

  • mask (Mask for selecting a subset of the design matrix.) – Mask for selecting a subset of the design matrix.

Returns:

List of predicted labels.

Return type:

List[str]