partitions2 = np.transpose(partitions) ensemble2 = Ensemble(partitions=partitions2, n_cluster=3, partitions_format='PE') e2, ts2, pr2 = ensemble2.mcla(times=True, partial_results=True) for t in ts2: print(f'{t[0]}: {t[1]}s') for r in pr2: print(r[0]) print(r[1]) """ print('\n___PARTITIONS 3___') partitions3 = np.random.randint(8, size=(8, 100000)) ensemble3 = Ensemble(partitions=partitions3, n_cluster=8, partitions_format='PE') e3, ts3, _pr3 = ensemble3.mcla(times=True) for t in ts3: print(f'{t[0]}: {t[1]}s') """ hypergraph4 = np.array([ [1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 1, 1], [1, 1, 1, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0, 0], [1, 1, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 1, 1, 1], [1, 0, 0, 1, 0, 0, 0], [0, 1, 0, 0, 1, 0, 0]
import numpy as np import scipy.sparse import networkx as nx import time from ensemble import Ensemble start_t = time.time() partitions = np.random.randint(0, 4, size=(8, 5000000), dtype=np.int8) print(f"n={partitions.shape[1]} r={partitions.shape[0]}") print(f"Data generated in {round(time.time() - start_t, 2)} sec") start_t = time.time() ensemble = Ensemble(partitions=partitions, n_cluster=4, partitions_format='PE') labels, _, _ = ensemble.mcla(dtype=np.int8) print(f"Consensus computed in {round(time.time() - start_t, 2)} sec") print(f"Labels: {np.lib.arraysetops.unique(labels)}")