// Iterate till max iteration reached or all weights are really tiny
while ((iteration < self.max_iter) & (any(w >= 0.0001 for w in distance_weights))):
// Run Core Relief-based algorithm
core_fit = core.fit(self.X_mat, self._y, distance_weights, self.weight_flag)
// When all weights become 0, break
if all(w == 0 for w in core_fit.feature_importances_):
break
// Update weights
feature_weights = core_fit.feature_importances_
mx = max(feature_weights)
mn = min(feature_weights)
rg = mx - mn
weight_history.append(feature_weights)
feature_weights = [(x - mn)/(rg) for x in feature_weights]
distance_weights += feature_weights