Skip to content

Error while using nearest_neigh_prop #145

@hasan-sayeed

Description

@hasan-sayeed

I'm trying to predict using trained model and facing the following error:

InvalidParameterError                     Traceback (most recent call last)
Cell In[16], line 13
     11 for i, val_df in enumerate(val_dfs):
     12     jd = jd + 1
---> 13     disc.predict(val_df, umap_random_state=42)
     14     dens_score.append(disc.dens_score_df.sample(frac=1))
     15     peak_score.append(disc.peak_score_df.sample(frac=1))

File c:\Users\hasan\miniconda3\envs\li_ml\lib\site-packages\mat_discover\mat_discover_.py:665, in Discover.predict(self, val_df, plotting, umap_random_state, pred_weight, proxy_weight, dummy_run, count_repeats, return_peak)
    663 # compound-wise scores (i.e. individual compounds)
    664 with self.Timer("nearest-neighbor-properties"):
--> 665     self.rad_neigh_avg_targ, self.k_neigh_avg_targ = nearest_neigh_props(
    666         self.dm, pred, n_neighbors=self.n_peak_neighbors
    667     )
    668     self.val_rad_neigh_avg = self.rad_neigh_avg_targ[val_ids]
    669     self.val_k_neigh_avg = self.k_neigh_avg_targ[val_ids]

File c:\Users\hasan\miniconda3\envs\li_ml\lib\site-packages\mat_discover\utils\nearest_neigh.py:48, in nearest_neigh_props(X, target, r_strength, radius, n_neighbors, metric, **NN_kwargs)
      6 def nearest_neigh_props(
      7     X,
      8     target,
   (...)
     13     **NN_kwargs,
     14 ):
...
     98     f"The {param_name!r} parameter of {caller_name} must be"
     99     f" {constraints_str}. Got {param_val!r} instead."
    100 )

InvalidParameterError: The 'radius' parameter of NearestNeighbors must be a float in the range [0, inf] or None. Got -0.28528690338134766 instead.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions