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
"[SOLVED] Setting the parameters of TextMining Extension operator via java!"
I was trying to set a Parameter of an operator via java, so I can give the my trianed model a text file and it would classify it.
The operator is "Process Documents from Files", the parameter is "test directories" which contains "class name" and "directory"
I tried to follow the post http://rapid-i.com/rapidforum/index.php/topic,5807.0.html, but I didn't find the class name in the OperatorCore.xml
So, where can I find the classes related to the parameters of text mining extension .
My second question is, the parameter has 2 sub parameters "class name" and "directory". So, how to set them? using dot or under score or what?
Note: the process is already running correctly in Rapid-miner, and now I deleted the parameter values and I am tried to set them via java.
Any help or tips are appreciated,
The operator is "Process Documents from Files", the parameter is "test directories" which contains "class name" and "directory"
I tried to follow the post http://rapid-i.com/rapidforum/index.php/topic,5807.0.html, but I didn't find the class name in the OperatorCore.xml
So, where can I find the classes related to the parameters of text mining extension .
My second question is, the parameter has 2 sub parameters "class name" and "directory". So, how to set them? using dot or under score or what?
Note: the process is already running correctly in Rapid-miner, and now I deleted the parameter values and I am tried to set them via java.
Any help or tips are appreciated,
Tagged:
0
Answers
the operator classname is from the text extension, i.e. you will find the name in the OperatorsTextProcessing.xml file of it. The class is com.rapidminer.operator.text.io.FileDocumentInputOperator.
You can use the setListParameter(String, List) method in your case. just pass it a list of string arrays (each array of size = number of columns in the parameter).
Regards,
Marco
I've the following run java code: but got the following error:
here is the XML content: (I've created the model using the disabled operators in r=the following process) svmModel and svmWordlist are located in the local repository
I always get the same error when I want to use the local repository as recommended http://rapid-i.com/rapidforum/index.php/topic,5807.0.html
Another problem is when I run the process from java without changing the parameter and when I give the whole path like: \\Local Repository\\SVMTesting.rmp
the returned output is the training set, not the predicted class of the new unseen documents, So what to change in the code to get the predicted labels?
and If I change the code to set the operators as useing the path of the repository as \\Local Repository\\SVMTesting.rmp, the error state that, it can't reach svmModel and svmWordlist files!
Any hints?
Your help is appreciated,
1) change your rapidMinerProcess parameter to "//Local Repository/SVMtesting", file endings do not exist for the repository. That's why you are getting the NPE.
2) Your posted process returns nothing - no operator is connected to the "res" ports on the right side of the process, so I can't tell you why you are receiving the training data instead of the classified results. Note that the clasified data also includes the input data, just with additional attribute columns.
3) I don't understand you last sentence. Please include the actual error message.
Regards,
Marco
When I run the above process in java class; I got the following error: Jars in my java project are
- RapidMiner
- Luncher
- Vldocking
- All jars inside (JDBC folder) - 4 jar files
sorry, the FAQ was missing a bit: this links the process to the repository so it can resolve relative paths. Otherwise RapidMiner Studio does not know where to look when you reference other data in the repository w/o a fully qualified location.
Regards,
Marco
I changed the way to load the process to java application as follows: Also, I changed the value to be the Repository Location as follows it did work for retrieving the model: However, I don't want to rely on the repository, so I set the parameters via Java as follows: NOW, it works fine!
My new task is to run "my course project" on a machine that doesn't have RapidMiner already installed.
I tries to follow what mentioned in "RapidMiner as a library" section here http://rapid-i.com/wiki/index.php?title=Integrating_RapidMiner_into_your_application
However, I didn't get from where I can put the rapidminerrc in my project? and how can I specify the required files fro my f\project from rapidminer.home/lib?
Any further explanation or resources to read to achieve this will be appreciated.
In addition,
I still have problem in setting the parameters via java, I used the way mentioned in FAQ post as follow:
Note: the process works in Rapidminer, but when passing the parameters via Java it doesn't work!!!
regards,
your post is a bit confusing now, so I'll try to point some things out.
1) When you have a process which makes use of operators that load further data/models/etc from the repository, your process needs a repository location. Otherwise it does not know how to resolve the relative locations for the "Retrieve" operators, as the process does not know where itself is from. That's why the process location has to be set and is set by RapidMiner Studio when starting the process from the GUI.
2) process.getOperator("Retrieve k-NN Model").setParameter("RepositorySource.PARAMETER_REPOSITORY_ENTRY", "D:\\k-NNModel"); That this works is surprising to me as that parameter is intended for repository access which is an abstraction of a file system..
3) The wiki section - good grief, I didn't even know that existed. Looks quite outdated to be honest. If you want to run rapidminer from your own application, make sure that all jars from RapidMiner/lib are in the classpath of your application. Just as any other library jars.
4) Where exactly do we stand now - what is the latest error message you get?
Regards,
Marco
I just realized yesterday that I was wrong about setting the repository_entry with a path of my file system.
This is my mistake. Sorry for confusing you!
1+2) Thanks for your clear explanation about the repository.
So, what I understood is that having a repository is a "must" in using RapidMiner.
but I still didn't get how to rely on a repository if we want to run this code on a computer that doesn't have rapidminer.
3). Is there any resource/documentation to read the description for each jar in rapidminer/lib?
Sorry for asking this question again and again; can I run my java application on a computer that does not have RapidMiner installed. Actually, I tried to run the last working code on a laptop that does not have RapidMiner and it gave me errors (I'll report them later to not confuse you with all the problems at once).
4) sorry again for confusing you,
the process was working correctly yesterday but I run in now and It give me new error: The java code: .rmp file: Your help and effort are appreciated,
Regards,
1) It's very much recommended, yes. You can create a new local repository (pointing to a folder of your choice) and add it to the RepositoryManager to use a repository on a shipped product.
2) Not really, no. Most of them are libraries that RapidMiner Studio itself uses for certain tasks (e.g. a library to read Excel files etc). If in doubt, they are all needed.
3) The error looks like the path on the filesystem where the repository is stored cannot be accessed. Sounds like the repository points to a network drive which is no longer available when executing the process.
Regards,
Marco
Thank you for reply,
As I go through the FAQ many time,
I found the following the second line showed me a error because the setProcessLocation() method receives a ProcessLocation object not a RepositoryLocation object!
So, I tried to do it this way which doesn't make sense: So, did I miss any point?
sorry about that! You spotted an error in the FAQ.
It should actually be: Regards,
Marco
Many Thanks for your continues help!
returning back to my main problem of setting the parameters, I tried to follow the way as mentioned above and in FAQ: I also tried the following for "Process Documents from Files" operator: This doesn't work, the output is the following line: This warning line appears for every attribute in the training set!
When I open the process.rmp file I don't see any changes even for the retrieve operator.
Also, if I set the parameters' values in RapidMiner GUI, every thing works fine!
Any tips?
Thanks !
1) Will not work, you are not using the String constant but instead creating your own string which consists of the constant name
Correct would be: 2) When you change a process in your Java application, you are NOT working on the stored .rmp file. You have created a local in memory copy on which you are working. To persist your changes, you need to manually store your process again. To do so have a look at the StoreProcessAction.
Regards,
Marco
Thanks for your patience and help!