INNER CODE UNIT · Python

BaseFitter

CamDavidsonPilon/lifetimes · lifetimes/fitters/__init__.py:15

class BaseFitter(object):
    """Base class for fitters."""

    def __repr__(self):
        """Representation of fitter."""
        classname = self.__class__.__name__
        try:
            subj_str = " fitted with {:d} subjects,".format(self.data.shape[0])
        except AttributeError:
            subj_str = ""

        try:
            param_str = ", ".join("{}: {:.2f}".format(par, val) for par, val in sorted(self.params_.items()))
            return "<lifetimes.{classname}:{subj_str} {param_str}>".format(
                classname=classname, subj_str=subj_str, param_str=param_str
            )
        except AttributeError:
            return "<lifetimes.{classname}>".format(classname=classname)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…