Skip to content

Commit

Permalink
drop nans and only use a subset of 30000 points for AC ranges calc
Browse files Browse the repository at this point in the history
  • Loading branch information
dluks committed Sep 10, 2023
1 parent c661c8c commit a889026
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion spacv/visualisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,17 @@ def variogram_at_lag(
XYs = geometry_to_2d(XYs)
x = np.asarray(x)

# Remove nans from x and XYs for variogram calculation
nan_idx = np.isnan(x)
x = x[~nan_idx]
XYs = XYs[~nan_idx]

# Select only 30000 random points from x and XYs to calculate pairwise distances
if len(x) > 30000:
idx = np.random.choice(len(x), 30000, replace=False)
x = x[idx]
XYs = XYs[idx]

if distance_metric == "euclidean":
paired_distances = pdist(XYs)
pd_m = squareform(paired_distances)
Expand Down Expand Up @@ -318,7 +329,7 @@ def aoa(
folds = np.vstack((fold_indices, instance_fold_id)).T

# Mask training points in same fold for DI measure calculation
for i, row in enumerate(train_dist):
for i, _ in enumerate(train_dist):
mask = folds[:, 0] == folds[:, 0][i]
train_dist[i, mask] = np.nan

Expand Down

0 comments on commit a889026

Please sign in to comment.