Exemple #1
0
def test_get_all_sensors(data):
    x = data
    max_sensors = x.shape[1]

    model = SSPOR()
    model.fit(x)
    assert len(model.get_all_sensors()) == max_sensors
Exemple #2
0
def test_not_fitted(data_vandermonde):
    x = data_vandermonde
    model = SSPOR()

    # Should not be able to call any of these methods before fitting
    with pytest.raises(NotFittedError):
        model.predict(x)
    with pytest.raises(NotFittedError):
        model.get_selected_sensors()
    with pytest.raises(NotFittedError):
        model.get_all_sensors()
    with pytest.raises(NotFittedError):
        model.set_number_of_sensors(20)
    with pytest.raises(NotFittedError):
        model.score(x)
    with pytest.raises(NotFittedError):
        model.reconstruction_error(x)
Exemple #3
0
def test_sensor_selector_properties(data_random):
    data = data_random
    model = SSPOR().fit(data)

    assert all(model.get_all_sensors() == model.all_sensors)
    assert all(model.get_selected_sensors() == model.selected_sensors)