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

"bestIndex > maxIndex. Returning None." error message should include more detail #30

Open
penguinaugustus opened this issue Jun 15, 2023 · 3 comments

Comments

@penguinaugustus
Copy link

penguinaugustus commented Jun 15, 2023

Hi,Professor Daniels,

It seems that i bump into some unknown mistake after i run the model and tried to display the result with p.plotBestModelResults(plotInitialConditions=True,indices=range(10));

I didn't get any plot back. Instead, it returned with

maxLogLikelihoodName: Warning: Only 9 of 9 fits have been performed.
maxLogLikelihoodName: bestIndex > maxIndex.  Returning None.
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-14-204fc9c0e868> in <module>
      1 plt.figure(figsize=(20,2))
----> 2 a = p.plotBestModelResults(plotInitialConditions=True,indices=range(10));
      3 
      4 for i in range(len(a[0])):
      5     a[0][i].plot(RNAtheoreticalData[0], RNAtheoreticalData[1+i],linewidth=1)

~/SirIsaac/SirIsaac/fittingProblem.py in plotBestModelResults(self, modelName, maxIndex, verbose, **kwargs)
    750         m = self.getBestModel(modelName=modelName,maxIndex=maxIndex,
    751             verbose=verbose)
--> 752         return self.plotModelResults(m,**kwargs)
    753 
    754 

~/SirIsaac/SirIsaac/fittingProblem.py in plotModelResults(self, model, filename, indices, plotFittingData, outOfSampleData, **kwargs)
    711 
    712         # plot model results
--> 713         plots = m.plotResults(fittingData,indepParamsList,
    714             plotFittingData=plotFittingData,
    715             outOfSampleData=outData,**kwargs)

AttributeError: 'NoneType' object has no attribute 'plotResults'

<Figure size 1440x144 with 0 Axes>

It seems that i run

p.fitAll()
fittingProblem.save(p,'mRNAconcentrationS2.pkl')

successfully.

Could you give me any hint on what may go wrong and how to fix it?

Thank you for your time!

Sincerely,
Yu

A detailed code and error file is attached here:
mRNA-sigmoidal.pdf

@bcdaniels
Copy link
Contributor

Sorry that this error message is not very clear. By default, SirIsaac does not return a "best" model until it has found 3 models with more parameters that have a lower Bayesian likelihood than the model with the maximum likelihood. The maxIndex argument controls this behavior (as you can read about in the documentation for the function maxLogLikelihoodName).

One way around this is to call plotBestModelResults with the keyword argument maxIndex=-1, which will plot the model with the maximum likelihood, without the check. Another way is to give it the keyword argument modelName with the name of the model you want to plot (e.g. modelName='Model 7'). The "best" thing to do is to increase the number of models to be fit until you find the peak in the Bayesian likelihood using the default maxIndex.

Hope that helps. Let me know if you have other questions.

@bcdaniels bcdaniels changed the title bestIndex > maxIndex. Returning None. "bestIndex > maxIndex. Returning None." error message should include more detail Jun 15, 2023
@penguinaugustus
Copy link
Author

That make sense to me. Thanks a lot!

@bcdaniels
Copy link
Contributor

Keeping this as a "to do" bookmark to update the error message.

@bcdaniels bcdaniels reopened this Jun 30, 2023
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

2 participants