INNER CODE UNIT · Python

__repr__

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

    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)

    def _unload_params(self, *args):
        if not hasattr(self, "params_"):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…