import sys
import csv
import pandas as pd
import numpy as np

##Read in
trait_mean = [38.581646755320783 , 189778.36651208502 , 0 , 1077.6488437087312 , 87.303829734958995 , 40.437455852092995]
trait_var = [13.640223092304081 , 105548.3568808909 , 0 , 7385.1786769465862 , 402.95403082754581 , 12.347239075706955]
suggest_array = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105] 
suggest_array_square = [0 , 5]
suggest_array_cubed = [0]

n_trait_1 = len(suggest_array)
n_trait_2 = len(suggest_array_square)
n_trait_3 = len(suggest_array_cubed)
#n_trait = n_trait_1 + n_trait_2
n_trait = n_trait_1 + n_trait_2 + n_trait_3

total = 16281
XTest = [[0 for x in range(total)] for y in range(n_trait)]
np.set_printoptions(threshold=np.inf)

with open(sys.argv[1]) as TrainingData:
        XTest_raw = csv.reader(TrainingData)
        C = -1
        for row in XTest_raw:
                if (C != -1):
                        for i in range(n_trait_1):
                                R = suggest_array[i]
                                if (R == 0) or (R == 1) or (R == 3) or (R == 4) or (R == 5):
                                        XTest[i][C] = (float(row[R]) - trait_mean[R])/trait_var[R] 
                                else:
                                        XTest[i][C] = float(row[R])

                        for i in range(n_trait_2):
                                R = suggest_array_square[i]
                                val = (float(row[R]) - trait_mean[R])/trait_var[R] 
                                XTest[n_trait_1+i][C] = val*val 
                        
                        for i in range(n_trait_3):
                                R = suggest_array_cubed[i]
                                val = (float(row[R]) - trait_mean[R])/trait_var[R] 
                                XTest[n_trait_1+n_trait_2+i][C] = val*val*val
                                                  
                C = C + 1

XTest = np.matrix(XTest)
#print("XTest.shape = ",XTest.shape)

X = XTest
b = -2.879322873432308
w = np.matrix([[  0.75708139],
        [  0.08406662],
        [  0.87272753],
        [  2.38185781],
        [  0.25473149],
        [  0.41373285],
        [  0.82420475],
        [  0.15958174],
        [ -1.71803162],
        [  0.41502287],
        [  0.62055446],
        [ -0.02367942],
        [  0.05386114],
        [ -4.24191827],
        [  1.03108149],
        [ -0.251246  ],
        [ -0.17541664],
        [  0.11345084],
        [ -0.77900473],
        [ -0.55342855],
        [ -0.70097971],
        [ -0.44726516],
        [  0.95612169],
        [  0.97200433],
        [  1.59601375],
        [  2.77529233],
        [  0.47921339],
        [  1.90848759],
        [-12.12287222],
        [  2.51645202],
        [  0.83385413],
        [ -1.26584052],
        [  1.99640957],
        [  1.11257453],
        [ -1.20629584],
        [ -1.44242201],
        [ -1.36424315],
        [ -0.70950546],
        [  0.2031504 ],
        [ -0.88057841],
        [  0.20155831],
        [  0.96946678],
        [ -0.68368208],
        [ -0.46103625],
        [ -0.1426921 ],
        [ -0.5855118 ],
        [ -3.85412847],
        [  0.70351261],
        [  0.88914126],
        [  0.50715288],
        [  0.85236719],
        [  0.08890693],
        [ -0.68695014],
        [ -0.82382421],
        [ -0.16272702],
        [ -0.99124575],
        [ -1.14547931],
        [ -0.36656411],
        [  0.61051753],
        [ -0.95342199],
        [ -0.27954453],
        [ -0.57557364],
        [ -0.73160729],
        [ -0.33917542],
        [  1.47725283],
        [  0.56825991],
        [ -0.54384385],
        [ -1.74880648],
        [  0.49104043],
        [ -1.69272739],
        [  0.11392572],
        [ -0.49639021],
        [  0.72026226],
        [  0.74446287],
        [  0.68700432],
        [ -0.6797157 ],
        [  0.15552584],
        [  0.0997255 ],
        [ -0.77858183],
        [ -1.21140221],
        [  0.29602927],
        [  0.37722458],
        [ -0.11332444],
        [  0.2899976 ],
        [  1.05080217],
        [  1.01778777],
        [  0.29802757],
        [  0.62451553],
        [ -0.12516954],
        [ -0.30002952],
        [ -0.63109399],
        [ -3.89432624],
        [ -0.45380159],
        [  0.70151952],
        [  0.40505259],
        [  0.13943356],
        [ -0.16939767],
        [  0.16238131],
        [ -0.64449079],
        [  0.38637322],
        [ -0.10390433],
        [ -0.46549759],
        [  0.46134224],
        [ -0.84103174],
        [  0.7074041 ],
        [  0.03886153],
        [ -0.5985399 ],
        [ -0.06736554],
        [  0.10098938]])


