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

Sci-kit Learn Invalid Parameter(prevents Hessian and ENM models from being produced) #93

Open
JoseBernardS opened this issue Feb 21, 2024 · 1 comment
Assignees

Comments

@JoseBernardS
Copy link

Issue description

While running the run_py_capsid_report function from pyCapsid package, an invalid parameter error related to the radius_neighbours_graph function of the scikit-learn package is thrown, as follows:

Error message:
Fetching file 1 / 1 (4oq8)...
Done
Number of protein chains in full structure: 60
Number of protein chains in asymmetric unit: 1
# of residues: 8640
Building hessian for model preset:  U-ENM
Model parameters:  {'cutoff': 7.5, 'gnm': False, 'fanm': 0.1, 'wfunc': 'power', 'base_dist': 1, 'd_power': 0, 'backbone': False, 'k_backbone': 1, 'l_backbone': 1, 'chain_starts': None, 'save_hessian': True, 'save_kirchhoff': False, 'save_cg_path': './4oq8/'}
Finding neighbors within 7.5Å
Traceback (most recent call last):
 File "<string>", line 1, in <module>
 File "/Users/selasisedalo/anaconda3/envs/pycapsid/lib/python3.10/site-packages/pyCapsid/__init__.py", line 149, in run_capsid_report
   kirch, hessian = buildENMPreset(coords, **params_dict['CG'])
 File "/Users/selasisedalo/anaconda3/envs/pycapsid/lib/python3.10/site-packages/pyCapsid/CG.py", line 31, in buildENMPreset
   return buildENM(coords, cutoff=cutoff, fanm=fanm, **kwargs)
 File "/Users/selasisedalo/anaconda3/envs/pycapsid/lib/python3.10/site-packages/pyCapsid/CG.py", line 80, in buildENM
   distGraph = radius_neighbors_graph(tree, cutoff, mode='distance', n_jobs=-1)
 File "/Users/selasisedalo/anaconda3/envs/pycapsid/lib/python3.10/site-packages/sklearn/utils/_param_validation.py", line 203, in wrapper
   validate_parameter_constraints(
 File "/Users/selasisedalo/anaconda3/envs/pycapsid/lib/python3.10/site-packages/sklearn/utils/_param_validation.py", line 95, in validate_parameter_constraints
   raise InvalidParameterError(
sklearn.utils._param_validation.InvalidParameterError: The 'X' parameter of radius_neighbors_graph must be an array-like or an instance of 'sklearn.neighbors._base.RadiusNeighborsMixin'. Got <sklearn.neighbors._ball_tree.BallTree object at 0x11ac41210> instead.

Steps to reproduce the error (prior commands)

Installation process

conda create -n pycapsid -y
conda activate pycapsid
conda install -c luque_lab -c conda-forge pycapsid

Installation proceeded without errors

config file content

[PDB]
pdb = '4oq8' # PDB ID of structure
save_all_path = './4oq8' # where to save the results
[CG]
preset = 'U-ENM' # Model Preset To Use
save_hessian = true # Whether to save the hessian matrix
[NMA]
n_modes = 200 # Number of low frequency modes to calculate
eigen_method = 'eigsh' # eigen method to use
[b_factors]
fit_modes = true # Whether to select the number of modes used to maximize correlation
[QRC]
[VIS]
method = 'chimerax'
chimerax_path = 'C:\Program Files\ChimeraX\bin\ChimeraX.exe'

pyCapsid execution

python -c “from pyCapsid import run_capsid_report;run_capsid_report(‘config.toml’)”

Software versions

Software Version
Python 3.10.0
Conda 24.1.0
Scikit-learn 1.4.1
MacOs 13.0.1
@colintravisbrown
Copy link
Collaborator

Looks like there is a difference in versions of sci-kit-learn. See the difference in parameter options in the function between these two versions:
https://scikit-learn.org/1.3/modules/generated/sklearn.neighbors.radius_neighbors_graph.html#sklearn.neighbors.radius_neighbors_graph
https://scikit-learn.org/stable/modules/generated/sklearn.neighbors.radius_neighbors_graph.html#sklearn.neighbors.radius_neighbors_graph

I suggest either locking the scikit-learn version to <1.4 or refactoring how the neighbor graph is computed to use scikit-learns API in a way that isn't version dependent.

@abelardoacm abelardoacm self-assigned this Feb 26, 2024
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

No branches or pull requests

3 participants