Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes for manuscript update. #1

Merged
merged 11 commits into from
Aug 15, 2024
Merged

Changes for manuscript update. #1

merged 11 commits into from
Aug 15, 2024

Conversation

JelmerBot
Copy link
Collaborator

This PR contains all changes made to the code during a major revision of the Arxiv paper and prepares for version 0.1.3.

Copy link
Collaborator Author

@JelmerBot JelmerBot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional comments:

cluster_tree[cluster_tree['child'] == parent]['parent'],
deaths
)
cpdef np.ndarray simplify_hierarchy(np.ndarray condensed_tree,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The persistence threshold for branches was incorrect. It was easier to write a hierarchy simplification function than to repair epsilon_search.

return labels, branch_labels


def branch_membership_from_centrality(branch_centrality_vectors):
def branch_membership_from_centrality(branch_centrality_vectors, temperature=1.0):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added temperature parameter to control softmax.

return result


class BranchCondensedTree(_BaseCondensedTree):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added own versions of the CondensedTree class that colour leaves by their labels.

Comment on lines +264 to +268
label_values = np.unique(clusterer.labels_[points])
noise_points = clusterer.labels_[points] == label_values[-1]
branch_labels[points[noise_points]] = np.argmax(membership[noise_points], axis=1)
labels[points[noise_points]] = label_values[branch_labels[points[noise_points]]] - offset
offset += int(len(label_values) > len(persistences))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only update labels for noise points.

Comment on lines +81 to +83

# Extract unique edges that stay within the cluster
edges = np.unique(edges[edges[:, 0] > -1.0, :], axis=0)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes mutual reachability values in the ApproximationGraph

return 1 / depths
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes membership centrality behave as in-cluster centrality.

@@ -85,7 +85,7 @@ def _compute_branch_linkage_of_cluster(
points = space_tree.data.base[cluster_points]
centroid = np.average(points, weights=cluster_probabilities, axis=0)
centralities = metric_fun.pairwise(centroid[None], points)[0, :]
centralities = centralities.max() - centralities
centralities = 1 / centralities
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplify algorithm by making in-cluster eccentricity be the distance to centroid.

@@ -1,6 +1,6 @@
[metadata]
name = pyflasc
version = 0.1.2
version = 0.1.3
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Version mentioned in the manuscript.

@JelmerBot JelmerBot merged commit 5bb5638 into main Aug 15, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant