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

Before Change



        if self.trained_pipeline.named_steps.get("feature_selection", False):

            print("heard we had feature selection")

            selected_indices = self.trained_pipeline.named_steps["feature_selection"].support_mask
            feature_names_before_selection = self.trained_pipeline.named_steps["dv"].get_feature_names()
            trained_feature_names = [name for idx, name in enumerate(feature_names_before_selection) if selected_indices[idx]]

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: 5

Non-data size: 7

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: rusty1s/pytorch_geometric
Commit Name: 37847c77889e39143034af9fe0d4b92bc74e992a
Time: 2018-03-02
Author: matthias.fey@tu-dortmund.de
File Name: torch_geometric/datasets/faust.py
Class Name: FAUST
Method Name: process


Project Name: jonas-koehler/s2cnn
Commit Name: d750d66fb998a44316000908f213ae73c53de97f
Time: 2018-03-03
Author: geiger.mario@gmail.com
File Name: examples/shrec17/dataset.py
Class Name: CacheNPY
Method Name: __call__


Project Name: nilmtk/nilmtk
Commit Name: 4a87f3b65125fb105168e4ff3f9aff3edfb9ab58
Time: 2014-05-21
Author: jack-list@xlk.org.uk
File Name: nilmtk/tests/generate_test_data.py
Class Name:
Method Name: create_energy_hdf5


Project Name: xinntao/BasicSR
Commit Name: ee1a026a7ad52bd8e807024e41d70276028c59e2
Time: 2020-11-27
Author: wxt1994@126.com
File Name: test_scripts/test_face_dfdnet.py
Class Name: FaceRestorationHelper
Method Name: get_face_landmarks_68