def test_lr_d5_3_test():
    # NOTE! This test is for the TAs to run
    # You cannot pass this test without the true test labels.
    # This is a sanity check to make sure your solution for 5.3 is not too crazy

    global y_te
    y_hat_te = evaluation.read_predictions('lr-best-test.preds')
    assert_greater_equal(evaluation.acc(y_hat_te,y_te),.63)
Пример #2
0
def test_lr_d5_3_test():
    # NOTE! This test is for the TAs to run
    # You cannot pass this test without the true test labels.
    # This is a sanity check to make sure your solution for 5.3 is not too crazy

    global y_te
    y_hat_te = evaluation.read_predictions('lr-best-test.preds')
    assert_greater_equal(evaluation.acc(y_hat_te,y_te),.63)
def test_clf_base_d2_3():
    global x_dv, y_dv, y_te, labels

    y_hat = clf_base.predict_all(x_dv,hand_weights.theta_hand,labels)
    assert_greater_equal(evaluation.acc(y_hat,y_dv),.41)

    # just make sure the file is there
    y_hat_te = evaluation.read_predictions('hand-test.preds')
    eq_(len(y_hat_te),len(y_te))
Пример #4
0
def test_perc_d4_3_test():
    # NOTE! This test is for the TAs to run
    # You cannot pass this test without the true test labels.
    # This is a sanity check to make sure your solution for 4.3 is not too crazy

    global y_te
    y_hat_te = evaluation.read_predictions('avp-test.preds')
    # i get 66.8% accuracy
    assert_greater_equal(evaluation.acc(y_hat_te,y_te),.645)
Пример #5
0
def test_clf_base_d2_3():
    global x_dv, y_dv, y_te, labels

    y_hat = clf_base.predict_all(x_dv,hand_weights.theta_hand,labels)
    assert_greater_equal(evaluation.acc(y_hat,y_dv),.41)

    # just make sure the file is there
    y_hat_te = evaluation.read_predictions('hand-test.preds')
    eq_(len(y_hat_te),len(y_te))
def test_perc_d4_3_test():
    # NOTE! This test is for the TAs to run
    # You cannot pass this test without the true test labels.
    # This is a sanity check to make sure your solution for 4.3 is not too crazy

    global y_te
    y_hat_te = evaluation.read_predictions('avp-test.preds')
    # i get 66.8% accuracy
    assert_greater_equal(evaluation.acc(y_hat_te,y_te),.645)
Пример #7
0
def test_avp_d4_3():
    global y_dv, x_tr, y_tr

    # run on a subset of data
    theta_avp,theta_avp_history = perceptron.estimate_avg_perceptron(x_tr[:10],y_tr[:10],3)
    assert_almost_equals(theta_avp[('science','what')],3.2258,places=2)
    assert_almost_equals(theta_avp[('science','its')],0,places=2)
    assert_almost_equals(theta_avp[('worldnews','its')],0.871,places=2)
    
    y_hat_dv = evaluation.read_predictions('avp-dev.preds')
    # i get 66.4% accuracy
    assert_greater_equal(evaluation.acc(y_hat_dv,y_dv),.64)
Пример #8
0
def test_lr_d5_2():
    global x_tr, y_tr, y_dv, y_te

    # run on a subset of data
    theta_lr,theta_lr_hist = logreg.estimate_logreg(x_tr[:10],y_tr[:10],3)
    assert_almost_equals(theta_lr[('science','what')],.000402,places=4)
    assert_almost_equals(theta_lr[('iama', 'missile')],-0.00031832285759249263,places=4)
    assert_almost_equals(theta_lr[('iama',constants.OFFSET)],.00045298,places=4)
    assert_almost_equals(theta_lr[('askreddit',constants.OFFSET)],0.,places=4)

    # dev set accuracy
    y_hat_dv = evaluation.read_predictions('lr-dev.preds')
    assert_greater_equal(evaluation.acc(y_hat_dv,y_dv),.595)
def test_lr_d5_2():
    global x_tr, y_tr, y_dv, y_te

    # run on a subset of data
    theta_lr,theta_lr_hist = logreg.estimate_logreg(x_tr[:10],y_tr[:10],3)
    assert_almost_equals(theta_lr[('science','what')],.000402,places=4)
    assert_almost_equals(theta_lr[('iama', 'missile')],-0.00031832285759249263,places=4)
    assert_almost_equals(theta_lr[('iama',constants.OFFSET)],.00045298,places=4)
    assert_almost_equals(theta_lr[('askreddit',constants.OFFSET)],0.,places=4)

    # dev set accuracy
    y_hat_dv = evaluation.read_predictions('lr-dev.preds')
    assert_greater_equal(evaluation.acc(y_hat_dv,y_dv),.595)
