classifiers.py
def naive_bayes(X_train,X_test,y_train,y_test):
    '''
    Creates multiple Naive Bayes classifier models on X_train and y_train with different parameters.
    Runs the models on X_test and compare the results with y_test.
    
    Args:
        X_train: A Numpy array containing the dataset for training
        X_test: A Numpy array containing the dataset for testing
        y_train: A Numpy array consisting of the target values for training
        y_test: A Numpy array consisting of the target values for testing

    Returns:
        A DataFrame with all the paramaters used and confusion matrices of each model
    '''
    df = pd.DataFrame(columns=['Confusion Matrix'])
    rows = []

    bnb = BernoulliNB()
    bnb.fit(X_train, y_train)
    predicted_labels = bnb.predict(X_test)
    tn, fp, fn, tp = confusion_matrix(y_test, predicted_labels, labels=[0,1]).ravel()
    convert_matrix_b = [tn,fp,fn,tp]

    df = df.append({ 'Confusion Matrix':convert_matrix_b}, ignore_index=True)
    return df

    Creates multiple Naive Bayes classifier models on X_train and y_train with different parameters.
    Runs the models on X_test and compare the results with y_test.
    
    Args:
        X_train: A Numpy array containing the dataset for training
        X_test: A Numpy array containing the dataset for testing
        y_train: A Numpy array consisting of the target values for training
        y_test: A Numpy array consisting of the target values for testing

    Returns:
        A DataFrame with all the paramaters used and confusion matrices of each model
    
Creates multiple Naive Bayes classifier models on X_train and y_train with different parameters.
Runs the models on X_test and compare the results with y_test.
Creates multiple Naive Bayes classifier models on X_train and y_train with different parameters . Runs the models on X_test and compare the results with y_test .
def naive_bayes(X_train,X_test,y_train,y_test):
    df = pd.DataFrame(columns=['Confusion Matrix'])
    rows = []
    bnb = BernoulliNB()
    bnb.fit(X_train, y_train)
    predicted_labels = bnb.predict(X_test)
    tn, fp, fn, tp = confusion_matrix(y_test, predicted_labels, labels=[0,1]).ravel()
    convert_matrix_b = [tn,fp,fn,tp]
    df = df.append({ 'Confusion Matrix':convert_matrix_b}, ignore_index=True)
    return df
def naive_bayes ( X_train , X_test , y_train , y_test ) : df = pd . DataFrame ( columns = [ 'Confusion Matrix' ] ) rows = [ ] bnb = BernoulliNB ( ) bnb . fit ( X_train , y_train ) predicted_labels = bnb . predict ( X_test ) tn , fp , fn , tp = confusion_matrix ( y_test , predicted_labels , labels = [ 0 , 1 ] ) . ravel ( ) convert_matrix_b = [ tn , fp , fn , tp ] df = df . append ( { 'Confusion Matrix' : convert_matrix_b } , ignore_index = True ) return df
Creates multiple Naive Bayes classifier models on X_train and y_train with different parameters.
Creates multiple Naive Bayes classifier models on X_train and y_train with different parameters .
'''
    Creates multiple Naive Bayes classifier models on X_train and y_train with different parameters.
    Runs the models on X_test and compare the results with y_test.
    
    Args:
        X_train: A Numpy array containing the dataset for training
        X_test: A Numpy array containing the dataset for testing
        y_train: A Numpy array consisting of the target values for training
        y_test: A Numpy array consisting of the target values for testing

    Returns:
        A DataFrame with all the paramaters used and confusion matrices of each model
    '''
A DataFrame with all the paramaters used and confusion matrices of each model
A DataFrame with all the paramaters used and confusion matrices of each model
X_train
A Numpy array containing the dataset for training
A Numpy array containing the dataset for training
X_test
A Numpy array containing the dataset for testing
A Numpy array containing the dataset for testing
y_train
A Numpy array consisting of the target values for training
A Numpy array consisting of the target values for training
y_test
A Numpy array consisting of the target values for testing
A Numpy array consisting of the target values for testing