// 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
After Change
else:
for i in range(len(feature_weights)):
//previous array of feature_weights
prev = weight_history[len(weight_history)-1]
diff = abs(prev[i] - feature_weights[i])
// first encounter of value that has difference greater than threshold, set no_diff to False, and break out of checking loop
if diff >= 0.0001:
no_diff = False