print("id,label")
z = (np.dot(X.T,w)+b*np.ones(shape=(total,1)))
y_hat = np.ones(shape=(total,1))/(np.ones(shape=(total,1))+np.exp(-z))

for k in range(16281):
        if y_hat[k] >= 0.5:
              print("%s,%d"%(k+1,1))
        else:  
              print("%s,%d"%(k+1,0))

14e4d49b9313c4e5e7b7009f402aa47882d64580
<mask token>

<mask token>
np.set_printoptions(threshold=np.inf)
with open(sys.argv[1]) as TrainingData:
    XTest_raw = csv.reader(TrainingData)
    C = -1
    for row in XTest_raw:
        if C != -1:
            for i in range(n_trait_1):
                R = suggest_array[i]
                if R == 0 or R == 1 or R == 3 or R == 4 or R == 5:
                    XTest[i][C] = (float(row[R]) - trait_mean[R]) / trait_var[R
                        ]
                else:
                    XTest[i][C] = float(row[R])
            for i in range(n_trait_2):
                R = suggest_array_square[i]
                val = (float(row[R]) - trait_mean[R]) / trait_var[R]
                XTest[n_trait_1 + i][C] = val * val
            for i in range(n_trait_3):
                R = suggest_array_cubed[i]
                val = (float(row[R]) - trait_mean[R]) / trait_var[R]
                XTest[n_trait_1 + n_trait_2 + i][C] = val * val * val
        C = C + 1
<mask token>
print('id,label')
<mask token>
for k in range(16281):
    if y_hat[k] >= 0.5:
        print('%s,%d' % (k + 1, 1))
    else:
        print('%s,%d' % (k + 1, 0))

<mask token>
trait_mean = [38.58164675532078, 189778.36651208502, 0, 1077.6488437087312,
    87.303829734959, 40.437455852092995]
trait_var = [13.640223092304081, 105548.3568808909, 0, 7385.178676946586, 
    402.9540308275458, 12.347239075706955]
suggest_array = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 
    17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
    35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
    53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
    71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
    89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105]
suggest_array_square = [0, 5]
suggest_array_cubed = [0]
n_trait_1 = len(suggest_array)
n_trait_2 = len(suggest_array_square)
n_trait_3 = len(suggest_array_cubed)
n_trait = n_trait_1 + n_trait_2 + n_trait_3
total = 16281
XTest = [[(0) for x in range(total)] for y in range(n_trait)]
np.set_printoptions(threshold=np.inf)
with open(sys.argv[1]) as TrainingData:
    XTest_raw = csv.reader(TrainingData)
    C = -1
    for row in XTest_raw:
        if C != -1:
            for i in range(n_trait_1):
                R = suggest_array[i]
                if R == 0 or R == 1 or R == 3 or R == 4 or R == 5:
                    XTest[i][C] = (float(row[R]) - trait_mean[R]) / trait_var[R
                        ]
                else:
                    XTest[i][C] = float(row[R])
            for i in range(n_trait_2):
                R = suggest_array_square[i]
                val = (float(row[R]) - trait_mean[R]) / trait_var[R]
                XTest[n_trait_1 + i][C] = val * val
            for i in range(n_trait_3):
                R = suggest_array_cubed[i]
                val = (float(row[R]) - trait_mean[R]) / trait_var[R]
                XTest[n_trait_1 + n_trait_2 + i][C] = val * val * val
        C = C + 1
