<PMML version="4.0" xsi:schemaLocation="http://www.dmg.org/PMML-4_0 http://www.dmg.org/v4-0/pmml-4-0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.dmg.org/PMML-4_0">
  <Header copyright="Zementis, Inc." description="Sample Scorecard">
    <Timestamp>2010-02-20T08:17:10.8</Timestamp>
  </Header>
  <DataDictionary>
    <DataField dataType="string" name="var1" optype="categorical"/>
    <DataField dataType="double" name="var2" optype="continuous"/>
    <DataField dataType="double" name="overallScore" optype="continuous"/>
  </DataDictionary>
  <RegressionModel functionName="regression" modelName="SampleScorecard">
    <MiningSchema>
      <MiningField invalidValueTreatment="asMissing" name="var1" usageType="active"/>
      <MiningField invalidValueTreatment="asMissing" name="var2" usageType="active"/>
      <MiningField name="overallScore" usageType="predicted"/>
    </MiningSchema>
    <LocalTransformations>
      <DerivedField dataType="double" name="derivedVar1" optype="continuous">
        <MapValues dataType="integer" defaultValue="0" mapMissingTo="-9" outputColumn="allocation">
          <FieldColumnPair column="type" field="var1"/>
          <InlineTable>
            <row>
              <type>positive</type>
              <allocation>19</allocation>
            </row>
            <row>
              <type>negative</type>
              <allocation>3</allocation>
            </row>
            <row>
              <type>neutral</type>
              <allocation>6</allocation>
            </row>
          </InlineTable>
        </MapValues>
      </DerivedField>
      <DerivedField dataType="integer" name="derivedVar2a" optype="continuous">
        <Discretize dataType="integer" field="var2" mapMissingTo="-1">
          <DiscretizeBin binValue="-3">
            <Interval closure="openOpen" rightMargin="100"/>
          </DiscretizeBin>
          <DiscretizeBin binValue="0">
            <Interval closure="closedOpen" leftMargin="100" rightMargin="200"/>
          </DiscretizeBin>
          <DiscretizeBin binValue="11">
            <Interval closure="closedOpen" leftMargin="200"/>
          </DiscretizeBin>
        </Discretize>
      </DerivedField>
      <DerivedField dataType="double" name="derivedVar2b" optype="continuous">
        <Apply function="if">
          <Apply function="isMissing">
            <FieldRef field="var2"/>
          </Apply>
          <!--THEN-->
          <Constant>5</Constant>
          <!--ELSE-->
          <Apply function="if">
            <Apply function="lessThan">
              <FieldRef field="var2"/>
              <Constant>100</Constant>
            </Apply>
            <!--THEN-->
            <Apply function="+">
              <Apply function="*">
                <Constant>0.08</Constant>
                <FieldRef field="var2"/>
              </Apply>
              <Constant>12</Constant>
            </Apply>
            <!--ELSE-->
            <Apply function="if">
              <Apply function="lessThan">
                <FieldRef field="var2"/>
                <Constant>200</Constant>
              </Apply>
              <!--THEN-->
              <Apply function="+">
                <Apply function="*">
                  <Constant>0.15</Constant>
                  <FieldRef field="var2"/>
                </Apply>
                <Constant>4</Constant>
              </Apply>
              <!--ELSE-->
              <Constant>-9</Constant>
            </Apply>
          </Apply>
        </Apply>
      </DerivedField>
    </LocalTransformations>
    <RegressionTable intercept="0">
      <NumericPredictor coefficient="1" name="derivedVar1"/>
      <NumericPredictor coefficient="1" name="derivedVar2a"/>
      <NumericPredictor coefficient="1" name="derivedVar2b"/>
    </RegressionTable>
  </RegressionModel>
</PMML>
