eb73ec72ed6c28b774a4d4220a9a02bac2f8be81,bugbug/model.py,Model,train,#Model#,32

Before Change


        if len(feature_names):
            print("Feature ranking (top 20 features):")
            indices = np.argsort(self.clf.feature_importances_)[::-1][:20]
            for i in range(len(indices)):
                print("{}. \"{}\" ({})".format(i + 1, feature_names[indices[i]], self.clf.feature_importances_[indices[i]]))

        y_pred = self.clf.predict(X_test)

        print("No confidence threshold - {} classified".format(len(y_test)))
        print(metrics.confusion_matrix(y_test, y_pred, labels=class_names))

After Change


            // Calculate the values that represent the fraction of the model output variability attributable
            // to each feature across the whole dataset.
            shap_sums = np.abs(shap_values).sum(0)
            rel_shap_sums = shap_sums / shap_sums.sum()
            indices = np.argsort(rel_shap_sums)[::-1][:20]
            for i, index in enumerate(indices):
                print("{}. \"{}\" ({})".format(i + 1, feature_names[index], rel_shap_sums[index]))

        y_pred = self.clf.predict(X_test)

        print("No confidence threshold - {} classified".format(len(y_test)))
        print(metrics.confusion_matrix(y_test, y_pred, labels=class_names))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: mozilla/bugbug
Commit Name: eb73ec72ed6c28b774a4d4220a9a02bac2f8be81
Time: 2019-01-14
Author: mcastelluccio@mozilla.com
File Name: bugbug/model.py
Class Name: Model
Method Name: train


Project Name: flow-project/flow
Commit Name: 94a405c5f6caafc99550d5267a6c94cf20af2d59
Time: 2017-10-27
Author: eugenevinitsky@airbears2-10-142-37-47.airbears2.1918.berkeley.edu
File Name: flow/envs/loop_accel.py
Class Name: SimpleMultiAgentAccelerationEnvironment
Method Name: get_state


Project Name: CellProfiler/CellProfiler
Commit Name: 6bbb1ad50fcf5e5f514de815b91ef63184dbe8db
Time: 2009-12-08
Author: leek@1fc53939-2000-0410-845c-e8453a809027
File Name: pyCellProfiler/cellprofiler/modules/measureobjectintensity.py
Class Name: MeasureObjectIntensity
Method Name: run