Output sorted weight table from LibSVM linear operator

hughesfleming68hughesfleming68 Member Posts: 323 Unicorn
edited November 2018 in Help

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

Tagged:

Best Answer

  • landland RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 2,531 Unicorn
    Solution Accepted

    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

Answers

  • MartinLiebigMartinLiebig Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, University Professor Posts: 3,453 RM Data Scientist

    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

    - Sr. Director Data Solutions, Altair RapidMiner -
    Dortmund, Germany
  • hughesfleming68hughesfleming68 Member Posts: 323 Unicorn

    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

  • MartinLiebigMartinLiebig Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, University Professor Posts: 3,453 RM Data Scientist

    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

    - Sr. Director Data Solutions, Altair RapidMiner -
    Dortmund, Germany
  • hughesfleming68hughesfleming68 Member Posts: 323 Unicorn

    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

  • landland RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 2,531 Unicorn

    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

    MartinLiebig
  • hughesfleming68hughesfleming68 Member Posts: 323 Unicorn

    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

     

     

  • bhupendra_patilbhupendra_patil Administrator, Employee, Member Posts: 168 RM Data Scientist

    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

Sign In or Register to comment.