Skip to content

Commit f1d5fe9

Browse files
Another try at fixing this
1 parent 583a641 commit f1d5fe9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

datasail/solver/overflow.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def check_dataset(
5252

5353

5454
def check_points(dataset, split_ratios, split_names, i: int):
55-
sorted_points = sorted(dataset.weights.items(), key=lambda x: x[1], reverse=True)
55+
sorted_points = sorted([dataset.weights[name] for name in dataset.names], key=lambda x: x[1], reverse=True)
5656
total_weight = sum(x[1] for x in sorted_points[i:])
5757
if [x[1] / total_weight for x in sorted_points[i:len(split_ratios)]] <= sorted(split_ratios, reverse=True):
5858
return None
@@ -64,7 +64,7 @@ def check_points(dataset, split_ratios, split_names, i: int):
6464

6565

6666
def check_clusters(dataset, split_ratios, split_names, strategy: Literal["break", "assign"], linkage: Literal["average", "single", "complete"], i: int):
67-
sorted_clusters = sorted(dataset.cluster_weights.items(), key=lambda x: x[1], reverse=True)
67+
sorted_clusters = sorted([dataset.cluster_weights[name] for name in dataset.cluster_names], key=lambda x: x[1], reverse=True)
6868
total_weight = sum(x[1] for x in sorted_clusters[i:])
6969
if [x[1] / total_weight for x in sorted_clusters[i:len(split_ratios)]] <= sorted(split_ratios, reverse=True):
7070
return None

0 commit comments

Comments
 (0)