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] Extract weight-table from libSVM-model by javascript

xDStickerxDSticker Member Posts: 16 Contributor II
edited November 2018 in Help
Hallo Dataminers,

is there any way to extract the weighttable from model? I mean, i can see the table in RM but can't use is for further calculations?

I allready tried it by myself with the "execute script"-operator but stuck after a few lines of Java.
import com.rapidminer.operator.learner.functions.kernel.JMySVMModel;

JMySVMModel model = input[0];

return model.createWeightsTable();
I saw that some other people had the same problem but there isn't a good solution right now. It would be great if someone could help me out.

Thank you for help :)

Answers

  • MariusHelfMariusHelf RapidMiner Certified Expert, Member Posts: 1,869 Unicorn
    Is there a reason why you use the libSVM instead of RapidMiner's SVM? You could make your life easier by using the standard Support Vector Machine operator and connect to the weights output.

    Best regards,
    Marius
  • xDStickerxDSticker Member Posts: 16 Contributor II
    Jep, there is a reason.

    We allready working with the Standard SVM but now I wanna try out the LibSVM.

    It would be realy great if someone could help me.

    Sticker
  • MariusHelfMariusHelf RapidMiner Certified Expert, Member Posts: 1,869 Unicorn
    Ok, the problem is that model.createWeightTable() creates a DataTable. To use it in RapidMiner, you have to convert it into an ExampleSet. Here you go:
     import com.rapidminer.operator.learner.functions.kernel.LibSVMModel;
    import com.rapidminer.datatable.DataTable;
    import com.rapidminer.datatable.DataTableExampleSetAdapter;

    LibSVMModel model = input[0];

    DataTable table = model.createWeightsTable();

    return DataTableExampleSetAdapter.createExampleSetFromDataTable(table);
  • xDStickerxDSticker Member Posts: 16 Contributor II
    Thank you very much for your help.

    But it dosnt work if I use the class LibSVMModel. I use JMySVMModel instead.

    So if someone wanna extract the Model from LibSVM, feel free to use this code :
    import com.rapidminer.operator.learner.functions.kernel.JMySVMModel;
    import com.rapidminer.datatable.DataTable;
    import com.rapidminer.datatable.DataTableExampleSetAdapter;

    JMySVMModel model = input[0];

    DataTable table = model.createWeightsTable();

    return DataTableExampleSetAdapter.createExampleSetFromDataTable(table);
    See you soon ;)
Sign In or Register to comment.