예제 #1
0
def test_warm_start_without_history():
    history = {
        'bins': [{
            'mean': 1,
            'count': 1
        }, {
            'mean': 2,
            'count': 1
        }, {
            'mean': 3,
            'count': 1
        }],
        'info': {
            'missing_count': 0,
            'maxbins': 4,
            'weighted': False,
            'freeze': None
        }
    }

    h = StreamHist.from_dict(history)
    assert h.min() == 1
    assert h.max() == 3
    assert h.mean() == 2.0
    assert h.stdDev() == 0.816496580927726
    assert h.total == 3
    assert h.missing_count == 0
예제 #2
0
def test_warm_start_with_history():
    normal_data = np.random.normal(0, 10, 10)
    h1 = StreamHist(maxbins=8)
    h1.update(normal_data)
    d = h1.to_dict()
    h2 = StreamHist.from_dict(d)
    assert str(h2) == str(h1)
예제 #3
0
def test_round_trip():
    # Tests to_dict and from_dict
    h = StreamHist().update([1, 1, 4])
    assert h.to_dict() == h.from_dict(h.to_dict()).to_dict()
예제 #4
0
def test_round_trip():
    # Tests to_dict and from_dict
    h = StreamHist().update([1, 1, 4])
    assert h.to_dict() == h.from_dict(h.to_dict()).to_dict()