532096f9f9a96f689ee644cdb3560def98a4c410,auto_ml/predictor.py,Predictor,_get_xgb_feat_importances,#Predictor#Any#,279

Before Change


        fscore_list = [[int(k[1:]), v] for k, v in fscore.viewitems()]
        print("fscore_list")
        print(fscore_list)
        sorted_fscore = fscore_list.sort(key=lambda x: x[0])
        print("fscore_list after sorting")
        print(fscore_list)

        print("len(fscore_list)")

After Change


        fscore_list = [[int(k[1:]), v] for k, v in fscore.viewitems()]


        feature_infos = []
        sum_of_all_feature_importances = 0.0

        for idx_and_result in fscore_list:
            idx = idx_and_result[0]
            // Use the index that we grabbed above to find the human-readable feature name
            feature_name = trained_feature_names[idx]
            feat_importance = idx_and_result[1]

            // If we sum up all the feature importances and then divide by that sum, we will be able to have each feature importance as it"s relative feature imoprtance, and the sum of all of them will sum up to 1, just as it is in scikit-learn.
            sum_of_all_feature_importances += feat_importance
            feature_infos.append([feature_name, feat_importance])

        sorted_feature_infos = sorted(feature_infos, key=lambda x: x[1])

        print("Here are the feature_importances from the tree-based model:")
        print("The printed list will only contain at most the top 50 features.")
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: ClimbsRocks/auto_ml
Commit Name: 532096f9f9a96f689ee644cdb3560def98a4c410
Time: 2016-08-20
Author: ClimbsBytes@gmail.com
File Name: auto_ml/predictor.py
Class Name: Predictor
Method Name: _get_xgb_feat_importances


Project Name: Scitator/catalyst
Commit Name: f4beaac559e00a3676d942dc7e8fea69efc01cfe
Time: 2020-11-30
Author: raveforlive@gmail.com
File Name: catalyst/metrics/hitrate.py
Class Name:
Method Name: hitrate