How to use the lifetimes.estimation.BaseFitter function in Lifetimes

To help you get started, we’ve selected a few Lifetimes examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CamDavidsonPilon / lifetimes / tests / test_estimation.py View on Github external
def test_repr(self):
        base_fitter = estimation.BaseFitter()
        assert repr(base_fitter) == ''
        base_fitter.params_ = dict(x=12.3, y=42)
        base_fitter.data = np.array([1, 2, 3])
        assert repr(base_fitter) == ''
        base_fitter.data = None
        assert repr(base_fitter) == ''
github CamDavidsonPilon / lifetimes / tests / test_estimation.py View on Github external
def test_save_load_model(self):
        base_fitter = estimation.BaseFitter()
        base_fitter.save_model(PATH_SAVE_MODEL)
        assert os.path.exists(PATH_SAVE_MODEL) == True

        base_fitter_saved = estimation.BaseFitter()
        base_fitter_saved.load_model(PATH_SAVE_MODEL)

        assert repr(base_fitter) == repr(base_fitter_saved)
        os.remove(PATH_SAVE_MODEL)
github CamDavidsonPilon / lifetimes / tests / test_estimation.py View on Github external
def test_save_load_model(self):
        base_fitter = estimation.BaseFitter()
        base_fitter.save_model(PATH_SAVE_MODEL)
        assert os.path.exists(PATH_SAVE_MODEL) == True

        base_fitter_saved = estimation.BaseFitter()
        base_fitter_saved.load_model(PATH_SAVE_MODEL)

        assert repr(base_fitter) == repr(base_fitter_saved)
        os.remove(PATH_SAVE_MODEL)
github CamDavidsonPilon / lifetimes / tests / test_estimation.py View on Github external
def test_unload_params(self):
        base_fitter = estimation.BaseFitter()
        with pytest.raises(ValueError):
            base_fitter._unload_params()
        base_fitter.params_ = dict(x=12.3, y=42)
        npt.assert_array_almost_equal([12.3, 42], base_fitter._unload_params('x', 'y'))