I am getting an error when optimizing the binding model parameter for a system consisting of two components, a salt and a protein (designated as object A). Increasing the number of components seems to be the cause of the error, as it worked fine when there was only one component. Can anyone tell me why I am getting the error below and what I am doing wrong? I’m using CADET-process.
Error:
TypeError Traceback (most recent call last)
Cell In[31], line 2
1 if name == ‘main’:
----> 2 optimization_results = optimizer.optimize(
3 optimization_problem,
4 use_checkpoint=False
5 )
Due to data security issue, I used a dataset which I made up myself and still, the same error occurs.
Can you please tell me what could be causing the error?
The TypeError: Expected <class ‘list’> comes from giving the optimization_problem a variable in a multicomponent system without specifying the component. Therefore the optimization_problem will try to set the variable (e.g. ka) for all components and therefore expect a “list” input but gets a float input. To fix: add component_index=1 to your add_variable call. (That is, assuming you want to modify the parameters of your Protein “A” which has index 1 and not the parameters of the salt component, which has index 0).
Three other things:
The MRE you supplied didn’t work for J.schmoelder and me, because the dataframe contained NaN’s, which caused problems for CADET Process. In the attached modified .ipynb. I’ve added a change to remove the NaN’s.
You added the salt concentration to the reference and the comparator. Was that done on purpose? Do you want to use differences in the salt concentration curve to fit the parameters of the protein? I assumed not and fixed that with changes 2&3 in the .ipynb by adding components = [“A”] to the add_difference_metric() call.
If you want to use parallelization to speed up the optimization, you can use this code:
optimizer = U_NSGA3()
optimizer.n_cores = 4
to use e.g. 4 cores (or more, depending on your system). If that causes a crash, you can update CADET-Process to an unreleased version with a mulitprocessing-fix using this command:
Hi Ronald.
The ipynb file you revised works perfectly and is just what I was looking for. I’ve also confirmed that the unreleased version of the CADET Process is functioning really well.
Thanks a lot for your help. Best of luck with your work!