We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 188e540 commit 70971e0Copy full SHA for 70971e0
src/utils/crystal_metric.py
@@ -123,10 +123,11 @@ def family_tree_metric(reps, aux_info):
123
dot_products = (gen_representations[2:] - gen_representations[0]) @ pivot
124
norms = np.linalg.norm((gen_representations[2:] - gen_representations[0]), axis=1) * np.linalg.norm(pivot)
125
126
+ norms = np.where(norms == 0, np.nan, norms)
127
collinearity = np.abs(dot_products / norms) # Cosine similarity with the pivot
128
+ collinearity = np.nan_to_num(collinearity, nan=1.0)
129
collinearity_by_generation[generation] = collinearity.mean()
- print(collinearity.mean())
-
130
+
131
132
pca = PCA(n_components=min(reps.shape[0], reps.shape[1]))
133
emb_pca = pca.fit_transform(reps)
0 commit comments