Hi Marocco,

Turns out the latest *released *version of the wso2-gpl[1] repository
doesn't include the latest fixes related to pmml. What you could try is, to
build the repositories manually as explained in[2] and use that p2-repo to
install the pmml features to your CEP server.

I have tried out your svm pmml with the latest wso2-gpl pmml version and it
works fine.


[1] https://github.com/wso2-gpl/siddhi
[2] https://docs.wso2.com/display/CEP410/Installing+WSO2+GPL+Features

On Wed, Apr 20, 2016 at 6:09 PM, <[email protected]> wrote:

> Hi Fazlan,
>
> I tried before writing this post but I always got the error:
>
> Different definition same as output stream definition :StreamDefinition
>
> So I this that the output of the predict is different but I don't know how
> it has to be..
>
> Have you ever try with a svm model? Can you test please my example? (It's
> very important for me this question
>
> Thank you very much,
>
> Silvia
>
> Fazlan Nazeem <[email protected]> ha scritto:
>
> Hi Marocco,
>>
>> What you need is something like this.
>>
>> @Import('inputStream:1.0.0')
>> define stream inputTest (field_0 double, field_1 double, field_2 double,
>> field_3 double, field_4 double, field_5 double, field_6 double, field_7
>> double, field_8 double, field_9 double, field_10 double, field_11 double,
>> field_12 double, field_13 double, field_14 double, field_15 double,
>> field_16 double, field_17 double, field_18 double, field_19 double,
>> field_20 double, field_21 double, field_22 double, field_23 double,
>> field_24 double, field_25 double, field_26 double, field_27 double,
>> field_28 double, field_29 double, field_30 double, field_31 double,
>> field_32 double);
>>
>> @Import('outputStream:1.0.0')
>> define stream outputTest (field_0 double, field_1 double, field_2 double,
>> field_3 double, field_4 double, field_5 double, field_6 double, field_7
>> double, field_8 double, field_9 double, field_10 double, field_11 double,
>> field_12 double, field_13 double, field_14 double, field_15 double,
>> field_16 double, field_17 double, field_18 double, field_19 double,
>> field_20 double, field_21 double, field_22 double, field_23 double,
>> field_24 double, field_25 double, field_26 double, field_27 double,
>> field_28 double, field_29 double, field_30 double, field_31 double,
>> field_32 double, *target string*);
>>
>>
>> from inputTest#pmml:predict('myfile.pmml')
>> select *
>> insert into outputTest;
>>
>>
>> you have to create two streams (inputStream, outputStream) and create a
>> logger publisher for outputStream. This way when an even is received to
>> the
>> outputStream, the event will be logged in the server console with the
>> prediction value named  as "target".
>>
>>
>>
>> On Tue, Apr 19, 2016 at 5:42 PM, <[email protected]> wrote:
>>
>> Thank you for the explanation..
>>> But I'm not able to write the correct shiddi query..
>>> I have this file pmml:
>>>
>>> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
>>> <PMML xmlns="http://www.dmg.org/PMML-4_2";>
>>>     <Header description="linear SVM">
>>>         <Application name="Apache Spark MLlib"/>
>>>         <Timestamp>2016-04-12T07:06:37</Timestamp>
>>>     </Header>
>>>     <DataDictionary numberOfFields="34">
>>>         <DataField name="field_0" optype="continuous" dataType="double"/>
>>>         <DataField name="field_1" optype="continuous" dataType="double"/>
>>>         <DataField name="field_2" optype="continuous" dataType="double"/>
>>>         <DataField name="field_3" optype="continuous" dataType="double"/>
>>>         <DataField name="field_4" optype="continuous" dataType="double"/>
>>>         <DataField name="field_5" optype="continuous" dataType="double"/>
>>>         <DataField name="field_6" optype="continuous" dataType="double"/>
>>>         <DataField name="field_7" optype="continuous" dataType="double"/>
>>>         <DataField name="field_8" optype="continuous" dataType="double"/>
>>>         <DataField name="field_9" optype="continuous" dataType="double"/>
>>>         <DataField name="field_10" optype="continuous"
>>> dataType="double"/>
>>>         <DataField name="field_11" optype="continuous"
>>> dataType="double"/>
>>>         <DataField name="field_12" optype="continuous"
>>> dataType="double"/>
>>>         <DataField name="field_13" optype="continuous"
>>> dataType="double"/>
>>>         <DataField name="field_14" optype="continuous"
>>> dataType="double"/>
>>>         <DataField name="field_15" optype="continuous"
>>> dataType="double"/>
>>>         <DataField name="field_16" optype="continuous"
>>> dataType="double"/>
>>>         <DataField name="field_17" optype="continuous"
>>> dataType="double"/>
>>>         <DataField name="field_18" optype="continuous"
>>> dataType="double"/>
>>>         <DataField name="field_19" optype="continuous"
>>> dataType="double"/>
>>>         <DataField name="field_20" optype="continuous"
>>> dataType="double"/>
>>>         <DataField name="field_21" optype="continuous"
>>> dataType="double"/>
>>>         <DataField name="field_22" optype="continuous"
>>> dataType="double"/>
>>>         <DataField name="field_23" optype="continuous"
>>> dataType="double"/>
>>>         <DataField name="field_24" optype="continuous"
>>> dataType="double"/>
>>>         <DataField name="field_25" optype="continuous"
>>> dataType="double"/>
>>>         <DataField name="field_26" optype="continuous"
>>> dataType="double"/>
>>>         <DataField name="field_27" optype="continuous"
>>> dataType="double"/>
>>>         <DataField name="field_28" optype="continuous"
>>> dataType="double"/>
>>>         <DataField name="field_29" optype="continuous"
>>> dataType="double"/>
>>>         <DataField name="field_30" optype="continuous"
>>> dataType="double"/>
>>>         <DataField name="field_31" optype="continuous"
>>> dataType="double"/>
>>>         <DataField name="field_32" optype="continuous"
>>> dataType="double"/>
>>>         <DataField name="target" optype="categorical" dataType="string"/>
>>>     </DataDictionary>
>>>     <RegressionModel modelName="linear SVM" functionName="classification"
>>> normalizationMethod="none">
>>>         <MiningSchema>
>>>             <MiningField name="field_0" usageType="active"/>
>>>             <MiningField name="field_1" usageType="active"/>
>>>             <MiningField name="field_2" usageType="active"/>
>>>             <MiningField name="field_3" usageType="active"/>
>>>             <MiningField name="field_4" usageType="active"/>
>>>             <MiningField name="field_5" usageType="active"/>
>>>             <MiningField name="field_6" usageType="active"/>
>>>             <MiningField name="field_7" usageType="active"/>
>>>             <MiningField name="field_8" usageType="active"/>
>>>             <MiningField name="field_9" usageType="active"/>
>>>             <MiningField name="field_10" usageType="active"/>
>>>             <MiningField name="field_11" usageType="active"/>
>>>             <MiningField name="field_12" usageType="active"/>
>>>             <MiningField name="field_13" usageType="active"/>
>>>             <MiningField name="field_14" usageType="active"/>
>>>             <MiningField name="field_15" usageType="active"/>
>>>             <MiningField name="field_16" usageType="active"/>
>>>             <MiningField name="field_17" usageType="active"/>
>>>             <MiningField name="field_18" usageType="active"/>
>>>             <MiningField name="field_19" usageType="active"/>
>>>             <MiningField name="field_20" usageType="active"/>
>>>             <MiningField name="field_21" usageType="active"/>
>>>             <MiningField name="field_22" usageType="active"/>
>>>             <MiningField name="field_23" usageType="active"/>
>>>             <MiningField name="field_24" usageType="active"/>
>>>             <MiningField name="field_25" usageType="active"/>
>>>             <MiningField name="field_26" usageType="active"/>
>>>             <MiningField name="field_27" usageType="active"/>
>>>             <MiningField name="field_28" usageType="active"/>
>>>             <MiningField name="field_29" usageType="active"/>
>>>             <MiningField name="field_30" usageType="active"/>
>>>             <MiningField name="field_31" usageType="active"/>
>>>             <MiningField name="field_32" usageType="active"/>
>>>             <MiningField name="target" usageType="target"/>
>>>         </MiningSchema>
>>>         <RegressionTable intercept="0.0" targetCategory="1">
>>>             <NumericPredictor name="field_0"
>>> coefficient="-33.663867609108465"/>
>>>             <NumericPredictor name="field_1"
>>> coefficient="-26.928869029283113"/>
>>>             <NumericPredictor name="field_2"
>>> coefficient="-15.7589879271062"/>
>>>             <NumericPredictor name="field_3"
>>> coefficient="4.801827945644439"/>
>>>             <NumericPredictor name="field_4"
>>> coefficient="4.37913587227952"/>
>>>             <NumericPredictor name="field_5"
>>> coefficient="5.017699542764569"/>
>>>             <NumericPredictor name="field_6"
>>> coefficient="6.881223937543283"/>
>>>             <NumericPredictor name="field_7"
>>> coefficient="7.436600728282555"/>
>>>             <NumericPredictor name="field_8"
>>> coefficient="2.779684237173268"/>
>>>             <NumericPredictor name="field_9"
>>> coefficient="-11.1563341379461"/>
>>>             <NumericPredictor name="field_10"
>>> coefficient="-11.603667328060018"/>
>>>             <NumericPredictor name="field_11"
>>> coefficient="-1.927205925226167"/>
>>>             <NumericPredictor name="field_12"
>>> coefficient="-0.13042330215893916"/>
>>>             <NumericPredictor name="field_13"
>>> coefficient="4.606266797295681"/>
>>>             <NumericPredictor name="field_14"
>>> coefficient="4.198456448492548"/>
>>>             <NumericPredictor name="field_15"
>>> coefficient="1.3866370557496586"/>
>>>             <NumericPredictor name="field_16"
>>> coefficient="-1.6863769626309484"/>
>>>             <NumericPredictor name="field_17"
>>> coefficient="-1.8279467318593428"/>
>>>             <NumericPredictor name="field_18"
>>> coefficient="0.1893987855143311"/>
>>>             <NumericPredictor name="field_19"
>>> coefficient="12.645268212559404"/>
>>>             <NumericPredictor name="field_20"
>>> coefficient="14.115013455939593"/>
>>>             <NumericPredictor name="field_21"
>>> coefficient="13.544000807391123"/>
>>>             <NumericPredictor name="field_22"
>>> coefficient="6.0112812628907015"/>
>>>             <NumericPredictor name="field_23"
>>> coefficient="4.03765113349721"/>
>>>             <NumericPredictor name="field_24"
>>> coefficient="4.145995153508418"/>
>>>             <NumericPredictor name="field_25"
>>> coefficient="2.08758768566234"/>
>>>             <NumericPredictor name="field_26"
>>> coefficient="1.1271455002504913"/>
>>>             <NumericPredictor name="field_27"
>>> coefficient="-0.28071996147406497"/>
>>>             <NumericPredictor name="field_28"
>>> coefficient="7.761062281510407"/>
>>>             <NumericPredictor name="field_29"
>>> coefficient="0.25888510113432384"/>
>>>             <NumericPredictor name="field_30"
>>> coefficient="-8.756880183958602"/>
>>>             <NumericPredictor name="field_31"
>>> coefficient="-4.332351913516022"/>
>>>             <NumericPredictor name="field_32"
>>> coefficient="2.0548737734231493"/>
>>>         </RegressionTable>
>>>         <RegressionTable intercept="0.0" targetCategory="0"/>
>>>     </RegressionModel>
>>> </PMML>
>>>
>>> so I have to write something like:
>>>
>>> @Import('fonometro:1.0.0')
>>> define stream inputTest (field_0 double, field_1 double, field_2 double,
>>> field_3 double, field_4 double, field_5 double, field_6 double, field_7
>>> double, field_8 double, field_9 double, field_10 double, field_11 double,
>>> field_12 double, field_13 double, field_14 double, field_15 double,
>>> field_16 double, field_17 double, field_18 double, field_19 double,
>>> field_20 double, field_21 double, field_22 double, field_23 double,
>>> field_24 double, field_25 double, field_26 double, field_27 double,
>>> field_28 double, field_29 double, field_30 double, field_31 double,
>>> field_32 double);
>>>
>>> from inputTest#pmml:predict('samples/myfile.pmml')
>>> select *
>>> insert into ????
>>>
>>> or
>>>
>>> @Import('fonometro:1.0.0')
>>> define stream inputTest (field_0 double, field_1 double, field_2 double,
>>> field_3 double, field_4 double, field_5 double, field_6 double, field_7
>>> double, field_8 double, field_9 double, field_10 double, field_11 double,
>>> field_12 double, field_13 double, field_14 double, field_15 double,
>>> field_16 double, field_17 double, field_18 double, field_19 double,
>>> field_20 double, field_21 double, field_22 double, field_23 double,
>>> field_24 double, field_25 double, field_26 double, field_27 double,
>>> field_28 double, field_29 double, field_30 double, field_31 double,
>>> field_32 double);
>>>
>>> from inputTest#pmml:predict('myfile.pmml',field_0, field_1, field_2,
>>> field_3, field_4, field_5, field_6, field_7, field_8, field_9, field_10,
>>> field_11, field_12, field_13, field_14, field_15, field_16, field_17,
>>> field_18, field_19, field_20, field_21, field_22, field_23, field_24,
>>> field_25, field_26, field_27, field_28, field_29, field_30, field_31,
>>> field_32)
>>> select *
>>> insert into ????
>>>
>>> everything I put instead of ???? raise an error saying that I'm
>>> redefining
>>> the output stream..
>>>
>>> Can you help me? I need the "target" field?
>>> Thank you,
>>>
>>> Silvia
>>>
>>> Quoting Fazlan Nazeem <[email protected]>:
>>>
>>> Hi Marocco,
>>>
>>>>
>>>> The reason behind the decision tree PMML model having an output tag and
>>>> SVM
>>>> not having an output tag solely depends on what library you have used to
>>>> generate the PMML file. The PMML specification[1] does not specify that
>>>> every PMML model should include an output tag. Please refer to the line
>>>> 7
>>>> of the XSD file attached herewith which specifies that output tag
>>>> "minOccurs="0", which implies that a PMML file may contain a minimum of
>>>> 0
>>>> output fields. For example you may try out WSO2 Machine Learner's[2]
>>>> PMML
>>>> generation functionality which does not include output tags for most of
>>>> its
>>>> PMML models.
>>>>
>>>> Therefore two specific libraries for PMML can generate two slightly
>>>> different PMML files for the same model depending on how they have
>>>> implemented the PMML generation functionality. The PMML readers should
>>>> be
>>>> able to interpret these different cases and predict the output for a new
>>>> input stream.
>>>>
>>>> With CEP 4.0.0, you may experience an issue when there is no output tag
>>>> present in the PMML file, the PMML extension might not work. We have
>>>> identified this issue[3] and fixed it with the 4.1.0 release.
>>>>
>>>>
>>>> [1] http://dmg.org/pmml/v4-1/GeneralStructure.html
>>>> [2] http://wso2.com/products/machine-learner/
>>>> [3] https://wso2.org/jira/browse/CEP-1438
>>>>
>>>> On Fri, Apr 15, 2016 at 8:12 PM, <[email protected]> wrote:
>>>>
>>>>
>>>> Hi!
>>>>>
>>>>> I installed the cep version 4, becouse I need to test the pmml
>>>>> functionalities. I have already executed this example:
>>>>>
>>>>>
>>>>> https://docs.wso2.com/display/CEP410/Sample+0301+-+Network+Intruder+Detection+with+PMML+Extension+Predictions
>>>>> which is based on a decision-tree and it works. I need to understand
>>>>> for
>>>>> a
>>>>> SVM (support vector machine) PMML, which is the output stream I have to
>>>>> create on CEP. The difference between the two pmml is that
>>>>> decision-tree
>>>>> specifies Output tag, so the outputstream is equal to the inputstrams
>>>>> plus
>>>>> the output tag, in svm instead there is no output tag.
>>>>>
>>>>> Thank you for help.
>>>>> Silvia
>>>>>
>>>>> _______________________________________________
>>>>> Dev mailing list
>>>>> [email protected]
>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> Thanks & Regards,
>>>>
>>>> Fazlan Nazeem
>>>>
>>>> *Software Engineer*
>>>>
>>>> *WSO2 Inc*
>>>> Mobile : +94772338839
>>>> <%2B94%20%280%29%20773%20451194>
>>>> [email protected]
>>>>
>>>>
>>>
>>>
>>>
>>>
>>
>> --
>> Thanks & Regards,
>>
>> Fazlan Nazeem
>>
>> *Software Engineer*
>>
>> *WSO2 Inc*
>> Mobile : +94772338839
>> <%2B94%20%280%29%20773%20451194>
>> [email protected]
>>
>
>
>


-- 
Thanks & Regards,

Fazlan Nazeem

*Software Engineer*

*WSO2 Inc*
Mobile : +94772338839
<%2B94%20%280%29%20773%20451194>
[email protected]
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to