-
-
Notifications
You must be signed in to change notification settings - Fork 72
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
Enhancement: Add a rejection sampler #174
Comments
Hiya, sure - but this requires a dependency on pandas or Polars, no? |
True, it could instead just return a list of jsons removing the pandas dependency but keeping the reproducible valid batch component? |
Yes, this should not have a dependency on any third party library to do. |
How about adding the possibility of installing it as an extension? |
@williamjamir why do you want to have pandas for this? Also, I'm not sure about the need for this feature. EDIT: Actually, this could be useful where you have your own custom validators which |
Summary
Currently the
batch
method fails with a validation error if any of the generated rows fail the schema validators. To allow use of the package in a testing environment, it would be useful to be able to generate a dataframe of any size using a rejection sampler method. This method should store the random seeds of successful builds in order to reproduce the same dataframe each time.I have created a class that performs these actions included below. Given this is something I have needed for my project, it could be a useful feature for others wanting to use Polyfactory for testing. I built it based off the original pydantic factories package, but I imagine it would be pretty similar for the additional Factory options in Polyfactory.
Basic Example
Drawbacks and Impact
No response
Unresolved questions
No response
The text was updated successfully, but these errors were encountered: