def test_sfa_parameter_computation(dimension, n_samples): current_data = mixed_trigonometric_functions(dimension, n_samples) sfa = SFA() slow_features = sfa.fit_transform(current_data) W, b = sfa.affine_parameters() affine_transformed = np.dot(current_data, W.T) + b assert np.allclose(slow_features, affine_transformed)
def test_sfa_parameter_computation_rank_deficit_nonzero_fill( dimension, rank_deficit): current_data = mixed_trigonometric_functions(dimension, rank_deficit=rank_deficit) sfa = SFA(fill_mode="noise") slow_features = sfa.fit_transform(current_data) with pytest.raises(RuntimeError): W, b = sfa.affine_parameters()
def test_sfa_parameter_computation_rank_deficit_zero_fill( dimension, rank_deficit): current_data = mixed_trigonometric_functions(dimension, rank_deficit=rank_deficit) sfa = SFA(fill_mode="zero") slow_features = sfa.fit_transform(current_data) W, b = sfa.affine_parameters() affine_transformed = np.dot(current_data, W.T) + b assert np.allclose(slow_features, affine_transformed)