def test_score(data_vandermonde): data = data_vandermonde weak_model = SSPOR(n_sensors=3) weak_model.fit(data) # You must pass in data with as many features as the training set with pytest.raises(ValueError): weak_model.score(data[:, :5]) strong_model = SSPOR(n_sensors=8) strong_model.fit(data) assert weak_model.score(data) < strong_model.score(data)
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)