Skip to content

Commit

Permalink
Address AlxdrPolyakov's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
EgorKraevTransferwise committed Nov 28, 2023
1 parent 51ddd47 commit 445509b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions wise_pizza/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def guided_kmeans(X: np.ndarray, power_transform: bool = True) -> np.ndarray:

best_score = -1
best_labels = None
best_n = -1
# If we allow 2 clusters, it almost always just splits positive vs negative - boring!
for n_clusters in range(3, int(len(X) / 2) + 1):
cluster_labels = KMeans(n_clusters=n_clusters, init="k-means++", n_init=10).fit_predict(X)
Expand Down
6 changes: 4 additions & 2 deletions wise_pizza/explain.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def explain_changes_in_average(
how: str = "totals",
force_add_up: bool = False,
constrain_signs: bool = True,
cluster_values: bool = False,
verbose: int = 0,
):
"""
Expand Down Expand Up @@ -85,6 +86,7 @@ def explain_changes_in_average(
how=how,
force_add_up=force_add_up,
constrain_signs=constrain_signs,
cluster_values=cluster_values,
verbose=verbose,
)

Expand Down Expand Up @@ -118,7 +120,7 @@ def explain_changes_in_totals(
how: str = "totals",
force_add_up: bool = False,
constrain_signs: bool = True,
cluster_values: bool=True,
cluster_values: bool=False,
verbose: int = 0,
):
"""
Expand Down Expand Up @@ -256,7 +258,7 @@ def explain_levels(
verbose=0,
force_add_up: bool = False,
constrain_signs: bool = True,
cluster_values: bool=True
cluster_values: bool=False
):
"""
Find segments whose average is most different from the global one
Expand Down

0 comments on commit 445509b

Please sign in to comment.