changeset 309:80cbafd69109

Added spectral clustering function
author Mohamed Gomaa
date Tue, 25 Dec 2012 02:24:21 -0500
parents 8bafd054cda4
children 6c068047edbf
files python/ml.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/python/ml.py	Tue Dec 25 02:20:25 2012 -0500
+++ b/python/ml.py	Tue Dec 25 02:24:21 2012 -0500
@@ -58,6 +58,7 @@
 
     return centroids
 
+
 def spectralClustering(similarityMatrix,k):	
 	''' Steps of Spectral Clustering'''
 	n= len(similarityMatrix)
@@ -76,5 +77,4 @@
 	features = whiten(features)
 	centroids,distortion = kmeans(features,k,iter=20) # default iter = 20
 	code,distance = vq(features,centroids) # code starting from 0 (represent first cluster) to k-1 (last cluster)
-	return code,sigma
-	
+	return code,sigma