コード例 #1
0
def problem10():
  train, test = getData()
  class1 = 3
  class2 = 7
  for  l in [.01, 1.]:
    X, Y = prepareOneVsOne(train, class1, class2)
    X_out, Y_out = prepareOneVsOne(test, class1, class2)
    print 'lambda {} E_in {:} E_out {:}'.format(l, *regression(X, Y, X_out, Y_out, l, 'nonlinear'))
コード例 #2
0
def problem7_9():
  train, test = getData()
  l = 1.
  class2 = 1
  for class1 in range(10):
    X, Y = prepareOneVsAll(train, class1)
    X_out, Y_out = prepareOneVsAll(test, class1)
    print '{} E_in {:} E_out {:}'.format(class1, *regression(X, Y, X_out, Y_out, l))
    print '{} E_in {:} E_out {:}'.format(class1, *regression(X, Y, X_out, Y_out, l, 'nonlinear'))
コード例 #3
0
def problem10():
    train, test = getData()
    class1 = 3
    class2 = 7
    for l in [.01, 1.]:
        X, Y = prepareOneVsOne(train, class1, class2)
        X_out, Y_out = prepareOneVsOne(test, class1, class2)
        print 'lambda {} E_in {:} E_out {:}'.format(
            l, *regression(X, Y, X_out, Y_out, l, 'nonlinear'))
コード例 #4
0
def problem7_9():
    train, test = getData()
    l = 1.
    class2 = 1
    for class1 in range(10):
        X, Y = prepareOneVsAll(train, class1)
        X_out, Y_out = prepareOneVsAll(test, class1)
        print '{} E_in {:} E_out {:}'.format(
            class1, *regression(X, Y, X_out, Y_out, l))
        print '{} E_in {:} E_out {:}'.format(
            class1, *regression(X, Y, X_out, Y_out, l, 'nonlinear'))