0

我的 pmml 中有派生字段,我想将它们用作输出字段。所以我想从派生字段中引用输出字段。但是 sas 应用程序会引发错误。错误是:

错误:未定义变量 Z_DD_OCCUPATION_ID。

如何从派生字段设置输出字段?这是我的 pmml 不起作用

<?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>

如果我使用数据字典列而不是派生字段,它会完美运行。

例如,如果我转换

    <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>

<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>

有用。因为在这种情况下,我从 datadictionary 列中引用 outputfield。但实际上我需要在输出字段中使用派生字段。如何从派生字段中引用输出字段?

4

1 回答 1

1

您需要将派生字段从LocalTransformations(即本地范围)移动到TransformationDictionary(即全局范围)。

PMML 4.2 不允许从输出字段引用本地派生字段。“逻辑”是您不能在 PMML 解析器看到之前引用一个字段。在您的示例中,OutputField@name=out_1元素出现在DerivedField@name=Z_DD_OCCUPATION_ID元素之前。

PMML 4.3 放宽了这个规则。有关详细信息,请参阅http://mantis.dmg.org/view.php?id=142

于 2016-08-25T19:55:43.523 回答