Xtest = X[trainlen+1:]
    Yhtest = Yh[trainlen+1:]
    Ystest = Ys[trainlen+1:]
    Yvtest = Yv[trainlen+1:]
    idstest = ids[trainlen+1:]


    rh = regression_one(Xtrain, Yhtrain)
    rs = regression_one(Xtrain, Ystrain)
    rv = regression_one(Xtrain, Yvtrain)
    Yhpred = np.sum(Xtest * rh, axis=1)
    Yspred = np.sum(Xtest * rs, axis=1)
    Yvpred = np.sum(Xtest * rv, axis=1)
  
    h_avg = average_vector_dist(Yhpred, h_dict, idstest)
    s_avg = average_vector_dist(Yspred, s_dict, idstest)
    v_avg = average_vector_dist(Yvpred, v_dict, idstest)

    avg = (h_avg + s_avg + v_avg)/3
    if (avg < best_avg):
        best_avg = avg
        best_h = h_avg
        best_s = s_avg
        best_v = v_avg


print "BEST"
print "h: " + str(best_h)
print "s: " + str(best_s)
print "v: " + str(best_v)
Esempio n. 2
0
    Ybtrain = Yb[1:trainlen]

    Xtest = X[trainlen + 1:]
    Yrtest = Yr[trainlen + 1:]
    Ygtest = Yg[trainlen + 1:]
    Ybtest = Yb[trainlen + 1:]
    idstest = ids[trainlen + 1:]

    rr = regression_one(Xtrain, Yrtrain)
    rg = regression_one(Xtrain, Ygtrain)
    rb = regression_one(Xtrain, Ybtrain)
    Yrpred = np.sum(Xtest * rr, axis=1)
    Ygpred = np.sum(Xtest * rg, axis=1)
    Ybpred = np.sum(Xtest * rb, axis=1)

    r_avg = average_vector_dist(Yrpred, r_dict, idstest)
    g_avg = average_vector_dist(Ygpred, g_dict, idstest)
    b_avg = average_vector_dist(Ybpred, b_dict, idstest)

    avg = (r_avg + g_avg + b_avg) / 3
    if (avg < best_avg):
        best_avg = avg
        best_r = r_avg
        best_g = g_avg
        best_b = b_avg

print "BEST"
print "r: " + str(best_r)
print "g: " + str(best_g)
print "b: " + str(best_b)
    Yarotrain = Yaro[1:trainlen]
    

    Xtest = X[trainlen+1:]
    Yvatest = Yva[trainlen+1:]
    Yarotest = Yaro[trainlen+1:]
    idstest = ids[trainlen+1:]
    #print Yarotest[0]

    rva = regression_one(Xtrain, Yvatrain)
    raro = regression_one(Xtrain, Yarotrain)
    
    Yvapred = np.sum(Xtest * rva, axis=1)
    Yaropred = np.sum(Xtest * raro, axis=1)
  
    va_avg = average_vector_dist(Yvapred, va_dict, idstest)
    aro_avg = average_vector_dist_polar(Yaropred, aro_dict, idstest)

    avg = (va_avg + aro_avg)/2
    if (avg < best_avg):
        best_avg = avg
        best_va = va_avg
        best_aro = aro_avg



print "BEST"
print "r: " + str(best_va)
print "theta: " + str(best_aro)

Esempio n. 4
0
    Yvtrain = Yv[1:trainlen]

    Xtest = X[trainlen + 1:]
    Yhtest = Yh[trainlen + 1:]
    Ystest = Ys[trainlen + 1:]
    Yvtest = Yv[trainlen + 1:]
    idstest = ids[trainlen + 1:]

    rh = regression_one(Xtrain, Yhtrain)
    rs = regression_one(Xtrain, Ystrain)
    rv = regression_one(Xtrain, Yvtrain)
    Yhpred = np.sum(Xtest * rh, axis=1)
    Yspred = np.sum(Xtest * rs, axis=1)
    Yvpred = np.sum(Xtest * rv, axis=1)

    h_avg = average_vector_dist(Yhpred, h_dict, idstest)
    s_avg = average_vector_dist(Yspred, s_dict, idstest)
    v_avg = average_vector_dist(Yvpred, v_dict, idstest)

    avg = (h_avg + s_avg + v_avg) / 3
    if (avg < best_avg):
        best_avg = avg
        best_h = h_avg
        best_s = s_avg
        best_v = v_avg

