Created
March 21, 2019 01:25
-
-
Save thejevans/ab0ecbffc14fbf5ba81880604d68d1c0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.base import BaseEstimator, ClassifierMixin | |
class DiscreteNB(BaseEstimator, ClassifierMixin): | |
def __init__(self): | |
self.MLE_array = np.empty() | |
BaseEstimator.__init__(self) | |
ClassifierMixin.__init__(self) | |
def get_params(self, deep=True): | |
return BaseEstimator.get_params(self, deep=True) | |
def set_params(self, **params): | |
return BaseEstimator.set_params(self, **params) | |
def score(self, X, y, sample_weight=None): | |
#predict | |
#get score based on prediction and actual | |
#return score | |
return ClassifierMixin.score(self, X, y, sample_weight=None) | |
def fit(self): | |
#get MLE from X,y | |
#store MLE array | |
return | |
def predict(self): | |
#use MLE array and X to return predicted y | |
return | |
x_train, y_train | |
x_test, y_test | |
dnb = DiscreteNB() | |
dnb.fit(x_train, y_train) | |
dnb.score(x_train, y_train) | |
dnb.score(x_test, y_test) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment