The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
"Couldnot read from XML stream"
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.
happydust
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 {I'd reallly appreciate if someone can help me:)
//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
}
}
happydust
0
Answers
did you check if your model file simply exists? If yes, does it load, if you try using the rapid miner api?
Greetings,
Sebastian