Guest User

Untitled

a guest
May 22nd, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | None | 0 0
  1. import numpy as np
  2. from sklearn.base import BaseEstimator
  3.  
  4. class Dummy(BaseEstimator):
  5.     def __init__(self, k):
  6.         self.k = k
  7.     def fit(self, X, y):
  8.         pass
  9.     def predict(self, X):
  10.         return self.k * np.ones(X.shape[0])
  11.  
  12. X = np.random.randn(5, 4)  # date random
  13. y = np.random.randn(5)  # etichete random
  14.  
  15. dummy = Dummy(k=42)
  16.  
  17. dummy.fit(X, y)  # nu face nimic
  18. dummy.predict(X)  # returneaza cate un 42 pt fiecare linie din X
Add Comment
Please, Sign In to add comment