Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
classification test results
  • Loading branch information
nim18004 committed Apr 26, 2020
1 parent a565fa2 commit 1f9e56c
Show file tree
Hide file tree
Showing 3 changed files with 230 additions and 7 deletions.
Binary file modified .DS_Store
Binary file not shown.
21 changes: 14 additions & 7 deletions bcw.py
Expand Up @@ -21,17 +21,23 @@ df=df.replace('?',3.54465593)

# Separating out the features
x = df.loc[:, features].values# Separating out the target
y = df.loc[:,['class']].values# Standardizing the features
y = df.loc[:,['samplecodenumber','class']].values# Standardizing the features
x = StandardScaler().fit_transform(x)

#print(y)

def classify(hlsize):
X_train, X_test, y_train, y_test = train_test_split(x, y, test_size=0.3, random_state=2)
X_train, X_test, y_trainid, y_testid = train_test_split(x, y, test_size=0.3, random_state=1)
y_test=y_testid[:,1]
y_train=y_trainid[:,1]
#print(y_test)

clf = MLPClassifier(solver='lbfgs', alpha=1e-5, hidden_layer_sizes=hlsize, random_state=1)
#print(y_test.shape)

clf.fit(X_train, y_train)
y_pred=clf.predict(X_test)
#print(y_pred)
file.write("samplecodenumber,trueclass,predclass \n")
for i in range(len(y_pred)):
file.write(str(y_testid[i,0])+","+str(y_testid[i,1])+','+str(y_pred[i])+'\n')
tpr=0#positive=benign=2
fpr=0
tnr=0
Expand Down Expand Up @@ -73,8 +79,9 @@ def classify(hlsize):
file.write("precision="+str(precision)+'\n')
file.write("accuracy="+str(acc)+'\n')

#
# file = open('3layers.txt','w')
file = open('res.txt','w')
classify((13,8,18))
#
# for a in range(20):
# if a>0:
# for b in range(20):
Expand Down
216 changes: 216 additions & 0 deletions classificationresults.txt
@@ -0,0 +1,216 @@
samplecodenumber,trueclass,predclass
1217717,2,2
1239967,2,2
353098,2,2
832567,4,2
1180831,2,2
1253917,2,2
1173509,4,4
807657,2,2
534555,2,2
1238464,2,2
324427,4,4
691628,4,2
636437,2,2
1057013,4,4
736150,4,4
1299161,4,4
1174057,2,2
1196263,2,2
1197080,2,2
1236837,2,2
654546,2,2
1116998,4,4
888820,4,4
841769,2,2
1168736,4,4
493452,2,2
1211265,4,4
242970,2,4
1261751,2,2
1105524,2,2
1033078,2,2
1113906,4,2
1344121,4,4
263538,4,4
1112209,4,4
877943,4,4
1321321,2,2
1216694,4,4
1253505,2,2
1050718,2,2
690557,2,2
824249,2,2
1187457,2,2
1313658,2,2
798429,2,2
1200847,4,4
1171710,2,2
1257815,2,2
1043068,2,2
704097,2,2
1297522,2,2
1320077,2,2
1115282,4,4
1345593,2,2
1268952,4,4
428903,4,4
1238633,4,4
1277018,2,2
688033,2,2
1113038,4,4
1143978,2,2
1208301,2,2
1079304,2,2
684955,2,2
1287971,2,2
1267898,2,2
1121732,2,2
1099510,4,4
1048672,2,2
1320077,2,2
1073836,2,2
1257608,2,2
1000025,2,2
1200772,2,2
1167439,4,4
1126417,4,4
1002504,2,2
1257366,2,2
1117152,2,2
1204242,2,2
1318169,4,4
188336,4,4
1288608,2,2
1180194,4,4
1298360,2,2
411453,2,2
666942,2,2
1147699,4,4
1369821,4,4
1218860,2,2
1147748,4,4
888523,2,2
1043999,2,2
1156017,2,2
1321931,2,2
1299596,4,4
1206089,2,2
1157734,2,2
1183246,2,2
666090,2,2
1135090,2,2
1306339,2,2
1108370,4,4
1336798,2,2
1115293,2,2
1226612,4,4
1193544,4,4
1368273,2,2
1171845,4,4
764974,2,2
1119189,4,4
1114570,2,2
1347943,2,2
521441,2,2
1168278,2,2
1071084,2,2
1344449,2,2
654546,2,2
1132347,2,2
1299924,2,2
1203096,2,2
1227210,4,2
1258549,4,4
878358,4,4
1173514,2,2
1246562,4,4
888169,2,2
1120559,4,4
1311033,2,2
1070522,2,2
1075123,2,2
555977,4,4
1206841,4,4
763235,2,2
1315807,4,4
1258556,2,2
1173681,2,2
1143978,2,2
760239,4,4
659642,4,4
1057067,2,2
1170420,4,2
1049815,2,2
677910,2,2
897172,2,2
850831,4,4
1103722,2,2
1196295,4,4
827627,2,2
830690,2,2
1036172,2,2
1152331,2,2
1277629,2,2
1343068,4,4
1185610,2,2
1354840,2,2
792744,2,2
1227081,2,2
324382,2,2
452264,2,2
1174057,2,2
1106829,4,4
1071760,2,2
1224565,2,2
1232225,4,4
785208,4,4
1365075,2,2
431495,2,2
1260659,2,2
896404,2,2
1173347,2,2
1076352,4,4
527363,4,4
1164066,2,2
636375,2,2
653777,4,4
1238948,4,4
274137,4,4
145447,4,4
1116116,4,4
877291,4,4
734111,2,2
536708,2,2
1181356,2,2
1223543,2,2
1266154,4,4
636130,2,2
1083817,2,2
846832,2,2
1277792,2,2
1182404,2,2
1156272,2,2
1276091,2,2
1331412,4,4
1070935,2,2
1223793,4,4
1222047,4,4
1168736,4,4
601265,4,4
814911,2,2
167528,2,2
566509,2,2
787451,2,2
749653,2,2
1196915,4,4
608157,4,4
63375,4,2
695091,2,2
1168359,4,4
1334667,2,2
hlsize =(13, 8, 18)
true pos rate=0.9927007299270073
false pos rate=0.0821917808219178
precision=0.9577464788732394
accuracy=0.9666666666666667

0 comments on commit 1f9e56c

Please sign in to comment.