6466c983cec2df0d6b15677463be614a2fff60f5,AutoSklearn/components/classification/random_forest.py,RandomForest,fit,#RandomForest#Any#Any#,29

Before Change


        if self.max_features not in ("sqrt", "log2", "auto"):
            num_features = X.shape[1]
            max_features = int(float(self.max_features) * (np.log(num_features) + 1))
            max_features = min(0.5, max_features)
        if self.bootstrap == "True":
            self.bootstrap = True
        else:
            self.bootstrap = False
        if self.max_leaf_nodes == "None":
            self.max_leaf_nodes = None

        // initial fit of only increment trees
        self.estimator = forest.RandomForestClassifier(
            n_estimators=0,
            criterion=self.criterion,
            max_features=max_features,
            max_depth=self.max_depth,
            min_samples_split=self.min_samples_split,
            min_samples_leaf=self.min_samples_leaf,
            bootstrap=self.bootstrap,
            max_leaf_nodes=self.max_leaf_nodes,
            random_state=self.random_state,
            n_jobs=self.n_jobs,
            warm_start=True)
        // JTS TODO: I think we might have to copy here if we want self.estimator
        //           to always be consistent on sigabort
        while len(self.estimator.estimators_) < self.n_estimators:
            tmp = self.estimator // TODO I think we need to copy here!
            tmp.n_estimators += self.estimator_increment
            tmp.fit(X, Y)
            self.estimator = tmp
        return self.estimator

    def predict(self, X):

After Change


            num_features = X.shape[1]
            max_features = int(float(self.max_features) * (np.log(num_features) + 1))
            // Use at most half of the features
            max_features = max(1, min(int(X.shape[1] / 2), max_features))
        if self.bootstrap == "True":
            self.bootstrap = True
        else:
            self.bootstrap = False
        if self.max_leaf_nodes == "None":
            self.max_leaf_nodes = None

        // initial fit of only increment trees
        self.estimator = forest.RandomForestClassifier(
            n_estimators=0,
            criterion=self.criterion,
            max_features=max_features,
            max_depth=self.max_depth,
            min_samples_split=self.min_samples_split,
            min_samples_leaf=self.min_samples_leaf,
            bootstrap=self.bootstrap,
            max_leaf_nodes=self.max_leaf_nodes,
            random_state=self.random_state,
            n_jobs=self.n_jobs,
            warm_start=True)
        // JTS TODO: I think we might have to copy here if we want self.estimator
        //           to always be consistent on sigabort
        while len(self.estimator.estimators_) < self.n_estimators:
            tmp = self.estimator // TODO I think we need to copy here!
            tmp.n_estimators += self.estimator_increment
            tmp.fit(X, Y)
            self.estimator = tmp
        return self.estimator

    def predict(self, X):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 16

Instances


Project Name: automl/auto-sklearn
Commit Name: 6466c983cec2df0d6b15677463be614a2fff60f5
Time: 2015-01-12
Author: feurerm@informatik.uni-freiburg.de
File Name: AutoSklearn/components/classification/random_forest.py
Class Name: RandomForest
Method Name: fit


Project Name: automl/auto-sklearn
Commit Name: 6466c983cec2df0d6b15677463be614a2fff60f5
Time: 2015-01-12
Author: feurerm@informatik.uni-freiburg.de
File Name: AutoSklearn/components/regression/random_forest.py
Class Name: RandomForest
Method Name: fit


Project Name: automl/auto-sklearn
Commit Name: 6466c983cec2df0d6b15677463be614a2fff60f5
Time: 2015-01-12
Author: feurerm@informatik.uni-freiburg.de
File Name: AutoSklearn/components/classification/gradient_boosting.py
Class Name: GradientBoostingClassifier
Method Name: fit