alpbench.benchmark.Observer¶
Classes
|
Abstract class for the observer of the active learning process. |
|
Observer class to get the statistical performance evaluation of the active learning process such as the distribution of the labeled and selected data, and the model performance on the test data. |
|
Observer class for statistical performance evaluation of the active learning process such as the distribution of the labeled and selected data, and the model performance on the test data. |
- class alpbench.benchmark.Observer.Observer[source]¶
Bases:
ABCAbstract class for the observer of the active learning process. The observer is responsible for keeping track of the indices of the selected data, the labeled data, and the unlabeled data, as well as the model performance on the test data in each iteration..
- class alpbench.benchmark.Observer.PrintObserver(X_test, y_test)[source]¶
Bases:
StatisticalPerformanceObserverObserver class to get the statistical performance evaluation of the active learning process such as the distribution of the labeled and selected data, and the model performance on the test data.
- Parameters:
X_test (np.array) – test data
y_test (np.array) – test labels
- X_test¶
test data
- Type:
np.array
- y_test¶
test labels
- Type:
np.array
- observe_data(iteration, X_u_selected, y_u_selected, X_l_aug, y_l_aug, X_u_red, D_l_ind)[source]¶
Observes the data in each iteration.
- Parameters:
iteration (int) – iteration number
X_u_selected (np.array) – selected data
y_u_selected (np.array) – selected labels
X_l_aug (np.array) – labeled data
y_l_aug (np.array) – labels of labeled data
X_u_red (np.array) – unlabeled data
D_l_ind (np.array) – Indices of X_u selected to be labeled
- class alpbench.benchmark.Observer.StatisticalPerformanceObserver(X_test, y_test)[source]¶
-
Observer class for statistical performance evaluation of the active learning process such as the distribution of the labeled and selected data, and the model performance on the test data.
- Parameters:
X_test (np.array) – test data
y_test (np.array) – test labels
- X_test¶
test data
- Type:
np.array
- y_test¶
test labels
- Type:
np.array
- compute_labeling_statistics(iteration, X_u_selected, y_u_selected, X_l_aug, y_l_aug, X_u_red, D_l_ind)[source]¶
Computes the distribution of the data, which involves the ids of the selected data in each iteration, the overall labeled and unlabeled data.
- Parameters:
iteration (int) – iteration number
X_u_selected (np.array) – selected data
y_u_selected (np.array) – selected labels
X_l_aug (np.array) – labeled data
y_l_aug (np.array) – labeled labels
X_u_red (np.array) – unlabeled data
D_l_ind (np.array) – Indices of X_u selected to be labeled
- Returns:
dictionary with the distribution of the labeled and selected data
- Return type:
eval_scores (dict)
- compute_model_performances(iteration, model)[source]¶
Computes the model performance on the test data, which involves the f1, precision, recall, log loss, accuracy, and AUC scores.
- precision = 8¶