163eb7df13667e21b0e02a2706e18d1f53eee610,skrebate/iterrelief.py,IterRelief,fit,#IterRelief#Any#Any#,69

Before Change




        // 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


            // if no_diff is True, that means all features do not have a significant difference in weights between previous and current run.
            no_diff = True
            // if first iteration, set false
            if iteration == 0:
                no_diff = False
            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
                        break;
            if no_diff:
                break;

            mx = max(feature_weights)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 15

Instances


Project Name: EpistasisLab/scikit-rebate
Commit Name: 163eb7df13667e21b0e02a2706e18d1f53eee610
Time: 2020-01-29
Author: alexmxu99@gmail.com
File Name: skrebate/iterrelief.py
Class Name: IterRelief
Method Name: fit


Project Name: david-abel/simple_rl
Commit Name: 5e01ec2062f3eeb502f9454bc4915f4e92c675bb
Time: 2018-04-02
Author: david_abel@brown.edu
File Name: simple_rl/utils/mdp_visualizer.py
Class Name:
Method Name: val_to_color


Project Name: EpistasisLab/scikit-rebate
Commit Name: ece383696800b9b34854df27a65a3d1d74669952
Time: 2020-05-28
Author: alexmxu@alexs-mbp-3.attlocal.net
File Name: skrebate/iterrelief.py
Class Name: IterRelief
Method Name: fit