incerto.shift.ImportanceWeightingShift#
- class incerto.shift.ImportanceWeightingShift(method='logistic', alpha=0.01)[source]#
Bases:
objectImportance weighting for covariate shift adaptation.
Estimates density ratio w(x) = p_target(x) / p_source(x) and uses it to re-weight training samples.
- Reference:
Sugiyama et al., “Direct Importance Estimation with Model Selection” (NIPS 2007)
- Parameters:
Methods
__init__([method, alpha])compute_weights(source_features)Compute importance weights for source samples.
fit(source_features, target_features)Estimate importance weights.
load(path[, method, alpha])Load importance weighting from file.
load_state_dict(state)Load importance weighting state.
save(path)Save importance weighting state.
Save importance weighting state.
weighted_loss(loss, weights)Apply importance weights to loss.