XTest = np.matrix(XTest)
X = XTest
b = -2.879322873432308
w = np.matrix([[0.75708139], [0.08406662], [0.87272753], [2.38185781], [
    0.25473149], [0.41373285], [0.82420475], [0.15958174], [-1.71803162], [
    0.41502287], [0.62055446], [-0.02367942], [0.05386114], [-4.24191827],
    [1.03108149], [-0.251246], [-0.17541664], [0.11345084], [-0.77900473],
    [-0.55342855], [-0.70097971], [-0.44726516], [0.95612169], [0.97200433],
    [1.59601375], [2.77529233], [0.47921339], [1.90848759], [-12.12287222],
    [2.51645202], [0.83385413], [-1.26584052], [1.99640957], [1.11257453],
    [-1.20629584], [-1.44242201], [-1.36424315], [-0.70950546], [0.2031504],
    [-0.88057841], [0.20155831], [0.96946678], [-0.68368208], [-0.46103625],
    [-0.1426921], [-0.5855118], [-3.85412847], [0.70351261], [0.88914126],
    [0.50715288], [0.85236719], [0.08890693], [-0.68695014], [-0.82382421],
    [-0.16272702], [-0.99124575], [-1.14547931], [-0.36656411], [0.61051753
    ], [-0.95342199], [-0.27954453], [-0.57557364], [-0.73160729], [-
    0.33917542], [1.47725283], [0.56825991], [-0.54384385], [-1.74880648],
    [0.49104043], [-1.69272739], [0.11392572], [-0.49639021], [0.72026226],
    [0.74446287], [0.68700432], [-0.6797157], [0.15552584], [0.0997255], [-
    0.77858183], [-1.21140221], [0.29602927], [0.37722458], [-0.11332444],
    [0.2899976], [1.05080217], [1.01778777], [0.29802757], [0.62451553], [-
    0.12516954], [-0.30002952], [-0.63109399], [-3.89432624], [-0.45380159],
    [0.70151952], [0.40505259], [0.13943356], [-0.16939767], [0.16238131],
    [-0.64449079], [0.38637322], [-0.10390433], [-0.46549759], [0.46134224],
    [-0.84103174], [0.7074041], [0.03886153], [-0.5985399], [-0.06736554],
    [0.10098938]])
print('id,label')
z = np.dot(X.T, w) + b * np.ones(shape=(total, 1))
y_hat = np.ones(shape=(total, 1)) / (np.ones(shape=(total, 1)) + np.exp(-z))
for k in range(16281):
    if y_hat[k] >= 0.5:
        print('%s,%d' % (k + 1, 1))
    else:
        print('%s,%d' % (k + 1, 0))

import sys
import csv
import pandas as pd
import numpy as np
trait_mean = [38.58164675532078, 189778.36651208502, 0, 1077.6488437087312,
    87.303829734959, 40.437455852092995]
trait_var = [13.640223092304081, 105548.3568808909, 0, 7385.178676946586, 
    402.9540308275458, 12.347239075706955]
suggest_array = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 
    17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
    35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
    53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
    71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
    89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105]
suggest_array_square = [0, 5]
suggest_array_cubed = [0]
n_trait_1 = len(suggest_array)
n_trait_2 = len(suggest_array_square)
n_trait_3 = len(suggest_array_cubed)
n_trait = n_trait_1 + n_trait_2 + n_trait_3
total = 16281
XTest = [[(0) for x in range(total)] for y in range(n_trait)]
np.set_printoptions(threshold=np.inf)
with open(sys.argv[1]) as TrainingData:
    XTest_raw = csv.reader(TrainingData)
    C = -1
    for row in XTest_raw:
        if C != -1:
            for i in range(n_trait_1):
                R = suggest_array[i]
                if R == 0 or R == 1 or R == 3 or R == 4 or R == 5:
                    XTest[i][C] = (float(row[R]) - trait_mean[R]) / trait_var[R
                        ]
                else:
                    XTest[i][C] = float(row[R])
            for i in range(n_trait_2):
                R = suggest_array_square[i]
                val = (float(row[R]) - trait_mean[R]) / trait_var[R]
                XTest[n_trait_1 + i][C] = val * val
            for i in range(n_trait_3):
                R = suggest_array_cubed[i]
                val = (float(row[R]) - trait_mean[R]) / trait_var[R]
                XTest[n_trait_1 + n_trait_2 + i][C] = val * val * val
        C = C + 1