print "BEST"
print "h: " + str(best_h)
print "s: " + str(best_s)
print "v: " + str(best_v)
Esempio n. 5
0
    Xtrain = X[1:trainlen]
    Yvatrain = Yva[1:trainlen]
    Yarotrain = Yaro[1:trainlen]
    

    Xtest = X[trainlen+1:]
    Yvatest = Yva[trainlen+1:]
    Yarotest = Yaro[trainlen+1:]
    idstest = ids[trainlen+1:]

    rva = regression_one(Xtrain, Yvatrain)
    raro = regression_one(Xtrain, Yarotrain)
    
    Yvapred = np.sum(Xtest * rva, axis=1)
    Yaropred = np.sum(Xtest * raro, axis=1)
  
    va_avg = average_vector_dist(Yvapred, va_dict, idstest)
    aro_avg = average_vector_dist(Yaropred, aro_dict, idstest)

    avg = (va_avg + aro_avg)/2
    if (avg < best_avg):
        best_avg = avg
        best_va = va_avg
        best_aro = aro_avg

print "BEST"
print "v: " + str(best_va)
print "a: " + str(best_aro)

    Xtest = X[trainlen+1:]
    Yrtest = Yr[trainlen+1:]
    Ygtest = Yg[trainlen+1:]
    Ybtest = Yb[trainlen+1:]
    idstest = ids[trainlen+1:]
    
    rr = regression_one(Xtrain, Yrtrain)
    rg = regression_one(Xtrain, Ygtrain)
    rb = regression_one(Xtrain, Ybtrain)
    Yrpred = np.sum(Xtest * rr, axis=1)
    Ygpred = np.sum(Xtest * rg, axis=1)
    Ybpred = np.sum(Xtest * rb, axis=1)

  
    r_avg = average_vector_dist(Yrpred, r_dict, idstest)
    g_avg = average_vector_dist(Ygpred, g_dict, idstest)
    b_avg = average_vector_dist(Ybpred, b_dict, idstest)

    avg = (r_avg + g_avg + b_avg)/3
    if (avg < best_avg):
        best_avg = avg
        best_r = r_avg
        best_g = g_avg
        best_b = b_avg



print "BEST"
print "r: " + str(best_r)
print "g: " + str(best_g)
Esempio n. 7
0
    trainlen = int(len(Yaro) * 0.7)

    Xtrain = X[1:trainlen]
    Yvatrain = Yva[1:trainlen]
    Yarotrain = Yaro[1:trainlen]

    Xtest = X[trainlen + 1:]
    Yvatest = Yva[trainlen + 1:]
    Yarotest = Yaro[trainlen + 1:]
    idstest = ids[trainlen + 1:]
    #print Yarotest[0]

    rva = regression_one(Xtrain, Yvatrain)
    raro = regression_one(Xtrain, Yarotrain)

    Yvapred = np.sum(Xtest * rva, axis=1)
    Yaropred = np.sum(Xtest * raro, axis=1)

    va_avg = average_vector_dist(Yvapred, va_dict, idstest)
    aro_avg = average_vector_dist_polar(Yaropred, aro_dict, idstest)

    avg = (va_avg + aro_avg) / 2
    if (avg < best_avg):
        best_avg = avg
        best_va = va_avg
        best_aro = aro_avg

print "BEST"
print "r: " + str(best_va)
print "theta: " + str(best_aro)