SoftwareAG/nyoka

nyoka export issue

saritpg opened this issue · 2 comments

Hello,

Here is the example that is given in nyoka github page:

#--------------------------------------------
import pandas as pd
from sklearn import datasets
from sklearn.pipeline import Pipeline
from sklearn.svm import SVC

iris = datasets.load_iris()
irisd = pd.DataFrame(iris.data,columns=iris.feature_names)
irisd['Species'] = iris.target

features = irisd.columns.drop('Species')
target = 'Species'

pipeline_obj = Pipeline([('svm',SVC())])

pipeline_obj.fit(irisd[features],irisd[target])

from nyoka import skl_to_pmml

skl_to_pmml(pipeline_obj,features,target,"svc_pmml.pmml")

#-------------------------------------------------

And here is the error:

File "C:\Users\PATI\AppData\Local\Continuum\anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 668, in runfile
execfile(filename, namespace)

File "C:\Users\PATI\AppData\Local\Continuum\anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 108, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)

File "C:/Users/PATI/Downloads/test1.py", line 30, in
skl_to_pmml(pipeline_obj,features,target,"svc_pmml.pmml")

File "C:\Users\PATI\AppData\Roaming\Python\Python36\site-packages\nyoka\skl\skl_to_pmml.py", line 68, in skl_to_pmml
pmml.export(outfile=open(pmml_f_name, "w"), level=0)

File "C:\Users\PATI\AppData\Roaming\Python\Python36\site-packages\nyoka\PMML43Ext.py", line 1445, in export
self.exportChildren(outfile, level + 1, namespace_='', name_='Timestamp', pretty_print=pretty_print)

File "C:\Users\PATI\AppData\Roaming\Python\Python36\site-packages\nyoka\PMML43ExtSuper.py", line 22936, in exportChildren
SupportVectorMachineModel_.export(outfile, level, namespace_, name_='SupportVectorMachineModel', pretty_print=pretty_print)

File "C:\Users\PATI\AppData\Roaming\Python\Python36\site-packages\nyoka\PMML43ExtSuper.py", line 48577, in export
self.exportChildren(outfile, level + 1, namespace_='', name_='SupportVectorMachineModel', pretty_print=pretty_print)

File "C:\Users\PATI\AppData\Roaming\Python\Python36\site-packages\nyoka\PMML43ExtSuper.py", line 48615, in exportChildren
self.Output.export(outfile, level, namespace_, name_='Output', pretty_print=pretty_print)

File "C:\Users\PATI\AppData\Roaming\Python\Python36\site-packages\nyoka\PMML43ExtSuper.py", line 37204, in export
self.exportChildren(outfile, level + 1, namespace_='', name_='Output', pretty_print=pretty_print)

File "C:\Users\PATI\AppData\Roaming\Python\Python36\site-packages\nyoka\PMML43ExtSuper.py", line 37219, in exportChildren
OutputField_.export(outfile, level, namespace_, name_='OutputField', pretty_print=pretty_print)

File "C:\Users\PATI\AppData\Roaming\Python\Python36\site-packages\nyoka\PMML43ExtSuper.py", line 37495, in export
self.exportAttributes(outfile, level, already_processed, namespace_, name_='OutputField')

File "C:\Users\PATI\AppData\Roaming\Python\Python36\site-packages\nyoka\PMML43Ext.py", line 2479, in exportAttributes
if self.numTopCategories is not None and 'numTopCategories' not in already_processed:

AttributeError: 'OutputField' object has no attribute 'numTopCategories'

Please reinstall Nyoka once, we have corrected the part which was causing this error. Let us know if any more troubles. Please let us know if this solves your problem, we will close the issue.

Yes. Problem solved. Please close the issue.