XTest = np.matrix(XTest)
X = XTest
b = -2.879322873432308
w = np.matrix([[0.75708139], [0.08406662], [0.87272753], [2.38185781], [
    0.25473149], [0.41373285], [0.82420475], [0.15958174], [-1.71803162], [
    0.41502287], [0.62055446], [-0.02367942], [0.05386114], [-4.24191827],
    [1.03108149], [-0.251246], [-0.17541664], [0.11345084], [-0.77900473],
    [-0.55342855], [-0.70097971], [-0.44726516], [0.95612169], [0.97200433],
    [1.59601375], [2.77529233], [0.47921339], [1.90848759], [-12.12287222],
    [2.51645202], [0.83385413], [-1.26584052], [1.99640957], [1.11257453],
    [-1.20629584], [-1.44242201], [-1.36424315], [-0.70950546], [0.2031504],
    [-0.88057841], [0.20155831], [0.96946678], [-0.68368208], [-0.46103625],
    [-0.1426921], [-0.5855118], [-3.85412847], [0.70351261], [0.88914126],
    [0.50715288], [0.85236719], [0.08890693], [-0.68695014], [-0.82382421],
    [-0.16272702], [-0.99124575], [-1.14547931], [-0.36656411], [0.61051753
    ], [-0.95342199], [-0.27954453], [-0.57557364], [-0.73160729], [-
    0.33917542], [1.47725283], [0.56825991], [-0.54384385], [-1.74880648],
    [0.49104043], [-1.69272739], [0.11392572], [-0.49639021], [0.72026226],
    [0.74446287], [0.68700432], [-0.6797157], [0.15552584], [0.0997255], [-
    0.77858183], [-1.21140221], [0.29602927], [0.37722458], [-0.11332444],
    [0.2899976], [1.05080217], [1.01778777], [0.29802757], [0.62451553], [-
    0.12516954], [-0.30002952], [-0.63109399], [-3.89432624], [-0.45380159],
    [0.70151952], [0.40505259], [0.13943356], [-0.16939767], [0.16238131],
    [-0.64449079], [0.38637322], [-0.10390433], [-0.46549759], [0.46134224],
    [-0.84103174], [0.7074041], [0.03886153], [-0.5985399], [-0.06736554],
    [0.10098938]])
print('id,label')
z = np.dot(X.T, w) + b * np.ones(shape=(total, 1))
y_hat = np.ones(shape=(total, 1)) / (np.ones(shape=(total, 1)) + np.exp(-z))
for k in range(16281):
    if y_hat[k] >= 0.5:
        print('%s,%d' % (k + 1, 1))
    else:
        print('%s,%d' % (k + 1, 0))

import sys
import csv
import pandas as pd
import numpy as np

##Read in
trait_mean = [38.581646755320783 , 189778.36651208502 , 0 , 1077.6488437087312 , 87.303829734958995 , 40.437455852092995]
trait_var = [13.640223092304081 , 105548.3568808909 , 0 , 7385.1786769465862 , 402.95403082754581 , 12.347239075706955]
suggest_array = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105] 
suggest_array_square = [0 , 5]
suggest_array_cubed = [0]

n_trait_1 = len(suggest_array)
n_trait_2 = len(suggest_array_square)
n_trait_3 = len(suggest_array_cubed)
#n_trait = n_trait_1 + n_trait_2
n_trait = n_trait_1 + n_trait_2 + n_trait_3

total = 16281
XTest = [[0 for x in range(total)] for y in range(n_trait)]
np.set_printoptions(threshold=np.inf)

