Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- from sklearn.base import BaseEstimator
- class Dummy(BaseEstimator):
- def __init__(self, k):
- self.k = k
- def fit(self, X, y):
- pass
- def predict(self, X):
- return self.k * np.ones(X.shape[0])
- X = np.random.randn(5, 4) # date random
- y = np.random.randn(5) # etichete random
- dummy = Dummy(k=42)
- dummy.fit(X, y) # nu face nimic
- dummy.predict(X) # returneaza cate un 42 pt fiecare linie din X
Add Comment
Please, Sign In to add comment