changeset 37:2495c7772ca8 draft

Uploaded
author bimib
date Mon, 25 Nov 2019 11:57:57 -0500
parents 94c51690d40c
children 4e1b466935cd
files Marea/marea_cluster.py Marea/marea_cluster.xml
diffstat 2 files changed, 5 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/Marea/marea_cluster.py	Mon Nov 25 06:46:04 2019 -0500
+++ b/Marea/marea_cluster.py	Mon Nov 25 11:57:57 2019 -0500
@@ -34,7 +34,7 @@
     
     parser.add_argument('-cy', '--cluster_type',
                         type = str,
-                        choices = ['kmeans', 'meanshift', 'dbscan', 'hierarchy'],
+                        choices = ['kmeans', 'dbscan', 'hierarchy'],
                         default = 'kmeans',
                         help = 'choose clustering algorythm')
     
@@ -60,12 +60,6 @@
                         choices = ['true', 'false'],
                         help = 'choose if you want silhouette plots')
     
-    parser.add_argument('-db', '--davies', 
-                        type = str,
-                        default = 'false',
-                        choices = ['true', 'false'],
-                        help = 'choose if you want davies bouldin scores')
-    
     parser.add_argument('-td', '--tool_dir',
                         type = str,
                         required = True,
@@ -152,7 +146,7 @@
     
 ################################ kmeans #####################################
     
-def kmeans (k_min, k_max, dataset, elbow, silhouette, davies, best_cluster):
+def kmeans (k_min, k_max, dataset, elbow, silhouette, best_cluster):
     if not os.path.exists('clustering'):
         os.makedirs('clustering')
     
@@ -167,12 +161,6 @@
     else:
         silhouette = False
         
-    if davies == 'true':
-        davies = True
-    else:
-        davies = False
-        
-
     range_n_clusters = [i for i in range(k_min, k_max+1)]
     distortions = []
     scores = []
@@ -341,7 +329,7 @@
     
     plt.figure(figsize=(10, 7))  
     plt.title("Customer Dendograms")  
-    shc.dendrogram(shc.linkage(dataset, method='ward'))  
+    shc.dendrogram(shc.linkage(dataset, method='ward'), labels=dataset.index.values.tolist())  
     fig = plt.gcf()
     fig.savefig('clustering/dendogram.png', dpi=200)
     
@@ -397,7 +385,7 @@
     
     
     if args.cluster_type == 'kmeans':
-        kmeans(args.k_min, args.k_max, X, args.elbow, args.silhouette, args.davies, args.best_cluster)
+        kmeans(args.k_min, args.k_max, X, args.elbow, args.silhouette, args.best_cluster)
     
     if args.cluster_type == 'dbscan':
         dbscan(X, args.eps, args.min_samples, args.best_cluster)
--- a/Marea/marea_cluster.xml	Mon Nov 25 06:46:04 2019 -0500
+++ b/Marea/marea_cluster.xml	Mon Nov 25 11:57:57 2019 -0500
@@ -1,4 +1,4 @@
-<tool id="MaREA_cluester" name="Cluster Analysis" version="1.0.9">
+<tool id="MaREA_cluester" name="Cluster Analysis" version="1.1.0">
     <description></description>
     <macros>
         <import>marea_macros.xml</import>