old_scripts/learnme_linear.py
def classification(X, Y, clist, cv_fold):
    """
    Training for Classification: predicts models using two regularization params, 
    returning the training and cross validation accuracies for each. 
    
    """
    
    accuracy = []
    for c in clist:
        l1 = LogisticRegression(C=c, penalty='l1')
        l2 = LogisticRegression(C=c, penalty='l2')
        strat_cv = StratifiedKFold(n_splits=cv_fold, shuffle=True)
        # for logR bug:
        Xs, Ys = shuffle(X, Y)
        l1_pred = cross_val_predict(l1, Xs, Ys, cv=strat_cv)
        l2_pred = cross_val_predict(l2, Xs, Ys, cv=strat_cv)
        # for diagnostic curves 
        l1.fit(Xs, Ys)
        l2.fit(Xs, Ys)
        tr1_pred = l1.predict(Xs)
        tr2_pred = l2.predict(Xs)
        # Accuracies
        cvl1 = metrics.accuracy_score(Ys, l1_pred)
        cvl2 = metrics.accuracy_score(Ys, l2_pred)
        trl1 = metrics.accuracy_score(Ys, tr1_pred)
        trl2 = metrics.accuracy_score(Ys, tr2_pred)
        # accuracies for csv
        acc = (cvl1, trl1, cvl2, trl2)
        accuracy.append(acc)
    return accuracy

    Training for Classification: predicts models using two regularization params, 
    returning the training and cross validation accuracies for each. 
    
    
Training for Classification: predicts models using two regularization params,
returning the training and cross validation accuracies for each.
Training for Classification : predicts models using two regularization params returning the training and cross validation accuracies for each .
def classification(X, Y, clist, cv_fold):
    accuracy = []
    for c in clist:
        l1 = LogisticRegression(C=c, penalty='l1')
        l2 = LogisticRegression(C=c, penalty='l2')
        strat_cv = StratifiedKFold(n_splits=cv_fold, shuffle=True)
        Xs, Ys = shuffle(X, Y)
        l1_pred = cross_val_predict(l1, Xs, Ys, cv=strat_cv)
        l2_pred = cross_val_predict(l2, Xs, Ys, cv=strat_cv)
        l1.fit(Xs, Ys)
        l2.fit(Xs, Ys)
        tr1_pred = l1.predict(Xs)
        tr2_pred = l2.predict(Xs)
        cvl1 = metrics.accuracy_score(Ys, l1_pred)
        cvl2 = metrics.accuracy_score(Ys, l2_pred)
        trl1 = metrics.accuracy_score(Ys, tr1_pred)
        trl2 = metrics.accuracy_score(Ys, tr2_pred)
        acc = (cvl1, trl1, cvl2, trl2)
        accuracy.append(acc)
    return accuracy
def classification ( X , Y , clist , cv_fold ) : accuracy = [ ] for c in clist : l1 = LogisticRegression ( C = c , penalty = 'l1' ) l2 = LogisticRegression ( C = c , penalty = 'l2' ) strat_cv = StratifiedKFold ( n_splits = cv_fold , shuffle = True ) Xs , Ys = shuffle ( X , Y ) l1_pred = cross_val_predict ( l1 , Xs , Ys , cv = strat_cv ) l2_pred = cross_val_predict ( l2 , Xs , Ys , cv = strat_cv ) l1 . fit ( Xs , Ys ) l2 . fit ( Xs , Ys ) tr1_pred = l1 . predict ( Xs ) tr2_pred = l2 . predict ( Xs ) cvl1 = metrics . accuracy_score ( Ys , l1_pred ) cvl2 = metrics . accuracy_score ( Ys , l2_pred ) trl1 = metrics . accuracy_score ( Ys , tr1_pred ) trl2 = metrics . accuracy_score ( Ys , tr2_pred ) acc = ( cvl1 , trl1 , cvl2 , trl2 ) accuracy . append ( acc ) return accuracy
Training for Classification: predicts models using two regularization params,
returning the training and cross validation accuracies for each.
Training for Classification : predicts models using two regularization params returning the training and cross validation accuracies for each .
"""
    Training for Classification: predicts models using two regularization params, 
    returning the training and cross validation accuracies for each. 
    
    """ # for logR bug: # for diagnostic curves  # Accuracies # accuracies for csv
X
Y
clist
cv_fold