def _sample_weights(self, aim_error, accuracy_error):
"""Sample weights based on the error.
Parameters
----------
aim_error : np.ndarray
The aim errors for each sample.
accuracy_error : np.ndarray
The accuracy error errors for each sample.
Returns
-------
weights : np.ndarray
The weights for each sample.
Notes
-----
This weighs samples based on their standard deviations above the mean
with some clipping.
"""
aim_zscore = (aim_error - aim_error.mean()) / aim_error.std()
aim_weight = np.clip(aim_zscore, 1, 4) / 4
accuracy_zscore = (
accuracy_error - accuracy_error.mean()
) / accuracy_error.std()
accuracy_weight = np.clip(accuracy_zscore, 1, 4) / 4
return {
'aim_error': aim_weight,
'accuracy_error': accuracy_weight,
}
评论列表
文章目录