5016a008790087d9cb47e7f91099f3dba7960ee2,mlxtend/regressor/stacking_cv_regression.py,StackingCVRegressor,fit,#StackingCVRegressor#,119

Before Change


            // cross-validation strategy
            kfold.shuffle = self.shuffle

        meta_features = np.zeros((X.shape[0], len(self.regressors)))

        //
        // The outer loop iterates over the base-regressors. Each regressor
        // is trained cv times and makes predictions, after which we train
        // the meta-regressor on their combined results.
        //
        for i, regr in enumerate(self.regressors):
            //
            // In the inner loop, each model is trained cv times on the
            // training-part of this fold of data; and the holdout-part of data
            // is used for predictions. This is repeated cv times, so in
            // the end we have predictions for each data point.
            //
            // Advantage of this complex approach is that data points we"re
            // predicting have not been trained on by the algorithm, so it"s
            // less susceptible to overfitting.
            //
            for train_idx, holdout_idx in kfold.split(X, y, groups):
                instance = clone(regr)
                if sample_weight is None:
                    instance.fit(X[train_idx], y[train_idx])
                else:
                    instance.fit(X[train_idx], y[train_idx],
                                 sample_weight=sample_weight[train_idx])
                y_pred = instance.predict(X[holdout_idx])
                meta_features[holdout_idx, i] = y_pred

        // save meta-features for training data
        if self.store_train_meta_features:

After Change


            fit_params = None
        else:
            fit_params = dict(sample_weight=sample_weight)
        meta_features = np.column_stack([cross_val_predict(
                regr, X, y, groups=groups, cv=kfold,
                n_jobs=self.n_jobs, fit_params=fit_params,
                pre_dispatch=self.pre_dispatch)
                    for regr in self.regr_])

        // save meta-features for training data
        if self.store_train_meta_features:
            self.train_meta_features_ = meta_features
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 10

Instances


Project Name: rasbt/mlxtend
Commit Name: 5016a008790087d9cb47e7f91099f3dba7960ee2
Time: 2019-03-14
Author: 36086881+qiagu@users.noreply.github.com
File Name: mlxtend/regressor/stacking_cv_regression.py
Class Name: StackingCVRegressor
Method Name: fit


Project Name: librosa/librosa
Commit Name: 2bae518e899657e536572fa59df6e1587795e397
Time: 2014-12-30
Author: brian.mcfee@nyu.edu
File Name: librosa/feature.py
Class Name:
Method Name: line_features


Project Name: PacktPublishing/Deep-Reinforcement-Learning-Hands-On
Commit Name: 1a89404a84393211c7b370077fafe536a8f44762
Time: 2018-03-02
Author: max.lapan@gmail.com
File Name: ch17/lib/common.py
Class Name:
Method Name: iterate_batches