3f74cd386abdc18a4b0b48160686f9654fb22bc1,auto_ml/utils_model_training.py,FinalModelATC,predict_proba,#FinalModelATC#Any#,87

Before Change


        if (self.model_name[:16] == "GradientBoosting" or self.model_name in ["BayesianRidge", "LassoLars", "OrthogonalMatchingPursuit", "ARDRegression"]) and scipy.sparse.issparse(X):
            X = X.todense()

        try:
            predictions = self.model.predict_proba(X)
            if X.shape[0] == 1:
                return predictions[0]
            else:
                return predictions
        except AttributeError as e:
            // print("This model has no predict_proba method. Returning results of .predict instead.")
            raw_predictions = self.model.predict(X)
            tupled_predictions = []
            for prediction in raw_predictions:
                if prediction == 1:
                    tupled_predictions.append([0,1])
                else:
                    tupled_predictions.append([1,0])
            predictions = tupled_predictions
            // return tupled_predictions
            if X.shape[0] == 1:
                return predictions[0]
            else:
                return predictions


    def predict(self, X):

        if self.model_name[:3] == "XGB" and scipy.sparse.issparse(X):
            ones = [[1] for x in range(X.shape[0])]

After Change


            try:
                predictions = self.model.predict(X)
            except TypeError as e:
                if scipy.sparse.issparse(X):
                    X = X.todense()
                predictions = self.model.predict(X)

        except TypeError as e:
            if scipy.sparse.issparse(X):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: ClimbsRocks/auto_ml
Commit Name: 3f74cd386abdc18a4b0b48160686f9654fb22bc1
Time: 2016-12-01
Author: ClimbsBytes@gmail.com
File Name: auto_ml/utils_model_training.py
Class Name: FinalModelATC
Method Name: predict_proba


Project Name: ClimbsRocks/auto_ml
Commit Name: 771bac1530fea0fd7a72e69a2f6c8d621a7b02cd
Time: 2016-08-10
Author: ClimbsBytes@gmail.com
File Name: auto_ml/utils.py
Class Name: FinalModelATC
Method Name: fit


Project Name: markovmodel/PyEMMA
Commit Name: ff07957b91c3d78b0e0cfa0f92715e916d2179fb
Time: 2019-05-22
Author: m.scherer@fu-berlin.de
File Name: pyemma/util/numeric.py
Class Name:
Method Name: _hash_numpy_array