Spark SQL Analysis Exception cannot resolve column name "Sepal.Length"
Closed this issue · 3 comments
Hi folks,
I was trying to deploy the neural network Iris pmml model by using spark and i am facing issue Sparksql analysis exception cannot resolve column name "Sepal.Length" and for more info i am attaching the screenshot of the error can you please help me in figuring out this ......
Neural Network iris model i used
<?xml version="1.0" encoding="UTF-8"?>
<PMML version="4.0" xmlns="http://www.dmg.org/PMML-4_0">
<Header copyright="morent">
<Application name="KNIME" version="2.4.1"/>
</Header>
<DataDictionary numberOfFields="5">
<DataField name="sepal_length" optype="continuous" dataType="double">
<Interval closure="closedClosed" leftMargin="4.3" rightMargin="7.9"/>
</DataField>
<DataField name="sepal_width" optype="continuous" dataType="double">
<Interval closure="closedClosed" leftMargin="2.0" rightMargin="4.4"/>
</DataField>
<DataField name="petal_length" optype="continuous" dataType="double">
<Interval closure="closedClosed" leftMargin="1.0" rightMargin="6.9"/>
</DataField>
<DataField name="petal_width" optype="continuous" dataType="double">
<Interval closure="closedClosed" leftMargin="0.1" rightMargin="2.5"/>
</DataField>
<DataField name="class" optype="categorical" dataType="string">
<Value value="Iris-setosa"/>
<Value value="Iris-versicolor"/>
<Value value="Iris-virginica"/>
</DataField>
</DataDictionary>
<NeuralNetwork functionName="classification" algorithmName="RProp" activationFunction="logistic" normalizationMethod="none" width="0.0" numberOfLayers="2">
<MiningSchema>
<MiningField name="sepal_length" invalidValueTreatment="asIs"/>
<MiningField name="sepal_width" invalidValueTreatment="asIs"/>
<MiningField name="petal_length" invalidValueTreatment="asIs"/>
<MiningField name="petal_width" invalidValueTreatment="asIs"/>
<MiningField name="class" invalidValueTreatment="asIs" usageType="predicted"/>
</MiningSchema>
<NeuralInputs numberOfInputs="4">
<NeuralInput id="0,0">
<DerivedField optype="continuous" dataType="double">
<FieldRef field="sepal_length"/>
</DerivedField>
</NeuralInput>
<NeuralInput id="0,1">
<DerivedField optype="continuous" dataType="double">
<FieldRef field="sepal_width"/>
</DerivedField>
</NeuralInput>
<NeuralInput id="0,2">
<DerivedField optype="continuous" dataType="double">
<FieldRef field="petal_length"/>
</DerivedField>
</NeuralInput>
<NeuralInput id="0,3">
<DerivedField optype="continuous" dataType="double">
<FieldRef field="petal_width"/>
</DerivedField>
</NeuralInput>
</NeuralInputs>
<NeuralLayer>
<Neuron id="1,0" bias="-0.9441846137121959">
<Con from="0,0" weight="-0.04486308459743835"/>
<Con from="0,1" weight="-1.007767488246452"/>
<Con from="0,2" weight="0.4116250900429575"/>
<Con from="0,3" weight="1.209150565102718"/>
</Neuron>
<Neuron id="1,1" bias="-1.5806031030377694">
<Con from="0,0" weight="0.33364337105537917"/>
<Con from="0,1" weight="2.454247860268515"/>
<Con from="0,2" weight="-0.15509338500436265"/>
<Con from="0,3" weight="-1.8389081867014756"/>
</Neuron>
<Neuron id="1,2" bias="-2.7781887628433255">
<Con from="0,0" weight="0.6896588815822495"/>
<Con from="0,1" weight="0.4155487213880096"/>
<Con from="0,2" weight="-0.4693479739569995"/>
<Con from="0,3" weight="0.024472433148318866"/>
</Neuron>
<Neuron id="1,3" bias="-1.8804828048612006">
<Con from="0,0" weight="-0.046367292285697366"/>
<Con from="0,1" weight="0.15139622470906453"/>
<Con from="0,2" weight="0.15126787451340934"/>
<Con from="0,3" weight="0.5798317894556151"/>
</Neuron>
<Neuron id="1,4" bias="-1.0479686251266709">
<Con from="0,0" weight="0.3022349918305707"/>
<Con from="0,1" weight="0.5696576400734125"/>
<Con from="0,2" weight="-1.0984794716289736"/>
<Con from="0,3" weight="-0.27270023464908766"/>
</Neuron>
<Neuron id="1,5" bias="-0.3025179949964037">
<Con from="0,0" weight="-0.22289067665818585"/>
<Con from="0,1" weight="-0.5029455541094195"/>
<Con from="0,2" weight="0.6748013255475972"/>
<Con from="0,3" weight="0.2769427141691832"/>
</Neuron>
<Neuron id="1,6" bias="0.5185804721896162">
<Con from="0,0" weight="-0.06630369718678882"/>
<Con from="0,1" weight="0.9366878508504322"/>
<Con from="0,2" weight="-2.0505238545746756"/>
<Con from="0,3" weight="-1.4180466765594852"/>
</Neuron>
<Neuron id="1,7" bias="-0.14392081477403149">
<Con from="0,0" weight="0.47767196169403736"/>
<Con from="0,1" weight="0.9231599358415787"/>
<Con from="0,2" weight="-1.521293106276155"/>
<Con from="0,3" weight="-0.9151590899627176"/>
</Neuron>
<Neuron id="1,8" bias="-1.1991037918096945">
<Con from="0,0" weight="-0.0368452580731863"/>
<Con from="0,1" weight="-0.6438633470456006"/>
<Con from="0,2" weight="0.09328089052662898"/>
<Con from="0,3" weight="1.6829695286970527"/>
</Neuron>
<Neuron id="1,9" bias="-0.07098521306546789">
<Con from="0,0" weight="1.1130349585302026"/>
<Con from="0,1" weight="-0.37623467152890655"/>
<Con from="0,2" weight="-1.0691145207939827"/>
<Con from="0,3" weight="-0.6233268000787716"/>
</Neuron>
</NeuralLayer>
<NeuralLayer>
<Neuron id="2,0" bias="-0.5982891836398166">
<Con from="1,0" weight="-131.91572569969986"/>
<Con from="1,1" weight="-2.0803811849944296"/>
<Con from="1,2" weight="-0.6084039564897556"/>
<Con from="1,3" weight="-1.066354849840332"/>
<Con from="1,4" weight="1.7727568679658863"/>
<Con from="1,5" weight="-8.098634498899418"/>
<Con from="1,6" weight="19.128469000024445"/>
<Con from="1,7" weight="47.99808211407523"/>
<Con from="1,8" weight="-48.02276063336108"/>
<Con from="1,9" weight="0.8376316854289872"/>
</Neuron>
<Neuron id="2,1" bias="0.6887290187921082">
<Con from="1,0" weight="-16.591716865586278"/>
<Con from="1,1" weight="0.7787222775775234"/>
<Con from="1,2" weight="-0.21185970643262134"/>
<Con from="1,3" weight="-0.5385365682832596"/>
<Con from="1,4" weight="0.1494344843029574"/>
<Con from="1,5" weight="-0.2908246414912338"/>
<Con from="1,6" weight="-209.54696149112175"/>
<Con from="1,7" weight="41.03251658642203"/>
<Con from="1,8" weight="-4.481423572323473"/>
<Con from="1,9" weight="20.57673314463075"/>
</Neuron>
<Neuron id="2,2" bias="-0.33370153632947136">
<Con from="1,0" weight="3.284832540721896"/>
<Con from="1,1" weight="1.2279556829167277"/>
<Con from="1,2" weight="0.7602122721765426"/>
<Con from="1,3" weight="1.1997577238312889"/>
<Con from="1,4" weight="-11.325671536250567"/>
<Con from="1,5" weight="1.483961591977191"/>
<Con from="1,6" weight="-1821.8108555592457"/>
<Con from="1,7" weight="-148.9767379958393"/>
<Con from="1,8" weight="6.619929393199292"/>
<Con from="1,9" weight="-8.681838533973998"/>
</Neuron>
</NeuralLayer>
<NeuralOutputs numberOfOutputs="3">
<NeuralOutput outputNeuron="2,0">
<DerivedField optype="categorical" dataType="string">
<NormDiscrete field="class" value="Iris-setosa"/>
</DerivedField>
</NeuralOutput>
<NeuralOutput outputNeuron="2,1">
<DerivedField optype="categorical" dataType="string">
<NormDiscrete field="class" value="Iris-versicolor"/>
</DerivedField>
</NeuralOutput>
<NeuralOutput outputNeuron="2,2">
<DerivedField optype="categorical" dataType="string">
<NormDiscrete field="class" value="Iris-virginica"/>
</DerivedField>
</NeuralOutput>
</NeuralOutputs>
</NeuralNetwork>
</PMML>
There is no class org.jpmml.spark.PMMLPredictionModel
in the JPMML-Spark codebase anymore. Please upgrade.
Does your input DataFrame contain sepal_length
, sepal_width
, petal_length
and petal_width
columns? The provided NN model needs these four input columns. If they cannot be found, then the model cannot be evaluated.
Your stack trace doesn't seem legit, because it refers to Sepal.Length
column (note the capitalization, and the use of the dot character .
as a separator instead of the underscore _
character).