Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible bug: Datageneration from custom function inspects function signature. #286

Open
elvisbr0wn opened this issue Dec 3, 2024 · 1 comment

Comments

@elvisbr0wn
Copy link

elvisbr0wn commented Dec 3, 2024

When playing around with this example in the documentation: https://f3dasm.readthedocs.io/en/latest/auto_examples/003_datageneration/001_own_datagenerator.html#car-stopping-distance-problem

If you change the custom function to

def y(x2):
    z = norm.rvs(1.5, 0.5, size=1)
    y = z*x2 + 0.1*x2**2
    return y

You get that the experiment sample have the status of error after executing experiment_data.evaluate(data_generator=y, output_names=['y']), getting

File "/Users/eaguerov/mambaforge/envs/3dasm/lib/python3.10/site-packages/f3dasm/_src/experimentdata/experimentsample.py", line 161, in get
    value, from_disk = self._load_from_experimentdata(item)
TypeError: cannot unpack non-iterable NoneType object

This is because we changed the signature of y(x) to y(x2), which does not coincide with the input name on the domain of the experimentdata object.

I personally could understand why this behavior might be desirable, but I believe that the consequences of the current implementation are that you cannot generate basically anything that was not typed out manually by the user.

If you train a model, and want to test the predictions of the model on some input data, you simply cannot do data_generator=my_model, unless the my_model variable has the exact signature of the input features that the experimentData Domain has. This is cumbersome for problems with 10+ input features.

I do not have an explicit solution in mind, I just wanted to share my thoughts with the developers so that a scalable solution is devised.

@elvisbr0wn
Copy link
Author

elvisbr0wn commented Dec 3, 2024

Just for the record, I noticed that this is also discussed in #268. I will keep this issue because I believe this topic needs more discussion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant