Пример #1
0
    def test_save_load(self, data):
        file_name = "tmp_sklearn.model"

        model_before = VW(l=100)
        model_before.fit(data.x, data.y)
        before_saving = model_before.predict(data.x)
        model_before.save(file_name)

        model_after = VW(l=100)
        model_after.load(file_name)
        after_loading = model_after.predict(data.x)

        assert np.allclose(before_saving, after_loading)
Пример #2
0
    def test_save_load(self, data):
        f = NamedTemporaryFile()

        model_before = VW(l=100)
        model_before.fit(data.x, data.y)
        before_saving = model_before.predict(data.x)
        model_before.save(f.name)

        model_after = VW(l=100)
        model_after.load(f.name)
        after_loading = model_after.predict(data.x)

        assert np.allclose(before_saving, after_loading)
        f.close()