alipy.query_strategy.query_labels. QueryInstanceSPAL

Self-Paced Active Learning: Query the Right Thing at the Right Time (SPAL) will query a batch of informative, representative and easy examples by minimizing a well designed objective function.

The QP solver is cvxpy here which will not be installed by default because of the need of VC++ 14. Please install cvxpy manually before using this method.

The model used for instances selection is a linear regression model with the kernel form.

References

----------

[1] Tang, Y., and Huang, S. 2019. Self-Paced Active Learning: Query the Right Thing at the Right Time. In The Proceedings of the 33rd AAAI Conference on Artificial Intelligence (AAAI'19).

Methods

init

__init__(self, X, y, mu=0.1, gamma=0.1, rho=1, lambda_init=0.1, lambda_pace=0.01, **kwargs)
Parameters:
X: 2D array, optional (default=None)
Feature matrix of the whole dataset. It is a reference which will not use additional memory.
y: array-like, optional (default=None)
Label matrix of the whole dataset. It is a reference which will not use additional memory.
mu: float, optional (default=0.1)
The MMD parameter.
gamma: float, optional (default=0.1)
The l2-norm regularizer parameter.
rho: float, optional (default=1)
The parameter used in ADMM.
lambda_init: float, optional (default=0.1)
The initial value of lambda used in SP regularizer.
lambda_pace: float, optional (default=0.01)
The pace of lambda when updating.
kernel : {'linear', 'poly', 'rbf', callable}, optional (default='rbf')
Specifies the kernel type to be used in the algorithm.
It must be one of 'linear', 'poly', 'rbf', or a callable.
If a callable is given it is used to pre-compute the kernel matrix
from data matrices; that matrix should be an array of shape
``(n_samples, n_samples)``.
degree : int, optional (default=3)
Degree of the polynomial kernel function ('poly').
Ignored by all other kernels.
gamma_ker : float, optional (default=1.)
Kernel coefficient for 'rbf', 'poly'.
coef0 : float, optional (default=1.)
Independent term in kernel function.
It is only significant in 'poly'.

select

select(self, label_index, unlabel_index, batch_size=5, qp_solver='ECOS', **kwargs)

Select indexes from the unlabel_index for querying.

Parameters:
label_index: {list, np.ndarray, IndexCollection}
The indexes of labeled samples.
unlabel_index: {list, np.ndarray, IndexCollection}
The indexes of unlabeled samples.
batch_size: int, optional (default=1)
Selection batch size.
qp_solver: str, optional (default='ECOS')
The solver in cvxpy to solve QP, must be one of
['ECOS', 'OSQP']
ECOS: https://www.embotech.com/ECOS
OSQP: https://osqp.org/
Returns:
selected_idx: list
The selected indexes which is a subset of unlabel_index.

Copyright © 2018, alipy developers (BSD 3 License).