comparison Marea/marea_cluster.py @ 7:771a40335876 draft

enchanted .py
author bimib
date Thu, 15 Nov 2018 06:12:15 -0500
parents 5721182715a7
children 7c76e8e319c2
comparison
equal deleted inserted replaced
6:5721182715a7 7:771a40335876
552 max_iter = 300, 552 max_iter = 300,
553 random_state = 0).fit(cluster_data) 553 random_state = 0).fit(cluster_data)
554 distorsion.append(tmp_kmeans.inertia_) 554 distorsion.append(tmp_kmeans.inertia_)
555 predict = tmp_kmeans.predict(cluster_data) 555 predict = tmp_kmeans.predict(cluster_data)
556 predict = [x+1 for x in predict] 556 predict = [x+1 for x in predict]
557 classe = (pd.DataFrame(zip(cluster_data.index, predict))).astype(str) 557 classe = (pd.DataFrame(list(zip(cluster_data.index, predict)))).astype(str)
558 dest = 'cluster_out/K=' + str(i) + '_' + args.name+'.tsv' 558 dest = 'cluster_out/K=' + str(i) + '_' + args.name+'.tsv'
559 classe.to_csv(dest, sep = '\t', index = False, 559 classe.to_csv(dest, sep = '\t', index = False,
560 header = ['Patient_ID', 'Class']) 560 header = ['Patient_ID', 'Class'])
561 plt.figure(0) 561 plt.figure(0)
562 plt.plot(range(args.k_min, args.k_max+1), distorsion, marker = 'o') 562 plt.plot(range(args.k_min, args.k_max+1), distorsion, marker = 'o')