| Conditions | 2 | 
| Total Lines | 17 | 
| Code Lines | 14 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | # from .clustering import ReportingClustering | ||
| 14 | # def from_som(self, dataset, som, nb_clusters, **kwargs): # algorithm, nb_clusters=8, ngrams=1, random_state=None, vars=None): | ||
| 15 | # id2members = dict.fromkeys(range(nb_clusters), set()) # cluster id => members set mapping | ||
| 16 | #         som.cluster(nb_clusters, random_state=kwargs.get('random_state', None)) | ||
| 17 | #         # som.cluster(algorithm=self.algorithms[algorithm](nb_clusters, kwargs.get('random_state', None))) | ||
| 18 | # for i, arr in enumerate(som.bmus): # iterate through the array of shape [nb_datapoints, 2]. Each row is the coordinates | ||
| 19 | # # of the neuron the datapoint gets attributed to (closest distance) | ||
| 20 | # attributed_cluster = som.clusters[arr[0], arr[1]] # >= 0 | ||
| 21 | # id2members[attributed_cluster].add(dataset.datapoints[i]) | ||
| 22 | # def ex1(a_cluster): | ||
| 23 | # return [_ for _ in a_cluster] | ||
| 24 | # def ex2(datapoints, attribute): | ||
| 25 | # return datapoints[str(attribute)] | ||
| 26 | |||
| 27 | # return ReportingClustering([SOMCluster(cluster_members) for cluster_members in id2members.values()], | ||
| 28 | # str(dataset)+'-'+str(som), | ||
| 29 | # ex1, | ||
| 30 | # ex2, | ||
| 31 | # ) | ||
| 32 |