splearn/ensemble/__init__.py
def fit(self, Z, classes=None):
        """Fit the model according to the given training data.

        Parameters
        ----------
        Z : DictRDD containing (X, y) pairs
            X - Training vector
            y - Target labels
        classes : iterable
            The set of available classes

        Returns
        -------
        self : object
            Returns self.
        """
        check_rdd(Z, {'X': (sp.spmatrix, np.ndarray)})
        mapper = lambda X_y: super(SparkRandomForestClassifier, self).fit(
            X_y[0], X_y[1]
        )

        models = Z.map(mapper).collect()

        self.__dict__ = models[0].__dict__
        self.estimators_ = []
        for m in models:
            self.estimators_ += m.estimators_
        self.n_estimators = len(self.estimators_)
        return self
def fit(self, Z, classes=None):
        """Fit the model according to the given training data.

        Parameters
        ----------
        Z : DictRDD containing (X, y) pairs
            X - Training vector
            y - Target labels
        classes : iterable
            The set of available classes

        Returns
        -------
        self : object
            Returns self.
        """
        check_rdd(Z, {'X': (sp.spmatrix, np.ndarray)})
        mapper = lambda X_y: super(SparkRandomForestClassifier, self).fit(
            X_y[0], X_y[1]
        )

        models = Z.map(mapper).collect()

        self.__dict__ = models[0].__dict__
        self.estimators_ = []
        for m in models:
            self.estimators_ += m.estimators_
        self.n_estimators = len(self.estimators_)
        return self
Fit the model according to the given training data.

        Parameters
        ----------
        Z : DictRDD containing (X, y) pairs
            X - Training vector
            y - Target labels
        classes : iterable
            The set of available classes

        Returns
        -------
        self : object
            Returns self.