Skip to content

Instantly share code, notes, and snippets.

@cheesinglee
Created May 30, 2018 06:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cheesinglee/53f77cecf86666a1f103f55c8c1e53ef to your computer and use it in GitHub Desktop.
Save cheesinglee/53f77cecf86666a1f103f55c8c1e53ef to your computer and use it in GitHub Desktop.
BigML logistic regression model for iris, PMML export
<?xml version="1.0" encoding="UTF-8"?><PMML xmlns="http://www.dmg.org/PMML-4_3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="4.3">
<Header description="Model kind: logistic">
<Application name="BigML"/>
</Header>
<DataDictionary>
<DataField name="sepal length" displayName="" optype="continuous" dataType="double">
<Extension name="BigML-Field_ID" value="000000"/>
</DataField>
<DataField name="sepal width" displayName="" optype="continuous" dataType="double">
<Extension name="BigML-Field_ID" value="000001"/>
</DataField>
<DataField name="petal length" displayName="" optype="continuous" dataType="double">
<Extension name="BigML-Field_ID" value="000002"/>
</DataField>
<DataField name="petal width" displayName="" optype="continuous" dataType="double">
<Extension name="BigML-Field_ID" value="000003"/>
</DataField>
<DataField name="species" displayName="" optype="categorical" dataType="string">
<Extension name="BigML-Field_ID" value="000004"/>
<Value value="Iris-setosa"/>
<Value value="Iris-versicolor"/>
<Value value="Iris-virginica"/>
</DataField>
</DataDictionary>
<MiningModel modelName="" functionName="classification">
<MiningSchema>
<MiningField name="sepal length"/>
<MiningField name="sepal width"/>
<MiningField name="petal length"/>
<MiningField name="petal width"/>
<MiningField name="species" usageType="target"/>
</MiningSchema>
<Output>
<OutputField optype="continuous" dataType="double" targetField="species" feature="probability" name="log-odds-Iris-setosa" value="Iris-setosa"/>
<OutputField optype="continuous" dataType="double" targetField="species" feature="probability" name="log-odds-Iris-versicolor" value="Iris-versicolor"/>
<OutputField optype="continuous" dataType="double" targetField="species" feature="probability" name="log-odds-Iris-virginica" value="Iris-virginica"/>
</Output>
<MiningSchema>
<MiningField name="sepal length"/>
<MiningField name="sepal width"/>
<MiningField name="petal length"/>
<MiningField name="petal width"/>
<MiningField name="species" usageType="target"/>
</MiningSchema>
<LocalTransformations>
<DerivedField name="sepal length-missing" optype="categorical" dataType="string">
<MapValues mapMissingTo="true" defaultValue="false" outputColumn="none">
<FieldColumnPair field="sepal length" column="none"/>
</MapValues>
</DerivedField>
<DerivedField name="sepal width-missing" optype="categorical" dataType="string">
<MapValues mapMissingTo="true" defaultValue="false" outputColumn="none">
<FieldColumnPair field="sepal width" column="none"/>
</MapValues>
</DerivedField>
<DerivedField name="petal length-missing" optype="categorical" dataType="string">
<MapValues mapMissingTo="true" defaultValue="false" outputColumn="none">
<FieldColumnPair field="petal length" column="none"/>
</MapValues>
</DerivedField>
<DerivedField name="petal width-missing" optype="categorical" dataType="string">
<MapValues mapMissingTo="true" defaultValue="false" outputColumn="none">
<FieldColumnPair field="petal width" column="none"/>
</MapValues>
</DerivedField>
<DerivedField name="species-Iris-setosa" optype="categorical" dataType="string">
<MapValues mapMissingTo="true" defaultValue="false" outputColumn="binarized">
<FieldColumnPair field="species" column="species"/>
<InlineTable>
<row><species>"Iris-setosa"</species><binarized>"Iris-setosa"</binarized></row>
<row><species>"Iris-versicolor"</species><binarized>"not-Iris-setosa"</binarized></row>
<row><species>"Iris-virginica"</species><binarized>"not-Iris-setosa"</binarized></row>
</InlineTable>
</MapValues>
</DerivedField>
<DerivedField name="species-Iris-versicolor" optype="categorical" dataType="string">
<MapValues mapMissingTo="true" defaultValue="false" outputColumn="binarized">
<FieldColumnPair field="species" column="species"/>
<InlineTable>
<row><species>"Iris-setosa"</species><binarized>"not-Iris-versicolor"</binarized></row>
<row><species>"Iris-versicolor"</species><binarized>"Iris-versicolor"</binarized></row>
<row><species>"Iris-virginica"</species><binarized>"not-Iris-versicolor"</binarized></row>
</InlineTable>
</MapValues>
</DerivedField>
<DerivedField name="species-Iris-virginica" optype="categorical" dataType="string">
<MapValues mapMissingTo="true" defaultValue="false" outputColumn="binarized">
<FieldColumnPair field="species" column="species"/>
<InlineTable>
<row><species>"Iris-setosa"</species><binarized>"not-Iris-virginica"</binarized></row>
<row><species>"Iris-versicolor"</species><binarized>"not-Iris-virginica"</binarized></row>
<row><species>"Iris-virginica"</species><binarized>"Iris-virginica"</binarized></row>
</InlineTable>
</MapValues>
</DerivedField>
</LocalTransformations>
<Segmentation multipleModelMethod="selectAll">
<Segment id="Iris-setosa">
<True/>
<RegressionModel functionName="classification" modelType="logisticRegression" normalizationMethod="softmax" modelName=" Iris-setosa">
<MiningSchema>
<MiningField name="sepal length"/>
<MiningField name="sepal width"/>
<MiningField name="petal length"/>
<MiningField name="petal width"/>
<MiningField name="species-Iris-setosa" usageType="target"/>
</MiningSchema>
<RegressionTable targetCategory="Iris-setosa" intercept="0">
<NumericPredictor name="sepal length" coefficient="0.446112"/>
<NumericPredictor name="sepal width" coefficient="1.48875"/>
<NumericPredictor name="petal length" coefficient="-2.26038"/>
<NumericPredictor name="petal width" coefficient="-1.02462"/>
<CategoricalPredictor name="sepal length-missing" value="true" coefficient="0"/>
<CategoricalPredictor name="sepal width-missing" value="true" coefficient="0"/>
<CategoricalPredictor name="petal length-missing" value="true" coefficient="0"/>
<CategoricalPredictor name="petal width-missing" value="true" coefficient="0"/>
</RegressionTable>
<RegressionTable targetCategory="not-Iris-setosa" intercept="0"/>
</RegressionModel>
</Segment>
<Segment id="Iris-versicolor">
<True/>
<RegressionModel functionName="classification" modelType="logisticRegression" normalizationMethod="softmax" modelName=" Iris-versicolor">
<MiningSchema>
<MiningField name="sepal length"/>
<MiningField name="sepal width"/>
<MiningField name="petal length"/>
<MiningField name="petal width"/>
<MiningField name="species-Iris-versicolor" usageType="target"/>
</MiningSchema>
<RegressionTable targetCategory="Iris-versicolor" intercept="0">
<NumericPredictor name="sepal length" coefficient="0.580767"/>
<NumericPredictor name="sepal width" coefficient="-1.49776"/>
<NumericPredictor name="petal length" coefficient="0.547438"/>
<NumericPredictor name="petal width" coefficient="-1.44438"/>
<CategoricalPredictor name="sepal length-missing" value="true" coefficient="0"/>
<CategoricalPredictor name="sepal width-missing" value="true" coefficient="0"/>
<CategoricalPredictor name="petal length-missing" value="true" coefficient="0"/>
<CategoricalPredictor name="petal width-missing" value="true" coefficient="0"/>
</RegressionTable>
<RegressionTable targetCategory="not-Iris-versicolor" intercept="0"/>
</RegressionModel>
</Segment>
<Segment id="Iris-virginica">
<True/>
<RegressionModel functionName="classification" modelType="logisticRegression" normalizationMethod="softmax" modelName=" Iris-virginica">
<MiningSchema>
<MiningField name="sepal length"/>
<MiningField name="sepal width"/>
<MiningField name="petal length"/>
<MiningField name="petal width"/>
<MiningField name="species-Iris-virginica" usageType="target"/>
</MiningSchema>
<RegressionTable targetCategory="Iris-virginica" intercept="0">
<NumericPredictor name="sepal length" coefficient="-1.8639"/>
<NumericPredictor name="sepal width" coefficient="-1.64704"/>
<NumericPredictor name="petal length" coefficient="2.47839"/>
<NumericPredictor name="petal width" coefficient="2.59359"/>
<CategoricalPredictor name="sepal length-missing" value="true" coefficient="0"/>
<CategoricalPredictor name="sepal width-missing" value="true" coefficient="0"/>
<CategoricalPredictor name="petal length-missing" value="true" coefficient="0"/>
<CategoricalPredictor name="petal width-missing" value="true" coefficient="0"/>
</RegressionTable>
<RegressionTable targetCategory="not-Iris-virginica" intercept="0"/>
</RegressionModel>
</Segment>
</Segmentation>
</MiningModel>
</PMML>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment