Class asks me to give self for Naive Bayes Model python I try to use the following code but when I try to use fit function with my X_train and y_train, 
I get the following error: 

fit() missing 1 required positional argument: 'self'

I do not know much about classes but I know it should not ask for self. I found somethings about instantiation but could not figure it out. 

class BernoulliNB(object):
    def __init__(self, alpha=1.0):
        self.alpha = alpha

    def fit(self, X, y):
        count_sample = X.shape[0]
        # group by class
        separated = [[x for x, t in zip(X, y) if t == c] for c in np.unique(y)]
        # class prior
        self.class_log_prior_ = [np.log(len(i) / count_sample) for i in separated]
        # count of each word
        count = np.array([np.array(i).sum(axis=0) for i in separated]) + self.alpha

        smoothing = 2 * self.alpha
        # number of documents in each class + smoothing
        n_doc = np.array([len(i) + smoothing for i in separated])
        print(n_doc)

    def predict(self, X):
        return np.argmax(self.predict_log_proba(X), axis=1)


when I try 

b = BernoulliNB() 
b.fit(b, X_train,y_train) 


this time, I receive 

fit() takes 3 positional arguments but 4 were given


Then I changed it to 

BernoulliNB().fit(X_train,y_train)


but this time, this error occurs:

The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
b = BernoulliNB() 
b.fit(b, X_train,y_train)


This doesn't work because you're calling the fit method of the BernoulliNB class object you instantiated with BernoulliNB(). This argument says you have an extra parameter because it only accepts X, y.

It's hard to diagnose your second issue without seeing your data. But your y_train is probably formatted incorrectly.