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
How to incapsulate data in IOContainer
Hi i have extract a model file from a process.
I want load the model and apply this model to data that i calculate a runtime.
The data are all integer value.
My code is
RapidMiner.init();
//create the operator for apply model
Operator testSource = OperatorService.createOperator(ModelApplier.class);
//create the operator for load the model
Operator loadModel= OperatorService.createOperator(ModelLoader.class);
then i have to load the model and this is not a problem.
My problem is
" How i can incapsulate a set of number in an IOContainer for using this as input of the Model?"
Thank you very much
I want load the model and apply this model to data that i calculate a runtime.
The data are all integer value.
My code is
RapidMiner.init();
//create the operator for apply model
Operator testSource = OperatorService.createOperator(ModelApplier.class);
//create the operator for load the model
Operator loadModel= OperatorService.createOperator(ModelLoader.class);
then i have to load the model and this is not a problem.
My problem is
" How i can incapsulate a set of number in an IOContainer for using this as input of the Model?"
Thank you very much
Tagged:
0
Answers
just set up your ExampleSet and put it in the IOContainer. See the following examples.
Create ExampleSet: Put ExampleSet into IOContainer: Just make sure to use the correct input order in your process design.
Regards,
Marco
I have
RapidMiner.init();
// loading the test set (plus adding the model to result container)
Operator testSource = OperatorService.createOperator(ModelApplier.class);
Operator loadModel= OperatorService.createOperator(ModelLoader.class);
File modelFile=new File("neuralX.mod");
loadModel.setParameter(ModelLoader.PARAMETER_MODEL_FILE, modelFile.getAbsolutePath());
Some idea? Very much thanks for the help
I strongly suggest using RapidMiner to design your process(es) beforehand and then using them via the code I posted in my first response. You can connect the input ports on the left border of the procecss design window to your operators, and then deliver the data at these ports at runtime to your process via: This way, you can do anything you can do from RapidMiner, so the result(s) from the process are the same as in RapidMiner. Trying to create the process "by hand" and not using a process xml is very, very error-prone (and a lot more work).
Regards,
Marco
resultSet = (ExampleSet)ioResult.getElementAt(0);
System.out.println("resultset");
Example e=resultSet.getExample(0);
predetto=e.getPredictedLabel();
System.out.println("predetto="+predetto);
It is correct? And then the process.run is in a while loop , have i to destroy the table and the example map at every iterate? Thank you very much Marco i have problem to understand the index that i insert in the call of function.
Happy data miner
I suggest using something along these lines: This will iterate over all examples of the specified attribute.
If you want to run your process execution in a while loop you can do that, there is no need to explicitly destroy something.
Regards,
Marco
Then i have to use getPredictedLabel() not getAttribute right? Then is there an order of the ExampleSet? The last example Set is the first of the table?
Finally a question if i have two output port for my process what i have to do for get a specific port?
You are very nice thank you very much and i'm sorry for the great number of question that i do
1) Predictions are also attributes. They have a special role, but my code above should work anyway.
2) The order you get when iterating over the example set as indicated above should match the order displayed in RapidMiner.
3) ioResult.getElementAt(0) will get you the first output IOObject, ioResult.getElementAt(1) the second, and so on.
Regards,
Marco
My problem is that i have to insert a new row in the data table and create an exampleSet of only this new row data, maybe i don't have understand something.
Everyone have an idea?
My goal is at every loop i have to give it a new exampleSet, run my process that give me two ResultSet, and then prepare for the next iterate(then eliminate the prediction attribute that Rapidminer add to my exampleSet).
Thank you very much