question about reading a mod file

happydusthappydust MemberPosts:10Contributor II
edited November 2018 inHelp
HI guys, i am new here, and i just started a week ago.
I am right now need to write a JAVA application for my boss. I tried to read a mod file my colleague has generated using decision tree process and get a treemodel from it.
Here is the code i used:

File modelFile=new File("resources\\xml\\DBDecisionTree3.xml\\");
TreeModel model;
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);

My question is (1) is this the way i get a tree from a mod file?
(2) i got the error saying "cannot read object from XML serialization" what should i do, should i add some jar?


Thanks! And sorry if my post is not clear enough. THnaks for your help!

happydust
Tagged:

Answers

  • landland RapidMiner Certified Analyst, RapidMiner Certified Expert, MemberPosts:2,531Unicorn
    Hi,
    在我看来,有一个deserializin问题g the object. Did your college used the XML export format of the IOObjectWriter? And do you two have the same rapidminer versions?

    RapidMiner must lie in a directory, containing all the libraries coming together with rapid miner.

    Greetings,
    Sebastian
  • happydusthappydust MemberPosts:10Contributor II
    hi Sebastian
    Thank you for your replying! I am not sure what you meant by deserializing the object?

    And also you asked about if my colleague used XML export format of the IOObjectWriter? I am not sure i understand it, all I know was, he used a process xml file, which was supported by the data stream plugin, so in that process file, he dealt with more than one file and used a fixed window size. And the algorithm he deployed was decision tree. So after using the xml file, several mod files were generated, and those mod files are the one i need to get the treemodel from.

    In terms of versions, i asked him his version, and it was different. So i uninstalled mine, and installed his. And then i copied the new RapidMiner.jar into the library of my project. but it still did not work. Is there some step i missed? Should i copy more than one jar, and is there a paticular folder i should place them in?

    Thank you so much for your help!

  • landland RapidMiner Certified Analyst, RapidMiner Certified Expert, MemberPosts:2,531Unicorn
    Hi,
    if you use the DataStream plugin, your version of RapidMiner seems to be rather old. I think I was a student back then, when it was decided to remove the support for this plugin, so I can only guess whats going wrong with your mod file. I would recommend to try the following:
    Start the rapid miner gui, load the process of your college and rebuild the model files with your version. Then retry loading it in your program, or start with reloading it in an process inside the gui.

    Greetings,
    Sebastian
Sign InorRegisterto comment.