-
Notifications
You must be signed in to change notification settings - Fork 113
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
How can use a method similar to pandas' groupby to group a dataset and use numpy.random.uniform
function?
#432
Comments
You are trying to modify the number of rows in the (training-) dataset, right? This is not conceptually supported by Scikit-Learn nor (J)PMML. You should pre-process your dataset into its "stable representation" (meaning the number and ordering of rows will not change, with every row representing one observation) before it enters the "real ML pipeline". As you can probably see, the most natural place for your TLDR: Re-think your workflow. You should do low-level dataset work outside of the
There are two parts to this question. First, technically, it is easy to make the Second, and much more difficult, is to make the Java UDF work with I can quickly think of the following extension, where the func_mapping = {
"numpy.random.uniform" : "org.jpmml.python.functions.NumpyRandomUniformFunction"
}
transformer = ExpressionTransformer("random.uniform(0.1, 0.2)", func_mapping = func_mapping) Very interesting! I'm currently designing Java UDF support for the JPMML-R library, so it would make all the sense to expand the "design scope" a bit, and come up with something that would work both in R and Scikit-Learn/Python world. |
numpy.random.uniform
function?
Thank you very much for your response. Firstly, the sklearn2pmml package has been very helpful to me, and I hope it continues to improve. I look forward to the release of the func_mapping feature, which I believe will make applications more flexible, though it might also bring more challenges. Looking forward to your updates. |
Question 1:
How can I use a method similar to pandas' groupby to group a dataset, calculate the maximum value for each group, and generate a pipeline that can create a PMML file using sklearn2pmml? I have a logic reference in the following code, but it does not execute correctly when generating the PMML file. I am currently investigating the cause and looking for alternative solutions. My guess is that Jpmml does not have a similar function, so it cannot be converted. Is my understanding correct?
Reference code for Question 1:
Question 2:
How can I use a function like random.uniform(0.1, 0.2) within ExpressionTransformer to randomly generate numbers in a specific range?
What I want to achieve is to add some perturbations or random values to the result, so that the result is evenly distributed in a certain interval.
Reference code for Question 2:
The text was updated successfully, but these errors were encountered: