how to refer outputfield from derivedfield in pmml - sas

I have derivedfields in my pmml I want to use them as outputfields. So I want to refer outputfield from derivedfield. But sas application throw an error. Error is :
ERROR: Variable Z_DD_OCCUPATION_ID is not defined.
How can I set outputfield from derived field?
Here is my pmml which doesn't work
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<PMML version="4.2"
xmlns="http://www.dmg.org/PMML-4_2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Header copyright="Copyright(c) 2002 SAS Institute Inc., Cary, NC, USA. All Rights Reserved.">
<Application name="SAS(r)" version="9.4"/>
<Timestamp>2016-06-23 15:36:04</Timestamp>
</Header>
<DataDictionary numberOfFields="26">
<DataField name="CH_INT_FLG_CRR" optype="continuous" dataType="double"/>
<DataField name="TD_SALE_FLG_00M_5" optype="categorical" dataType="string"/>
<DataField name="TARGET_NUM" optype="categorical" dataType="double"/>
</DataDictionary>
<TransformationDictionary>
</TransformationDictionary>
<RegressionModel functionName="classification" targetFieldName="TARGET_NUM" normalizationMethod="logit">
<MiningSchema>
<MiningField name="CH_INT_FLG_CRR" usageType="active" optype="continuous"/>
<MiningField name="TD_SALE_FLG_00M_5" usageType="active" optype="categorical"/>
<MiningField name="TARGET_NUM" usageType="target" optype="categorical"/>
</MiningSchema>
<Output>
<OutputField name="I_TARGET_NUM" displayName="Into: TARGET_NUM" optype="categorical" dataType="string" targetField="TARGET_NUM" feature="predictedValue"/>
<OutputField name="U_TARGET_NUM" displayName="Unnormalized Into: TARGET_NUM" optype="categorical" dataType="string" targetField="TARGET_NUM" feature="predictedDisplayValue"/>
<OutputField name="P_TARGET_NUM1" displayName="Predicted: TARGET_NUM=1" optype="continuous" dataType="double" targetField="TARGET_NUM" feature="probability" value="1"/>
<OutputField name="P_TARGET_NUM0" displayName="Predicted: TARGET_NUM=0" optype="continuous" dataType="double" targetField="TARGET_NUM" feature="probability" value="0"/>
<OutputField name="out_1" optype="continuous" dataType="double" feature="transformedValue">
<FieldRef field="Z_DD_OCCUPATION_ID"/>
</OutputField>
<OutputField name="out_2" optype="continuous" dataType="double" feature="transformedValue">
<FieldRef field="Z_CH_INT_FLG_CRR"/>
</OutputField>
</Output>
<Targets>
<Target field="TARGET_NUM" optype="categorical">
<TargetValue value="1" displayValue="1" priorProbability="0.5000049143"/>
<TargetValue value="0" displayValue="0" priorProbability="0.4999950857"/>
</Target>
</Targets>
<LocalTransformations>
<DerivedField name="Z_DD_OCCUPATION_ID" displayName="Z_DD_OCCUPATION_ID" optype="continuous" dataType="double" >
<MapValues outputColumn="return" defaultValue="99.9">
<FieldColumnPair column="condition" field="TD_SALE_FLG_00M_5"/>
<InlineTable>
<row>
<condition>9999</condition>
<return>-0.0992686543837357</return>
</row>
<row>
<condition>7130</condition>
<return>-0.010300374749499</return>
</row>
</InlineTable>
</MapValues>
</DerivedField>
<DerivedField name="Z_CH_INT_FLG_CRR" displayName="Z_CH_INT_FLG_CRR" optype="continuous" dataType="double">
<Discretize field="CH_INT_FLG_CRR" >
<DiscretizeBin binValue="0.0154213834">
<Interval closure="openOpen" rightMargin="0"/>
</DiscretizeBin>
<DiscretizeBin binValue="-0.025845983">
<Interval closure="closedClosed" leftMargin="0" rightMargin="0"/>
</DiscretizeBin>
<DiscretizeBin binValue="0.0154213834">
<Interval closure="openOpen" leftMargin="0"/>
</DiscretizeBin>
</Discretize>
</DerivedField>
</LocalTransformations>
<RegressionTable intercept="0.0203226371" targetCategory="1">
<NumericPredictor name="Z_CH_INT_FLG_CRR" coefficient="7.5086455767" />
<NumericPredictor name="Z_DD_OCCUPATION_ID" coefficient="3.2" />
</RegressionTable>
<RegressionTable intercept="0" targetCategory="0"/>
</RegressionModel>
</PMML>
If I use datadictionary columns instead of derived fields, it works perfectly.
For example If I convert
<OutputField name="out_1" optype="continuous" dataType="double" feature="transformedValue">
<FieldRef field="Z_DD_OCCUPATION_ID"/>
</OutputField>
<OutputField name="out_2" optype="continuous" dataType="double" feature="transformedValue">
<FieldRef field="Z_CH_INT_FLG_CRR"/>
</OutputField>
to
<OutputField name="out_1" optype="continuous" dataType="double" feature="transformedValue">
<FieldRef field="TD_SALE_FLG_00M_5"/>
</OutputField>
<OutputField name="out_2" optype="continuous" dataType="double" feature="transformedValue">
<FieldRef field="CH_INT_FLG_CRR"/>
</OutputField>
it works. Because in this case, I refer outputfield from datadictionary columns. But actually I need to use derivedfields in outputfields. How can I refer outputfields from derivedfields?

You need to move your derived fields from LocalTransformations (ie. local scope) to TransformationDictionary (ie. global scope).
PMML 4.2 does not permit referencing local derived fields from output fields. The "logic" is that you cannot reference a field before it has been seen by the PMML parser. In you example, OutputField#name=out_1 element occurs before DerivedField#name=Z_DD_OCCUPATION_ID element.
PMML 4.3 relaxed this rule. See http://mantis.dmg.org/view.php?id=142 for details.

Related

Caml Validation

Is this is a ligit Caml query? I am new to sharepoint.
<View>
<Query>
<Where>
<And>
<Eq>
<FieldRef Name="Autres_x0020_organizations"/>
<Value Type="Boolean">1</Value>
</Eq>
<EQ>
<FieldRef Name="TempPartiel"/>
<Value Type="Boolean">1</Value>
</EQ>
<Or>
<IsNull>
<FieldRef Name="Date_x0020_d_x0027__x00e9_ch_x00"/>
</IsNull>
<Geq>
<FieldRef Name="Date_x0020_d_x0027__x00e9_ch_x00"/>
<Value Type="DateTime">
<Today/>
</Value>
</Geq>
</Or>
</And>
</Where>
<OrderBy>
<FieldRef Name="Ordre_x0020_des_x0020_bourses" Ascending="TRUE"/>
</OrderBy>
</Query>
</View>
I know that my new column in my list is a Yes/No type.
I added this sections
<EQ>
<FieldRef Name="TempPartiel"/>
<Value Type="Boolean">1</Value>
</EQ>
The caml query looks fine. Besides, here is a tool called Caml Designer would help you to build your caml query. It's very useful:
https://www.biwug.be/resources

SharePoint 2013 Content Query Web Part 4 Filter

I have the following Code-Snippet to Filter Blogposts in a Content Query WebPart. We need more than the 3 Filters already given in Sharepoint, so I tried it with CMAL-Query.
But the filter´s don´t apply when I add the WebPart to my SP-Page. Any Suggestions how to Change the code?
The Posts should be filtered by Category.
<property name="QueryOverride" type="string">
<![CDATA[
<where>
<or>
<or>
<Eq>
<FieldRef Name='PostCategory' />
<Value Type='Text'>test4</Value>
</Eq>
<Eq>
<FieldRef Name='PostCategory' />
<Value Type='Text'>test5</Value>
</Eq>
</or>
<or>
<Eq>
<FieldRef Name='PostCategory' />
<Value Type='Text'>Ideen</Value>
</Eq>
<Eq>
<FieldRef Name='PostCategory' />
<Value Type='Text'>Meinungen</Value>
</Eq>
</or>
</or>
</where>
]]>
</property>
NVM.
I found my mistake. Using the U2U Caml Builder everything now works as expected.

Can not edit Doctrine ArrayCollection

