"Couldnot read from XML stream"

happydusthappydust Member Posts: 10 Contributor II
edited May 2019 in Help
I am trying to read this mod file and load the model from it. I keep getting those error messages telling me it cant read XML file,and telling me what jar files were missing.
so i added all the Jar it asked for, and finally i reached the point there is no further explanation and i couldnt go any further. Does anybody know what is happening?here is the final error message.

Could not read file 'D:\Study\workspace\org.reqmon.rapidminer.plugin\resources\xml\model.mod': Cannot read from XML stream, wrong format: com.rapidminer.operator.ContainerModel : com.rapidminer.operator.ContainerModel.

and here is my code -- I basically copied this from somewhere, and am not sure if that is the correct way to do it.
public class ReadModelTest {

//private OperatorChain wvtoolOperator;
//private Operator modelApplier;
private TreeModel model;
/*
* This test runs the DBDecisionTree.xml process which runs
* a Decision Tree learning model against the RapidMiner golf
* data.  It tests that the service object returns a proper
* IOContainer containing the expected performance vector and
* model classes.  It also iterates through the resulting objects
* and tests the RapidMiner API.
*/
@Test
//private OperatorDescription OperatorDescription;
  public void ReadModelTest()throws IOException, OperatorCreationException, OperatorException{
 

File modelFile=new File("resources\\xml\\model.mod\\");


RapidMiner.init();

Operator modelLoader = OperatorService.createOperator("ModelLoader");

modelLoader.setParameter(ModelLoader.PARAMETER_MODEL_FILE, modelFile.getAbsolutePath());
IOContainer container = modelLoader.apply(new IOContainer());
model = container.get(TreeModel.class);
assertNotNull(model);

    Tree root = model.getRoot();
    assertNotNull(root);
   
 
    System.out.println("lable is"+root.getLabel());// try to show the root label
//return model;
    }
 

  public static void main(String args[]) throws Exception {

// Create a text classifier 
ReadModelTest tr = new ReadModelTest();

// Call the classifier with texts




}


}
I'd reallly appreciate if someone can help me:)

happydust
Tagged:

Answers

  • landland RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 2,531 Unicorn
    Hi,
    did you check if your model file simply exists? If yes, does it load, if you try using the rapid miner api?

    Greetings,
      Sebastian
Sign In or Register to comment.