コード例 #1
0
def testLinRidge_test_data():
    dX, y = get_test_data()
    X = pd.DataFrame(data=dX, columns=["x0", "x1"])
    X['y'] = y
    #print hw2.linear_reg_errors(h_train, h_test, 'MEDV', True)
    print hw2.linear_reg(X, 'y', False, True)
コード例 #2
0
def testLinRidge():
    h_test, h_train = utils.load_and_normalize_housing_set()
    #print hw2.linear_reg_errors(h_train, h_test, 'MEDV', True)
    print hw2.linear_reg(h_train, 'MEDV', False, False)
コード例 #3
0
def lin_ridge_wrap(X, y):

    df = pd.DataFrame(X)
    df['is_spam'] = y
    accuracy = hw2.linear_reg(df, 'is_spam', True, True)  # returns accuracy
    return accuracy