I am making an abstract base class, the public methods for which require child classes to implement the abstract methods with certain parameters. How can I write the abstract method function definition, beyond just writing a comment, to indicate that child classes should have certain parameters in the abstract method itself?
My reason for writing such an abstract method is because the public method calls scipy.optimize.curve_fit, which takes a callable as an argument and that callable itself must have certain parameters in its definition.
Here is some pseudocode for clarification:
from abc import ABC, abstractmethod
from scipy.optimize import curve_fit
class DiseaseModel(ABC):
def fit(self, t, ydata):
return curve_fit(self._fit, t, ydata)
@abstractmethod
def _fit(self, t, modelParam1, modelParam2, ..., modelParamN):
"""Method fits parameters of a model to data.
This method MUST have `t` (which is just timesteps over which a
certain ydata occurred) AND any other parameters relevant for the
model of the system. Should I maybe just use `*args` or `**kwargs`
in the function definition?
For example, if a child class is for a simple
SIR epidemic model, then the function definition should be
`def _fit(self, t, beta, gamma)`.
Likewise, for a child class
defining a demographic SIR model, the function definition should be
`def _fit(self, t, beta, gamma, mu)`.
"""
pass