Error reading a classifier saved in default (xml compressed) or binary formats

szabel
szabel New Altair Community Member
edited November 2024 in Community Q&A
Version: Rapid Miner 4.4 (Yes I know that its an old version)

Error:
com.rapidminer.operator.UserError: Could not read file '<omitted>/RapidMinerData/Test/cl
assifier.mod': Cannot read from XML stream, wrong format:  : only whitespace content allowed before start tag and not
? (position: START_DOCUMENT seen ?... @1:1) .
        at com.rapidminer.operator.io.ModelLoader.apply(ModelLoader.java:97)
        at com.rapidminer.operator.Operator.apply(Operator.java:666)
        at com.rapidminer.operator.OperatorChain.apply(OperatorChain.java:416)
        at com.rapidminer.operator.Operator.apply(Operator.java:666)
        at com.rapidminer.Process.run(Process.java:695)
        at com.rapidminer.Process.run(Process.java:665)
        at com.rapidminer.Process.run(Process.java:655)
        at machine_learning_service.RapidMinerTester.test(RapidMinerTester.java:139)
        at machine_learning_service.Candidate.act(Candidate.java:352)
        at machine_learning_service.RapidMinerService.main(RapidMinerService.java:307)
Caused by: java.io.StreamCorruptedException: invalid stream header: 3F080000
        at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:781)
        at java.io.ObjectInputStream.<init>(ObjectInputStream.java:278)
        at com.rapidminer.operator.io.ModelLoader.apply(ModelLoader.java:76)
        ... 9 more

This happens when I change the process config xml
<?xml version="1.0" encoding="UTF-8"?>
<operator name="Root" class="Process" expanded="yes">
    <parameter key="logverbosity" value="off"/>   
    <operator name="Input" class="ExampleSource">
        <parameter key="attributes" value="<omitted>/RapidMinerData/Train/AttributeDescriptors/test.aml"/>
    </operator>
    <operator name="NaiveBayes" class="NaiveBayes">
    </operator>
    <operator name="ModelWriter" class="ModelWriter">
        <parameter key="model_file" value="<omitted>/RapidMinerData/Train/classifier_return.mod"/>
      <parameter key="output_type"    value="XML"/>
    </operator>
</operator>

and am reading in using

<?xml version="1.0" encoding="UTF-8"?>

<operator name = "Root" class="Process" expanded="yes">
   
    <parameter key="logverbosity"  value="off"/>
   
    <operator name="Input" class="ExampleSource">
        <parameter key="attributes" value="<omitted>/RapidMinerData/Test/AttributeDescriptors/test.aml"/>
    </operator>
   
    <operator name="ModelLoader" class="ModelLoader">
        <parameter key="model_file" value="<omitted>/RapidMinerData/Test/classifier.mod"/>
    </operator>
   
    <operator name="Applier" class="ModelApplier">
        <list key="application_parameters">
        </list>
    </operator>
   
    <operator name="BinominalClassificationPerformance" class="BinominalClassificationPerformance">
        <parameter key="false_negative" value="true"/>
        <parameter key="false_positive" value="true"/>
        <parameter key="sensitivity" value="true"/>
        <parameter key="specificity" value="true"/>
        <parameter key="true_negative" value="true"/>
        <parameter key="true_positive" value="true"/>
    </operator>
   
    <operator name="ProcessLog" class="ProcessLog">
        <parameter key="filename" value="<omitted>/RapidMinerData/Test/statistics.per"/>
        <list key="log">
          <parameter key="false_positive"      value="operator.BinominalClassificationPerformance.value.false_positive"/>
          <parameter key="false_negative" value="operator.BinominalClassificationPerformance.value.false_negative"/>
          <parameter key="true_positive" value="operator.BinominalClassificationPerformance.value.true_positive"/>
          <parameter key="true_negative" value="operator.BinominalClassificationPerformance.value.true_negative"/>
 
          <!--<parameter key="AUC" value="operator.BinominalClassificationPerformance.value.AUC"/>-->
 
          <parameter key="sensitivity" value="operator.BinominalClassificationPerformance.value.sensitivity"/>
          <parameter key="specificity" value="operator.BinominalClassificationPerformance.value.specificity"/>
        </list>
        <parameter key="persistent" value="true"/>
    </operator>

</operator>


Any help will be greatly appreciated

Welcome!

It looks like you're new here. Sign in or register to get started.

Answers

  • homburg
    homburg New Altair Community Member
    Hello szabel,

    is
     '<omitted>/RapidMinerData/Test/classifier.mod'
    really your file system input path? This might be problematic due to the "<" ">" characters in the xml file. Please try a full qualified path insted.

    Cheers,
    Helge
  • szabel
    szabel New Altair Community Member
    No,  <omitted> is not actually there. I had to obfuscate some of the example... There is an actual valid path there and valid permissions; the only change is that I am taking the default (Zipped XML) and not specifying plain vanilla XML.

    Thank you,
    Stephen
  • homburg
    homburg New Altair Community Member
    Looks like your model file is broken. Have you tried to recreate it?
    Another option might be that there has been a bug in the model writer those days. I'd highly recommend to upgrade to a more recent version. RapidMiner 5.3 is open source and freely available without any restrictions: http://sourceforge.net/projects/rapidminer/

    Cheers,
    Helge
  • szabel
    szabel New Altair Community Member
    Yeah, I can try that... I was hoping that since it works when specifying XML that I was just missing a parameter that I was not seeing in the documentation.

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.