Example #1
0
 def fit(self, X, y):
     # Convert data
     X, y = check_X_y(X,
                      y,
                      accept_sparse=("csr", "csc"),
                      multi_output=True,
                      y_numeric=True)
     return self
Example #2
0
 def fit(self, X, y, sample_weight=None):
     # Convert data
     X, y = check_X_y(X,
                      y,
                      accept_sparse=("csr", "csc"),
                      multi_output=True,
                      y_numeric=True)
     # Function is only called after we verify that pandas is installed
     from pandas import Series
     if isinstance(sample_weight, Series):
         raise ValueError("Estimator does not accept 'sample_weight'"
                          "of type pandas.Series")
     return self
Example #3
0
    def fit(self, X, y):
        X, y = check_X_y(X,
                         y,
                         accept_sparse=("csr", "csc", "coo"),
                         accept_large_sparse=True,
                         multi_output=True,
                         y_numeric=True)
        if sp.issparse(X):
            if X.getformat() == "coo":
                if X.row.dtype == "int64" or X.col.dtype == "int64":
                    raise ValueError(
                        "Estimator doesn't support 64-bit indices")
            elif X.getformat() in ["csc", "csr"]:
                if X.indices.dtype == "int64" or X.indptr.dtype == "int64":
                    raise ValueError(
                        "Estimator doesn't support 64-bit indices")

        return self
Example #4
0
 def fit(self, X, y=None):
     self._good_attribute = 1
     X, y = check_X_y(X, y)
     return self
Example #5
0
 def fit(self, X, y=None):
     self.wrong_attribute = 0
     X, y = check_X_y(X, y)
     return self
Example #6
0
 def fit(self, X, y=None):
     X, y = check_X_y(X, y)
     return self
Example #7
0
 def fit(self, X, y):
     X, y = check_X_y(X, y)
     if (y <= 0).any():
         raise ValueError('negative y values not supported!')
     return super().fit(X, y)
Example #8
0
 def fit(self, X, y):
     X, y = check_X_y(X, y)
     self.coef_ = np.ones(X.shape[1])
     return self
Example #9
0
 def fit(self, X, y):
     X, y = check_X_y(X, y, accept_sparse=['csr', 'csc'])
     if sp.issparse(X):
         raise ValueError("Nonsensical Error")
     return self