with open(sys.argv[1]) as TrainingData:
        XTest_raw = csv.reader(TrainingData)
        C = -1
        for row in XTest_raw:
                if (C != -1):
                        for i in range(n_trait_1):
                                R = suggest_array[i]
                                if (R == 0) or (R == 1) or (R == 3) or (R == 4) or (R == 5):
                                        XTest[i][C] = (float(row[R]) - trait_mean[R])/trait_var[R] 
                                else:
                                        XTest[i][C] = float(row[R])

                        for i in range(n_trait_2):
                                R = suggest_array_square[i]
                                val = (float(row[R]) - trait_mean[R])/trait_var[R] 
                                XTest[n_trait_1+i][C] = val*val 
                        
                        for i in range(n_trait_3):
                                R = suggest_array_cubed[i]
                                val = (float(row[R]) - trait_mean[R])/trait_var[R] 
                                XTest[n_trait_1+n_trait_2+i][C] = val*val*val
                                                  
                C = C + 1

XTest = np.matrix(XTest)
#print("XTest.shape = ",XTest.shape)

X = XTest
b = -2.879322873432308
w = np.matrix([[  0.75708139],
        [  0.08406662],
        [  0.87272753],
        [  2.38185781],
        [  0.25473149],
        [  0.41373285],
        [  0.82420475],
        [  0.15958174],
        [ -1.71803162],
        [  0.41502287],
        [  0.62055446],
        [ -0.02367942],
        [  0.05386114],
        [ -4.24191827],
        [  1.03108149],
        [ -0.251246  ],
        [ -0.17541664],
        [  0.11345084],
        [ -0.77900473],
        [ -0.55342855],
        [ -0.70097971],
        [ -0.44726516],
        [  0.95612169],
        [  0.97200433],
        [  1.59601375],
        [  2.77529233],
        [  0.47921339],
        [  1.90848759],
        [-12.12287222],
        [  2.51645202],
        [  0.83385413],
        [ -1.26584052],
        [  1.99640957],
        [  1.11257453],
        [ -1.20629584],
        [ -1.44242201],
        [ -1.36424315],
        [ -0.70950546],
        [  0.2031504 ],
        [ -0.88057841],
        [  0.20155831],
        [  0.96946678],
        [ -0.68368208],
        [ -0.46103625],
        [ -0.1426921 ],
        [ -0.5855118 ],
        [ -3.85412847],
        [  0.70351261],
        [  0.88914126],
        [  0.50715288],
        [  0.85236719],
        [  0.08890693],
        [ -0.68695014],
        [ -0.82382421],
        [ -0.16272702],
        [ -0.99124575],
        [ -1.14547931],
        [ -0.36656411],
        [  0.61051753],
        [ -0.95342199],
        [ -0.27954453],
        [ -0.57557364],
        [ -0.73160729],
        [ -0.33917542],
        [  1.47725283],
        [  0.56825991],
        [ -0.54384385],
        [ -1.74880648],
        [  0.49104043],
        [ -1.69272739],
        [  0.11392572],
        [ -0.49639021],
        [  0.72026226],
        [  0.74446287],
        [  0.68700432],
        [ -0.6797157 ],
        [  0.15552584],
        [  0.0997255 ],
        [ -0.77858183],
        [ -1.21140221],
        [  0.29602927],
        [  0.37722458],
        [ -0.11332444],
        [  0.2899976 ],
        [  1.05080217],
        [  1.01778777],
        [  0.29802757],
        [  0.62451553],
        [ -0.12516954],
        [ -0.30002952],
        [ -0.63109399],
        [ -3.89432624],
        [ -0.45380159],
        [  0.70151952],
        [  0.40505259],
        [  0.13943356],
        [ -0.16939767],
        [  0.16238131],
        [ -0.64449079],
        [  0.38637322],
        [ -0.10390433],
        [ -0.46549759],
        [  0.46134224],
        [ -0.84103174],
        [  0.7074041 ],
        [  0.03886153],
        [ -0.5985399 ],
        [ -0.06736554],
        [  0.10098938]])


print("id,label")
z = (np.dot(X.T,w)+b*np.ones(shape=(total,1)))
y_hat = np.ones(shape=(total,1))/(np.ones(shape=(total,1))+np.exp(-z))

for k in range(16281):
        if y_hat[k] >= 0.5:
              print("%s,%d"%(k+1,1))
        else:  
              print("%s,%d"%(k+1,0))