I have a problem with editing an Doctrine2 ArrayCollection of a many-to-many assosciation.
Persisting an new entity is no problem and works fine. But if I would like to persist an entity with new added CollectionItems I got an
Doctrine\ORM\ORMInvalidArgumentException
I use the xml-mapping, the mapping files are the following:
receipt:
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Application\Entity\Receipt" table="receipt" repository-class="Application\Repositories\ReceiptRepository">
<indexes>
<index name="FK_receipt_profession" columns="professsion"/>
<index name="FK_receipt_items_needed" columns="items"/>
</indexes>
<id name="rId" type="integer" column="r_id">
<generator strategy="IDENTITY"/>
</id>
<field name="name" type="string" column="name" length="100" nullable="false"/>
<many-to-one field="profession" target-entity="Application\Entity\Profession">
<join-columns>
<join-column name="profession" referenced-column-name="p_id"/>
</join-columns>
</many-to-one>
<many-to-many field="items" target-entity="Application\Entity\ItemsNeeded" inversed-by="receipt">
<!--<cascade><cascade-all/></cascade>-->
<join-table name="receipt_x_items_needed">
<join-columns>
<join-column name="receipt" referenced-column-name="r_id"/>
</join-columns>
<inverse-join-columns>
<join-column name="itemNeeded" referenced-column-name="in_id"/>
</inverse-join-columns>
</join-table>
</many-to-many>
</entity>
</doctrine-mapping>
ItemsNeeded:
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Application\Entity\ItemsNeeded" table="items_needed" repository-class="Application\Repositories\ItemsneededRepository">
<indexes>
<index name="FK_items_needed_receipt" columns="receipt_id"/>
<index name="item_id" columns="item_id"/>
</indexes>
<id name="inId" type="integer" column="in_id">
<generator strategy="IDENTITY"/>
</id>
<field name="count" type="integer" column="count" nullable="false"/>
<many-to-one field="item" target-entity="Application\Entity\Items">
<join-columns>
<join-column name="item_id" referenced-column-name="i_id"/>
</join-columns>
</many-to-one>
<many-to-many field="receipt" target-entity="Application\Entity\Receipt" mapped-by="items"/>
</entity>
</doctrine-mapping>
and items:
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Application\Entity\Items" table="items" repository-class="Importer\Repository\ItemRepository">
<unique-constraints>
<unique-constraint name="buffed_id" columns="buffed_id"/>
</unique-constraints>
<id name="iId" type="integer" column="i_id">
<generator strategy="IDENTITY"/>
</id>
<field name="name" type="string" column="name" length="100" nullable="false"/>
<field name="buffedId" type="integer" column="buffed_id" nullable="false"/>
</entity>
</doctrine-mapping>
The receipt table has an many-to-many relation through the crosstable "receipt_x_items_needed".
If I call $receipt->addItem($item); and $item is an already existing item from the itemtable I got the following error:
A new entity was found through the relationship 'Application\Entity\ItemsNeeded#item' that was not configured to cascade persist operations for entity: Application\Entity\Items#0000000041f6e49000000000651183aa. To solve this issue: Either explicitly call EntityManager#persist() on this unknown entity or configure cascade persist this association in the mapping for example #ManyToOne(..,cascade={"persist"}). If you cannot find out which entity causes the problem implement 'Application\Entity\Items#__toString()' to get a clue.
But this is no new entity. All data are correctly set and as I wrote, if I add e new receipt all works fine.

Adding New Artifact Types and New Record to Artifact Types in WSO2 Gov. Reg 4.6

