Due to recent updates, all users are required to create an Altair One account to login to the RapidMiner community. Click the Register button to create your account using the same email that you have previously used to login to the RapidMiner community. This will ensure that any previously created content will be synced to your Altair One account. Once you login, you will be asked to provide a username that identifies you to other Community users. Email us at Community with questions.

Access Fast Large Margin Weights

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

execute script-01.pngFast Large Margin is an SVM-Like algorithm which runs in O(n). This is very nice in terms of run time. It provides coefficient for each attribute which might be used as weights. To access them you need to use a small Groovy script in an Execute Script operator:

 

import com.rapidminer.operator.learner.functions.FastMarginModel;
import java.util.logging.Level;
import com.rapidminer.tools.Ontology;
import com.rapidminer.example.utils.ExampleSetBuilder;
import com.rapidminer.example.utils.ExampleSets;

FastMarginModel inputmodel = input[0];

ArrayList<Attribute> attributes = new ArrayList<Attribute>();
attributes.add(AttributeFactory.createAttribute("word", Ontology.NOMINAL));
attributes.add(AttributeFactory.createAttribute("weight", Ontology.REAL));

ExampleSetBuilder builder = ExampleSets.from(attributes);

for(int i = 0; i < inputmodel.attributeConstructions.length; ++i){
double[] values = new double[2];
values[0] = attributes.get(0).getMapping().mapString(inputmodel.attributeConstructions[i]);
values[1] = inputmodel.linearModel.w[i]
builder.addRow(values);
}
return builder.build()

Attached is a process demonstrating this.

 

- Sr. Director Data Solutions, Altair RapidMiner -
Dortmund, Germany
Sign In or Register to comment.