Exemple #1
0
def main():
    train_set, test_set = divide(scale(load_data()), 0.2)

    c = optimize_constant(train_set)
    w = linear_regression_w(train_set, c)

    e = calculate_error(test_set, w)
    print('regularization constant = %f\nerror = %6.2f' % (c, percent(e)))
Exemple #2
0
def main():
    train_set, test_set = divide(scale(load_data()), 0.2)

    c = optimize_constant(train_set)
    w = linear_regression_w(train_set, c)

    e = calculate_error(test_set, w)
    print('regularization constant = %f\nerror = %6.2f' % (c, percent(e)))
Exemple #3
0
def main():
    train_set, test_set = divide(load_data())

    c = optimize_c(train_set)
    w, b = fit_svm(train_set, c)

    e = calculate_error(test_set, w, b)
    print('C = %f\nerror = %6.2f' % (c, percent(e)))
Exemple #4
0
def main():
    train_set, test_set = divide(load_data())

    c = optimize_c(train_set)
    w, b = fit_svm(train_set, c)

    e = calculate_error(test_set, w, b)
    print('C = %f\nerror = %6.2f' % (c, percent(e)))
Exemple #5
0
def main():
    train_set, test_set = divide(load_data(negative=0))

    size, lambda_c = optimize_size_lambda(train_set, 2)
    theta1, theta2 = thetas(train_set, size, lambda_c, 2)

    print('hidden layer size = %d' % size)
    print('lambda = %f' % lambda_c)
    print('error = %6.2f' % percent(calculate_error(test_set, theta1, theta2)))
Exemple #6
0
def main():
    train_set, test_set = divide(load_data())