Output sorted weight table from LibSVM linear operator
I am trying to export a file that has a sorted list of the kernel model. I can write an unsorted one with write as text but with no flexibilty. Ideally I would also like to extract the highest and lowest values.
I am assuming that this could be done by using execute script or is there another way to make the weight table more manageable?
regards,
Alex
Best Answer
-
Hi Alex,
I couldn't agree more with you that RapidMiner should add a generic "Object to Data" adapter. If the object has some tabular data inside that shouldn't be that problematic, I guess...I would vote for this feature
Greetings,
Sebastian
0
Answers
-
Hi,
you mean the weights right? In this case you can simply use Weights to Data and use standard ETL operators like Sort and Filter on it.
~Martin
0 -
Hi Martin,
Unfortunately I can't use the weights to data operator because the weight table and the Support Vector table are rendered from the apply model operator (mod). I have a select by weights operator in my process but the output there is just 1 or 0 depending if the attribute is selected. So far I have not found any operators that can sort data if the output port is "mod". I just seem to be able to write to a text file or copy and paste to Excel by hand.
Do you think this is something that could be done via Groovy Scripting? Looking throught the forums, this has come up before but without any solutions.
regards,
Alex
0 -
Hey,
i think there is no generic way to get a model to example set. The usual way to do it is similar to your idea but with RapidMiner. Use Write Model to write it to disc and Read Document/Read XML to read it in an parse it.
Best,
Martin
0 -
Thanks Martin,
I spent some time trying to do this but I am running into trouble separating the attribute name from the weight value. I am open to all ideas on how this might done!
Thanks and have a good weekend,
Alex
0 -
Well,
there's a less hacky solution:
The SVM Linear internally uses the JMySVM implementation, so it's the same as in the standard SVM operator. Instead of getting the things from the Model, you simply use the SVM operator with a linear kernel. Then take the Weight Table you get from the purple weight output port. It contains the coefficients and you can transform them to data with Weights to Data and sort them as you like...
Greetings,
Sebastian
1 -
Thank you Sebastian,
I see how this works now and I have switched from LibSVM to jMySVM and have been able to output the the sorted weights. It is unfortunate that the other SVM operators are missing the (wei) port which I think would be useful. Alternatively an operator that converts model output to exampleset (Model to Data) would also do the job.
Kind regards,
Alex
0 -
Hi Alex,
I couldn't agree more with you that RapidMiner should add a generic "Object to Data" adapter. If the object has some tabular data inside that shouldn't be that problematic, I guess...I would vote for this feature
Greetings,
Sebastian
0 -
Please suggest this and other enhancements here
http://community.rapidminer.com/t5/Ideas-for-the-Community/idb-p/CommIdeas
We defintiely will love such feedback and community gets to determine whats important and vote for it
0