from sklearn.base import BaseEstimator
from sklearn.utils import check_array, check_X_y
from sklearn.utils.validation import FLOAT_DTYPES, check_random_state, check_is_fitted
from sklego.common import TrainOnlyTransformerMixin
[docs]class RandomAdder(TrainOnlyTransformerMixin, BaseEstimator):
def __init__(self, noise=1, random_state=None):
self.noise = noise
self.random_state = random_state
[docs] def fit(self, X, y):
super().fit(X, y)
X, y = check_X_y(X, y, estimator=self, dtype=FLOAT_DTYPES)
self.dim_ = X.shape[1]
return self