'''Base class for clustering method configuration objects.'''
raise NotImplementedError('should be implemented in subclass')
def _cli_setup(cls, parser):
Float.T: float, Int.T: int}
parser, cls.name, 'Options specific for the "%s" clustering method' % cls.name)
'--%s' % u2d(prop.name), dest=prop.name, type=pmap[prop.__class__], default=prop.default(), help=prop.help + ' (default: %default)')
def cli_setup(name, setup):
else: return setup
def _cli_instantiate(cls, options): Float.T: float, Int.T: int}
def cli_instantiate(name, options):
'''DBSCAN clustering algorithm.'''
default=10, help='Minimum number of neighbours to define a cluster.')
default=0.1, help='Maximum distance to search for neighbors.')
default=None, help='Limit maximum number of clusters created to N.')
similarity_matrix, nmin=self.nmin, eps=self.eps, ncluster_limit=self.ncluster_limit)
try: config = guts.load(filename=path) except OSError: raise GrondError( 'cannot read Grond clustering configuration file: %s' % path)
if not isinstance(config, Clustering): raise GrondError( 'invalid Grond clustering configuration in file "%s"' % path)
return config
try: guts.dump( config, filename=path, header='Grond clustering configuration file, version %s' % __version__)
except OSError: raise GrondError( 'cannot write Grond report configuration file: %s' % path)
'Clustering', 'DBScan', ] |