def fit(self, X, y=None):
# the bell methods require additional information
if self.method in ["bell", "belllog"]:
# precompute node count by level
self.levels = defaultdict(int)
for node in self.hierarchy.nodes():
l = nx.shortest_path_length(self.hierarchy, self.root, node)
self.levels[l] += 1
print(self.levels)
return self
评论列表
文章目录