p300_detector.py
def log_reg(X, y):
    '''
    This function trains a logistic regression classifer on given data and 
    evaluates its performance by plotting the confusion matrix.

    Parameters
    ----------
    X : 2d array: sample x feature
        DESCRIPTION. Training data
    y : 1d array
        DESCRIPTION. Labels

    Returns
    -------
    clf_lg : logistic regression object
        DESCRIPTION. The trained LG classifer

    '''
    # split the data into training and testing datasets
    X_train, X_test, y_train, y_test = train_test_split(scale(X), y)
    print('Train Logistic Regression model...')
    clf_lg = LogisticRegression(random_state=0).fit(X_train, y_train)
    print('Now the classifier has been trained.')
    
    # print report and plot confusion matrix
    label = 'LogReg_confusion_matrix'
    plot_matrix(X_test, y_test, clf_lg, label)
    # return trained classifier
    return clf_lg

    This function trains a logistic regression classifer on given data and 
    evaluates its performance by plotting the confusion matrix.

    Parameters
    ----------
    X : 2d array: sample x feature
        DESCRIPTION. Training data
    y : 1d array
        DESCRIPTION. Labels

    Returns
    -------
    clf_lg : logistic regression object
        DESCRIPTION. The trained LG classifer

    
This function trains a logistic regression classifer on given data and
evaluates its performance by plotting the confusion matrix.

Parameters

X : 2d array: sample x feature
DESCRIPTION. Training data
y : 1d array
DESCRIPTION. Labels

Returns

clf_lg : logistic regression object
DESCRIPTION. The trained LG classifer
This function trains a logistic regression classifer on given data and evaluates its performance by plotting the confusion matrix . Parameters X : 2d array : sample x feature DESCRIPTION . Training data y : 1d array DESCRIPTION . Labels Returns clf_lg : logistic regression object DESCRIPTION . The trained LG classifer
def log_reg(X, y):
    X_train, X_test, y_train, y_test = train_test_split(scale(X), y)
    print('Train Logistic Regression model...')
    clf_lg = LogisticRegression(random_state=0).fit(X_train, y_train)
    print('Now the classifier has been trained.')
    label = 'LogReg_confusion_matrix'
    plot_matrix(X_test, y_test, clf_lg, label)
    return clf_lg
def log_reg ( X , y ) : X_train , X_test , y_train , y_test = train_test_split ( scale ( X ) , y ) print ( 'Train Logistic Regression model...' ) clf_lg = LogisticRegression ( random_state = 0 ) . fit ( X_train , y_train ) print ( 'Now the classifier has been trained.' ) label = 'LogReg_confusion_matrix' plot_matrix ( X_test , y_test , clf_lg , label ) return clf_lg
This function trains a logistic regression classifer on given data and
evaluates its performance by plotting the confusion matrix.
This function trains a logistic regression classifer on given data and evaluates its performance by plotting the confusion matrix .
'''
    This function trains a logistic regression classifer on given data and 
    evaluates its performance by plotting the confusion matrix.

    Parameters
    ----------
    X : 2d array: sample x feature
        DESCRIPTION. Training data
    y : 1d array
        DESCRIPTION. Labels

    Returns
    -------
    clf_lg : logistic regression object
        DESCRIPTION. The trained LG classifer

    ''' # split the data into training and testing datasets # print report and plot confusion matrix # return trained classifier
X
y