"Using SVM with features from external tool"

svm_friendsvm_friend Member Posts: 3 Contributor I
edited May 2019 in Help
I wrote some code that generates my feature vectors I want to use for training an SVM.

So far I have been using LibSVM and my feature format is like this:

<class> .=. +1 | -1 | 0
<feature> .=. integer
<value> .=. real
<line> .=. <class> <feature>:<value> <feature>:<value> ... <feature>:<value>

Example:
1 1:0.11764705882352941 2:0.25
1 1:0.11764705882352941 2:0.25

What I want to do is:

Load my feature file
Do some cross validation by generating different models and evaluate on the remaining data and finally create some ROC and Prec/Recall-Charts..

Is that possible? Does RM recognize the format?
Tagged:

Answers

  • landland RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 2,531 Unicorn
    Hi,
    usually the data format just contains all values blank seperated, one example per line.
    But since RapidMiner uses regular expressions to split the values, we could use the regular expression "\s+[0-9]*:" to use the blank, feature names and the : as seperator.
    This is only possible, if your formate is not sparse, does not leave out some features or rearrangs in different lines them!
    Use this as regular expression in the ExampleSource ConfigurationWizard.

    For the rest of the processes, take a look on the samples shipped with rapidMiner.

    Greetings,
      Sebastian
  • svm_friendsvm_friend Member Posts: 3 Contributor I
    Unfortunately I do sparse features like

    1 6:0.0 7:0.875
    1 4:1.0 6:0.8333333333333334 7:0.6956521739130435
    1 4:1.0 6:0.625 7:0.7368421052631579
    1 4:1.0 6:0.3333333333333333 7:0.11764705882352941
    1 6:0.6 7:0.875
    1 6:0.0 7:0.8333333333333334
    1 2:0.9166666666666666 4:0.0 6:0.5 7:0.6666666666666666

    Is it possible to store those values in a csv file and pass that to the Rapidminer like

    #Class; F1; F2; F3; F4;
    1; 1; ; 2; ;
    1; 1; 1; ; 1;4

    I would just leave the space blank between the seperators?
  • TobiasMalbrechtTobiasMalbrecht Moderator, Employee, Member Posts: 294 RM Product Management
    Hi,

    yes, it is possible to have missing values in csv files when you load them into RapidMiner.

    Regards,
    Tobias
Sign In or Register to comment.