autodeployai / pypmml

Python PMML scoring library
Apache License 2.0
75 stars 22 forks source link

Trigonometric functions not working #2

Closed magdanowak closed 5 years ago

magdanowak commented 5 years ago

I have a pmml file generated with sklearn2pmml with the following DerivedField:

<DerivedField name="hour_x" optype="continuous" dataType="double">
    <Apply function="x-sin">
        <Apply function="*">
            <Constant dataType="double">0.2617993877991494</Constant>
            <FieldRef field="hour"/>
        </Apply>
    </Apply>
</DerivedField>

When I try to read it into Python with pypmml.Model, I get the following error: ('FunctionNotFoundException', "Function 'x-sin' is not defined.")

Is there a possibility to add the trigonometric functions to your package?

scorebot commented 5 years ago

It's because the function "x-sin" is not a standard built-in function for PMML. The latest PMML 4.4 picks up the "sin".

Anyway, I updated the PMML4S library to support those extension functions and standard ones of 4.4 for the trigonometric functions.

Please, reinstall the latest version from Github by the following command:

pip install --upgrade git+https://github.com/autodeployai/pypmml.git

Please, let me know if you still have problem.

scorebot commented 5 years ago

@magdanowak What's the status of your issue? Did the fix above resolve it?

magdanowak commented 5 years ago

@scorebot Thank you for resolving the issue so fast! Your fix did indeed help.

scorebot commented 5 years ago

@magdanowak It's fine. I close this issue now, you can open new issues if you have other problems.