def get_authors(self): ''' Returns the authors of the documents that appear in this cluster. ''' ws = WarehouseServer() authors = set(ws.get_document_authors(self.document_dict.keys())) return list(authors)
def output_clusters_to_file(clusters, rownames, filename): ''' DEPRECATED This method takes as input a set of clusters and generates a very simplistic representation of these clusters in text form in a file. ''' ws = WarehouseServer() out = file(filename, 'w') out.write("Clustering results") out.write('\n') i = 0 for cluster in clusters: out.write('\n') out.write( '***********************************************************') out.write('\n') out.write("Cluster" + str(i)) out.write('\n') for document in cluster: out.write(ws.get_document_by_id(rownames[document]).content) out.write('\n') i += 1
''' Created on 26 Jan 2012 @author: george ''' import unittest, datetime from analysis.clustering.dbscan import DBSCANClusterer from database.warehouse import WarehouseServer from collections import OrderedDict ########################################### # GLOBALS # ########################################### ws = WarehouseServer() epsilon = 2.0 min_pts = 2.0 points = [] points.append([1,1]) points.append([1.5,1]) points.append([1.8,1.5]) points.append([2.1,1]) points.append([3.1,2]) points.append([4.1,2]) points.append([5.1,2]) points.append([10,10]) points.append([11,10.5]) points.append([9.5,11]) points.append([9.9,11.4]) points.append([15.0, 17.0]) points.append([15.0, 17.0]) points.append([7.5, -5.0])