Inherit from StanFit in pystan


I’d like to create a new python class that inherits from StanFit. Is there a way to do this with pystan?

I succeeded with the MATLAB interface by directly modifying StanFit.m, but can’t find the corresponding code in pystan.


Operating System: Mac OS X 10.10.5
Python Version: 3.5.2
Interface Version:


PyStan fit-object is found in stan4fitmodel.pyx (Cython class) and shows how it can be initialized.


It’s worth mentioning that there is no StanFit per se. Each StanFit is
specialized to a specific Stan model. stanfit4model.pyx is actually a
template, not a proper Cython file.

This is all somewhat confusing. But this mirrors, more or less, how
CmdStan works.


Thank you both. I found what I was looking for and I’ve decided to swerve the idea of inheriting. I’ll define my own class for my particular application.