I am getting an error when adding a new record to a new artifact type I created. The error is as follows
failed to add/edit artifact details. A valid qualified name was not set for this artifact
I created a new artifact type called 'Domain'. The artifact type was added but I cannot add new records to it. Get the same error as above when I add new record to Domain artifact type. My xml is attached.
<?xml version="1.0"?>
<artifactType type="application/vnd.wso2-domain+xml" shortName="domain" singularLabel="Domain" pluralLabel="Domains" hasNamespace="false" iconSet="9">
<storagePath>/domains/#{overview_domain}/#{overview_parentname}/domain</storagePath>
<nameAttribute>overview_domain</nameAttribute>
<ui>
<list>
<column name="Domain">
<data type="text" value="overview_domain"/>
</column>
<column name="Parent Domain">
<data type="text" value="overview_parentname"/>
</column>
</list>
</ui>
<content>
<table name="Domain">
<field type="options" required="true">
<name label="Domain Name">Domain Name</name>
<values>
<value>Research</value>
<value>Development</value>
<value>Medicine</value>
<value>Marketing and Sales</value>
<value>Operations</value>
<value>Enabling Functions</value>
<value>Communications</value>
<value>Human Resources</value>
<value>Finance</value>
<value>Legal</value>
<value>Purchasing</value>
<value>Information Systems</value>
</values>
</field>
<field type="options">
<name label="Parent Domain Name">Parent Domain Name</name>
<values>
<value/>
<value>Research</value>
<value>Development</value>
<value>Medicine</value>
<value>Marketing and Sales</value>
<value>Operations</value>
<value>Enabling Functions</value>
<value>Communications</value>
<value>Human Resources</value>
<value>Finance</value>
<value>Legal</value>
<value>Purchasing</value>
<value>Information Systems</value>
</values>
</field>
</table>
</content>
</artifactType>
Also I want to know if there is a thorough document describing how to add artifact types and records. As an example I added a storage path called
/domains/#{overview_domain}/#{overview_parentname}/domain
but I do not know where this points to and if this is even valid or not. The documentation in the online help is not adequate enough to add new artifact structures and records.
Thanks
Under the <ui> tag you have listed two columns. The value attribute given to each column must be in the format {basetable}_{fieldname}
Therefor the names given under each <field> must match with the value <data attribute= of corresponding <column> under <ui>.
To get rid of the error, change the name of the first field to be "Domain" so that it matches with the name that you have given in the column(i.e. overview_domain). So that the tag of the first should look like
<name label="Domain Name">Domain</name>
You should do the same for the second field too, so that the of second field must look as follows
<name label="Parent Domain Name">ParentName</name>
Kindly find the corrected domain.rxt.
To create your own RXTs please find this article.
<?xml version="1.0"?>
<artifactType type="application/vnd.wso2-domain+xml" shortName="domain" singularLabel="Domain" pluralLabel="Domains" hasNamespace="false" iconSet="9">
<storagePath>/domains/#{overview_domain}/#{overview_parentname}/domain</storagePath>
<nameAttribute>overview_domain</nameAttribute>
<ui>
<list>
<column name="Domain">
<data type="text" value="overview_domain"/>
</column>
<column name="Parent Domain">
<data type="path" value="overview_parentname" href="#{storagePath}"/>
</column>
</list>
</ui>
<content>
<table name="Overview">
<field type="options" required="true">
<name label="Domain Name">domain</name>
<values>
<value>Research</value>
<value>Development</value>
<value>Medicine</value>
<value>Marketing and Sales</value>
<value>Operations</value>
<value>Enabling Functions</value>
<value>Communications</value>
<value>Human Resources</value>
<value>Finance</value>
<value>Legal</value>
<value>Purchasing</value>
<value>Information Systems</value>
</values>
</field>
<field type="options">
<name label="Parent Domain Name">parentname</name>
<values>
<value/>
<value>Research</value>
<value>Development</value>
<value>Medicine</value>
<value>Marketing and Sales</value>
<value>Operations</value>
<value>Enabling Functions</value>
<value>Communications</value>
<value>Human Resources</value>
<value>Finance</value>
<value>Legal</value>
<value>Purchasing</value>
<value>Information Systems</value>
</values>
</field>
</table>
</content>
</artifactType>

flow in model-glue event handler

Can any body help me to understand the flow of model-glue event handler......its so confusing or simplify bellow code......
<event-handler name="Shipment.List" type="templatedPage">
<broadcasts>
<message name="needShipmentList" />
</broadcasts>
<views>
<include name="Primary" template="List.Shipment.cfm">
<value name="xe_Display" value="Shipment.Display" />
<value name="xe_Form" value="Shipment.Form" />
</include>
</views>
</event-handler>
<event-handler name="Shipment.Display" type="templatedPage">
<broadcasts>
<message name="needShipmentDetail" />
</broadcasts>
<views>
<include name="primary" template="Display.Shipment.cfm">
<value name="xe_ShipmentList" value="Shipment.List" />
<value name="xe_ItemForm" value="Item.Form" />
<value name="xe_ShipmentDisplay" value="Shipment.Display" />
<value name="xe_ItemRemove" value="doItem.Remove" />
</include>
</views>
</event-handler>
When you call for event "Shipment.List", it will broadcasts "needShipmentList" function of ShipmentController, after execution it will return on List.Shipment.cfm from on "Primary" layout of master page.
"List.Shipment.cfm" has a link whicj is triggered for needShipmentDetail function
"List.Shipment.cfm" fatches values from "Shipment.Display"-->needShipmentDetail
on display page(Display.Shipment.cfm), there are some links for remove, for listing...etc
"xe" is a convention for eXit Events