Пример #10
0
def test_perc_d4_2():
    global y_dv, x_tr, y_tr

    # run on a subset of data
    theta_perc,theta_perc_history = perceptron.estimate_perceptron(x_tr[:10],y_tr[:10],3)
    eq_(theta_perc[('worldnews','its')],1)
    eq_(theta_perc[('science','its')],0)
    eq_(theta_perc[('science','what')],4)
    eq_(theta_perc[('worldnews','always')],-1)
    eq_(theta_perc_history[0][('science','what')],2)
    
    y_hat_dv = evaluation.read_predictions('perc-dev.preds')
    # i get 64.6% accuracy
    assert_greater_equal(evaluation.acc(y_hat_dv,y_dv),.62)
Пример #11
0
def test_perc_d4_2():
    global y_dv, x_tr, y_tr

    # run on a subset of data
    theta_perc,theta_perc_history = perceptron.estimate_perceptron(x_tr[:10],y_tr[:10],3)
    eq_(theta_perc[('worldnews','its')],1)
    eq_(theta_perc[('science','its')],0)
    eq_(theta_perc[('science','what')],4)
    eq_(theta_perc[('worldnews','always')],-1)
    eq_(theta_perc_history[0][('science','what')],2)
    
    y_hat_dv = evaluation.read_predictions('perc-dev.preds')
    # i get 64.6% accuracy
    assert_greater_equal(evaluation.acc(y_hat_dv,y_dv),.62)
Пример #12
0
def test_avp_d4_3():
    global y_dv, x_tr, y_tr

    theta_avp,theta_avp_history = perceptron.estimate_avg_perceptron(x_tr[:10],y_tr[:10],3)
    # with t=0 initialization
    #assert_almost_equals(theta_avp[('science','what')],3.2,places=1)
    # with t=1 initialization
    assert_almost_equals(theta_avp[('science','what')],3.2258,places=1)
    assert_almost_equals(theta_avp[('science','its')],0,places=2)

    # with t=0 initialization
    #assert_almost_equals(theta_avp[('worldnews','its')],0.866,places=1)
    # with t=1 initialization
    assert_almost_equals(theta_avp[('worldnews','its')],0.871,places=1)
    
    y_hat_dv = evaluation.read_predictions('avp-dev.preds')
    # i get 66.4% accuracy
    assert_greater_equal(evaluation.acc(y_hat_dv,y_dv),.64)
Пример #13
0
def test_feats_d7_1_test():
    global y_te
    y_hat_te = evaluation.read_predictions('bakeoff-test.preds')
    assert_greater_equal(evaluation.acc(y_hat_te,y_te),.722)
Пример #14
0
def test_lr_d5_3():
    global y_dv
    y_hat_dv = evaluation.read_predictions('lr-best-dev.preds')
    assert_greater_equal(evaluation.acc(y_hat_dv,y_dv),.66)
Пример #15
0
def test_d3_3b_nb():
    global y_dv
    y_hat_dv = evaluation.read_predictions('nb-dev.preds')
    assert_greater_equal(evaluation.acc(y_hat_dv, y_dv), .46)
Пример #16
0
def test_feats_d7_1():
    global y_dv
    y_hat_dv = evaluation.read_predictions('bakeoff-dev.preds')
    assert_greater_equal(evaluation.acc(y_hat_dv,y_dv),.78)
Пример #17
0
def test_feats_d7_1():
    global y_dv
    y_hat_dv = evaluation.read_predictions('bakeoff-dev.preds')
    assert_greater_equal(evaluation.acc(y_hat_dv,y_dv),.78)
Пример #18
0
def test_lr_d5_3():
    global y_dv
    y_hat_dv = evaluation.read_predictions('lr-best-dev.preds')
    assert_greater_equal(evaluation.acc(y_hat_dv,y_dv),.66)
Пример #19
0
def test_feats_d7_1_test():
    global y_te
    y_hat_te = evaluation.read_predictions('bakeoff-test.preds')
    assert_greater_equal(evaluation.acc(y_hat_te,y_te),.722)
def test_d4_2b_perc_accuracy():
    global y_dv
    # i get 43% accuracy
    y_hat_dv = evaluation.read_predictions('perc-dev.preds')
    assert_greater_equal(evaluation.acc(y_hat_dv, y_dv), .43)
Пример #21
0
def test_d3_3b_nb():
    global y_dv
    y_hat_dv = evaluation.read_predictions('nb-dev.preds')
    assert_greater_equal(evaluation.acc(y_hat_dv,y_dv),.46)
Пример #22
0
def test_d4_2b_perc_accuracy():
    global y_dv
    # i get 43% accuracy
    y_hat_dv = evaluation.read_predictions('perc-dev.preds')
    assert_greater_equal(evaluation.acc(y_hat_dv,y_dv),.43)