RapidMiner

One-Class SVM

Highlighted
Learner III pankestyle
Learner III

One-Class SVM

Hi all,

 

I have a problem while trying to build a model with LibSVM (One-class SVM) operator. 

Label is Polynomial, but i transformed it in Binominal, and later (like from stackoverflow) had Filtered dataset to show only those cases which are "true". After Filter examples, I used Map operator, and then libSVM.

On test side of CrossValidation, after ApplyModel, I used Map operator where the selected attribute is prediction, and values for mapping are: inside -> true, and outside -> false. 

Unfortunately, every time I start the process, I get an error: "java.lang.UnsupportedOperationException".

 

Thanks in advance for your help!

Best wishes,

Milos Panic

 

More detail about error:

 

(

Exception: java.lang.UnsupportedOperationException
Message: java.lang.UnsupportedOperationException: java.lang.UnsupportedOperationException
Stack trace:
sun.reflect.GeneratedConstructorAccessor294.newInstance(Unknown Source)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
java.lang.reflect.Constructor.newInstance(Constructor.java:422)
java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:593)
java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:1005)
com.rapidminer.studio.concurrency.internal.StudioConcurrencyContext.collectResults(StudioConcurrencyContext.java:185)
com.rapidminer.studio.concurrency.internal.StudioConcurrencyContext.call(StudioConcurrencyContext.java:127)
com.rapidminer.extension.concurrency.execution.BackgroundExecutionService.executeOperatorTasks(BackgroundExecutionService.java:385)
com.rapidminer.extension.concurrency.operator.process_control.loops.LoopOperator.performParallelLoop(LoopOperator.java:173)
com.rapidminer.extension.concurrency.operator.process_control.loops.LoopOperator.doWork(LoopOperator.java:85)
com.rapidminer.operator.Operator.execute(Operator.java:1004)
com.rapidminer.operator.execution.SimpleUnitExecutor.execute(SimpleUnitExecutor.java:77)
com.rapidminer.operator.ExecutionUnit$3.run(ExecutionUnit.java:812)
com.rapidminer.operator.ExecutionUnit$3.run(ExecutionUnit.java:807)
java.security.AccessController.doPrivileged(Native Method)
com.rapidminer.operator.ExecutionUnit.execute(ExecutionUnit.java:807)
com.rapidminer.operator.OperatorChain.doWork(OperatorChain.java:428)
com.rapidminer.operator.Operator.execute(Operator.java:1004)
com.rapidminer.Process.run(Process.java:1315)
com.rapidminer.Process.run(Process.java:1179)
com.rapidminer.Process.run(Process.java:1132)
com.rapidminer.Process.run(Process.java:1127)
com.rapidminer.Process.run(Process.java:1117)
com.rapidminer.gui.ProcessThread.run(ProcessThread.java:65)
Cause
Exception: java.lang.UnsupportedOperationException
Message: java.lang.UnsupportedOperationException
Stack trace:
sun.reflect.GeneratedConstructorAccessor294.newInstance(Unknown Source)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
java.lang.reflect.Constructor.newInstance(Constructor.java:422)
java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:593)
java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:1005)
com.rapidminer.studio.concurrency.internal.StudioConcurrencyContext.collectResults(StudioConcurrencyContext.java:185)
com.rapidminer.studio.concurrency.internal.StudioConcurrencyContext.call(StudioConcurrencyContext.java:127)
com.rapidminer.extension.concurrency.execution.BackgroundExecutionService.executeOperatorTasks(BackgroundExecutionService.java:385)
com.rapidminer.extension.concurrency.operator.validation.CrossValidationOperator.performParallelValidation(CrossValidationOperator.java:428)
com.rapidminer.extension.concurrency.operator.validation.CrossValidationOperator.doWork(CrossValidationOperator.java:280)
com.rapidminer.operator.Operator.execute(Operator.java:1004)
com.rapidminer.operator.execution.SimpleUnitExecutor.execute(SimpleUnitExecutor.java:77)
com.rapidminer.operator.ExecutionUnit$3.run(ExecutionUnit.java:812)
com.rapidminer.operator.ExecutionUnit$3.run(ExecutionUnit.java:807)
java.security.AccessController.doPrivileged(Native Method)
com.rapidminer.operator.ExecutionUnit.execute(ExecutionUnit.java:807)
com.rapidminer.extension.concurrency.operator.process_control.loops.LoopOperator.doIteration(LoopOperator.java:240)
com.rapidminer.extension.concurrency.operator.process_control.loops.LoopOperator.access$300(LoopOperator.java:42)
com.rapidminer.extension.concurrency.operator.process_control.loops.LoopOperator$2.call(LoopOperator.java:165)
com.rapidminer.extension.concurrency.operator.process_control.loops.LoopOperator$2.call(LoopOperator.java:156)
com.rapidminer.extension.concurrency.execution.BackgroundExecutionService$ExecutionCallable.call(BackgroundExecutionService.java:349)
java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424)
java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1689)
java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Cause
Exception: java.lang.UnsupportedOperationException
Message: null
Stack trace:
java.util.AbstractList.remove(AbstractList.java:161)
java.util.AbstractList$Itr.remove(AbstractList.java:374)
java.util.AbstractList.removeRange(AbstractList.java:571)
java.util.AbstractList.clear(AbstractList.java:234)
com.rapidminer.operator.learner.functions.kernel.LibSVMModel.performPrediction(LibSVMModel.java:169)
com.rapidminer.operator.learner.PredictionModel.apply(PredictionModel.java:116)
com.rapidminer.operator.ModelApplier.doWork(ModelApplier.java:134)
com.rapidminer.operator.Operator.execute(Operator.java:1004)
com.rapidminer.operator.execution.SimpleUnitExecutor.execute(SimpleUnitExecutor.java:77)
com.rapidminer.operator.ExecutionUnit$3.run(ExecutionUnit.java:812)
com.rapidminer.operator.ExecutionUnit$3.run(ExecutionUnit.java:807)
java.security.AccessController.doPrivileged(Native Method)
com.rapidminer.operator.ExecutionUnit.execute(ExecutionUnit.java:807)
com.rapidminer.extension.concurrency.operator.validation.CrossValidationOperator.test(CrossValidationOperator.java:473)
com.rapidminer.extension.concurrency.operator.validation.CrossValidationOperator.access$300(CrossValidationOperator.java:59)
com.rapidminer.extension.concurrency.operator.validation.CrossValidationOperator$8.call(CrossValidationOperator.java:418)
com.rapidminer.extension.concurrency.operator.validation.CrossValidationOperator$8.call(CrossValidationOperator.java:402)
com.rapidminer.extension.concurrency.execution.BackgroundExecutionService$ExecutionCallable.call(BackgroundExecutionService.java:349)
java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424)
java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1689)
java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)

 

5 REPLIES
RM Certified Expert
RM Certified Expert

Re: One-Class SVM

Do you have a process to share?

Learner III pankestyle
Learner III

Re: One-Class SVM

Dear Thomas,

Here is the process:

 

<?xml version="1.0" encoding="UTF-8"?><process version="7.5.003">
  <context>
    <input/>
    <output/>
    <macros/>
  </context>
  <operator activated="true" class="process" compatibility="7.5.003" expanded="true" name="Process">
    <process expanded="true">
      <operator activated="true" class="retrieve" compatibility="7.5.003" expanded="true" height="68" name="Retrieve Train" width="90" x="45" y="34">
        <parameter key="repository_entry" value="//Prudential Life Insurance/Podaci/Train"/>
      </operator>
      <operator activated="true" class="subprocess" compatibility="7.5.003" expanded="true" height="124" name="Preprocessing" width="90" x="179" y="136">
        <process expanded="true">
          <operator activated="true" class="split_data" compatibility="7.5.003" expanded="true" height="82" name="Split Data" width="90" x="45" y="34">
            <enumeration key="partitions">
              <parameter key="ratio" value="0.7"/>
              <parameter key="ratio" value="0.3"/>
            </enumeration>
          </operator>
          <operator activated="true" class="remove_useless_attributes" compatibility="7.5.003" expanded="true" height="82" name="Remove Useless Attributes" width="90" x="45" y="136">
            <parameter key="numerical_min_deviation" value="0.005"/>
            <parameter key="nominal_useless_above" value="0.95"/>
            <parameter key="nominal_remove_id_like" value="true"/>
          </operator>
          <operator activated="true" class="remove_correlated_attributes" compatibility="7.5.003" expanded="true" height="82" name="Remove Correlated Attributes" width="90" x="45" y="289"/>
          <operator activated="true" class="weight_by_gini_index" compatibility="7.5.003" expanded="true" height="82" name="Weight by Gini Index" width="90" x="179" y="289">
            <parameter key="normalize_weights" value="true"/>
          </operator>
          <operator activated="true" class="select_by_weights" compatibility="7.5.003" expanded="true" height="103" name="Select by Weights" width="90" x="313" y="289">
            <parameter key="weight_relation" value="top k"/>
            <parameter key="k" value="47"/>
          </operator>
          <operator activated="true" class="nominal_to_binominal" compatibility="7.5.003" expanded="true" height="103" name="Nominal to Binominal" width="90" x="179" y="136">
            <parameter key="attribute_filter_type" value="single"/>
            <parameter key="attribute" value="Response"/>
            <parameter key="include_special_attributes" value="true"/>
          </operator>
          <operator activated="true" class="set_role" compatibility="7.5.003" expanded="true" height="82" name="Set Role" width="90" x="246" y="34">
            <parameter key="attribute_name" value="Response = 1"/>
            <parameter key="target_role" value="label1"/>
            <list key="set_additional_roles">
              <parameter key="Response = 2" value="label2"/>
              <parameter key="Response = 3" value="label3"/>
              <parameter key="Response = 4" value="label4"/>
              <parameter key="Response = 5" value="label5"/>
              <parameter key="Response = 6" value="label6"/>
              <parameter key="Response = 7" value="label7"/>
              <parameter key="Response = 8" value="label8"/>
            </list>
          </operator>
          <operator activated="true" class="replace_missing_values" compatibility="7.5.003" expanded="true" height="103" name="Replace Missing Values" width="90" x="380" y="34">
            <parameter key="include_special_attributes" value="true"/>
            <list key="columns"/>
          </operator>
          <operator activated="true" class="nominal_to_numerical" compatibility="7.5.003" expanded="true" height="103" name="Nominal to Numerical" width="90" x="514" y="34">
            <parameter key="attribute_filter_type" value="subset"/>
            <parameter key="attributes" value="Response = 8|Response = 7|Response = 6|Response = 5|Response = 4|Response = 3|Response = 2|Response = 1"/>
            <parameter key="invert_selection" value="true"/>
            <parameter key="include_special_attributes" value="true"/>
            <list key="comparison_groups"/>
          </operator>
          <connect from_port="in 1" to_op="Split Data" to_port="example set"/>
          <connect from_op="Split Data" from_port="partition 1" to_op="Remove Useless Attributes" to_port="example set input"/>
          <connect from_op="Remove Useless Attributes" from_port="example set output" to_op="Remove Correlated Attributes" to_port="example set input"/>
          <connect from_op="Remove Correlated Attributes" from_port="example set output" to_op="Weight by Gini Index" to_port="example set"/>
          <connect from_op="Weight by Gini Index" from_port="weights" to_op="Select by Weights" to_port="weights"/>
          <connect from_op="Weight by Gini Index" from_port="example set" to_op="Select by Weights" to_port="example set input"/>
          <connect from_op="Select by Weights" from_port="example set output" to_op="Nominal to Binominal" to_port="example set input"/>
          <connect from_op="Select by Weights" from_port="weights" to_port="out 2"/>
          <connect from_op="Nominal to Binominal" from_port="example set output" to_op="Set Role" to_port="example set input"/>
          <connect from_op="Set Role" from_port="example set output" to_op="Replace Missing Values" to_port="example set input"/>
          <connect from_op="Replace Missing Values" from_port="example set output" to_op="Nominal to Numerical" to_port="example set input"/>
          <connect from_op="Nominal to Numerical" from_port="example set output" to_port="out 1"/>
          <portSpacing port="source_in 1" spacing="0"/>
          <portSpacing port="source_in 2" spacing="0"/>
          <portSpacing port="sink_out 1" spacing="0"/>
          <portSpacing port="sink_out 2" spacing="0"/>
          <portSpacing port="sink_out 3" spacing="0"/>
          <portSpacing port="sink_out 4" spacing="0"/>
        </process>
      </operator>
      <operator activated="true" class="loop_labels" compatibility="7.5.003" expanded="true" height="124" name="Loop Labels" width="90" x="380" y="34">
        <process expanded="true">
          <operator activated="true" breakpoints="after" class="concurrency:cross_validation" compatibility="7.5.003" expanded="true" height="145" name="Cross Validation" width="90" x="179" y="136">
            <process expanded="true">
              <operator activated="true" class="filter_examples" compatibility="7.5.003" expanded="true" height="103" name="Filter Examples" width="90" x="45" y="34">
                <parameter key="parameter_string" value="Response{=1}=true"/>
                <parameter key="parameter_expression" value="contains([Response = 1]||[Response = 2]||[Response = 3]||[Response = 4]||[Response = 5]||[Response = 6]||[Response = 7]||[Response = 8],true)"/>
                <list key="filters_list">
                  <parameter key="filters_entry_key" value="Response = 1.equals.true"/>
                </list>
              </operator>
              <operator activated="true" class="map" compatibility="7.5.003" expanded="true" height="82" name="Map to true" width="90" x="45" y="187">
                <parameter key="attribute_filter_type" value="subset"/>
                <parameter key="attributes" value="Response = 8|Response = 7|Response = 6|Response = 5|Response = 4|Response = 3|Response = 2|Response = 1"/>
                <parameter key="include_special_attributes" value="true"/>
                <list key="value_mappings">
                  <parameter key="true" value="true"/>
                  <parameter key="false" value="true"/>
                </list>
              </operator>
              <operator activated="true" class="support_vector_machine_libsvm" compatibility="7.5.003" expanded="true" height="82" name="SVM" width="90" x="179" y="289">
                <parameter key="svm_type" value="one-class"/>
                <parameter key="kernel_type" value="linear"/>
                <parameter key="cache_size" value="500"/>
                <list key="class_weights"/>
                <parameter key="shrinking" value="false"/>
                <parameter key="confidence_for_multiclass" value="false"/>
              </operator>
              <connect from_port="training set" to_op="Filter Examples" to_port="example set input"/>
              <connect from_op="Filter Examples" from_port="example set output" to_op="Map to true" to_port="example set input"/>
              <connect from_op="Map to true" from_port="example set output" to_op="SVM" to_port="training set"/>
              <connect from_op="SVM" from_port="model" to_port="model"/>
              <portSpacing port="source_training set" spacing="0"/>
              <portSpacing port="sink_model" spacing="0"/>
              <portSpacing port="sink_through 1" spacing="0"/>
            </process>
            <process expanded="true">
              <operator activated="true" class="apply_model" compatibility="7.5.003" expanded="true" height="82" name="Apply Model" width="90" x="45" y="34">
                <list key="application_parameters"/>
              </operator>
              <operator activated="true" class="map" compatibility="7.5.003" expanded="true" height="82" name="Map back" width="90" x="45" y="136">
                <parameter key="include_special_attributes" value="true"/>
                <list key="value_mappings">
                  <parameter key="inside" value="true"/>
                  <parameter key="outside" value="false"/>
                </list>
              </operator>
              <operator activated="true" class="performance_binominal_classification" compatibility="7.5.003" expanded="true" height="82" name="Performance" width="90" x="112" y="289">
                <parameter key="main_criterion" value="kappa"/>
                <parameter key="classification_error" value="true"/>
                <parameter key="kappa" value="true"/>
                <parameter key="AUC" value="true"/>
              </operator>
              <connect from_port="model" to_op="Apply Model" to_port="model"/>
              <connect from_port="test set" to_op="Apply Model" to_port="unlabelled data"/>
              <connect from_op="Apply Model" from_port="labelled data" to_op="Map back" to_port="example set input"/>
              <connect from_op="Map back" from_port="example set output" to_op="Performance" to_port="labelled data"/>
              <connect from_op="Performance" from_port="performance" to_port="performance 1"/>
              <connect from_op="Performance" from_port="example set" to_port="test set results"/>
              <portSpacing port="source_model" spacing="0"/>
              <portSpacing port="source_test set" spacing="0"/>
              <portSpacing port="source_through 1" spacing="0"/>
              <portSpacing port="sink_test set results" spacing="0"/>
              <portSpacing port="sink_performance 1" spacing="0"/>
              <portSpacing port="sink_performance 2" spacing="0"/>
            </process>
          </operator>
          <connect from_port="example set" to_op="Cross Validation" to_port="example set"/>
          <connect from_op="Cross Validation" from_port="model" to_port="out 1"/>
          <connect from_op="Cross Validation" from_port="test result set" to_port="out 3"/>
          <connect from_op="Cross Validation" from_port="performance 1" to_port="out 2"/>
          <portSpacing port="source_example set" spacing="0"/>
          <portSpacing port="sink_out 1" spacing="0"/>
          <portSpacing port="sink_out 2" spacing="0"/>
          <portSpacing port="sink_out 3" spacing="0"/>
          <portSpacing port="sink_out 4" spacing="0"/>
        </process>
      </operator>
      <connect from_op="Retrieve Train" from_port="output" to_op="Preprocessing" to_port="in 1"/>
      <connect from_op="Preprocessing" from_port="out 1" to_op="Loop Labels" to_port="example set"/>
      <connect from_op="Preprocessing" from_port="out 2" to_port="result 4"/>
      <connect from_op="Loop Labels" from_port="out 1" to_port="result 1"/>
      <connect from_op="Loop Labels" from_port="out 2" to_port="result 2"/>
      <connect from_op="Loop Labels" from_port="out 3" to_port="result 3"/>
      <portSpacing port="source_input 1" spacing="0"/>
      <portSpacing port="sink_result 1" spacing="0"/>
      <portSpacing port="sink_result 2" spacing="0"/>
      <portSpacing port="sink_result 3" spacing="0"/>
      <portSpacing port="sink_result 4" spacing="0"/>
      <portSpacing port="sink_result 5" spacing="0"/>
    </process>
  </operator>
</process>

If it could help, i can upload .rmp or .csv file.

 

Thank you,

Milos Panic

RM Certified Expert
RM Certified Expert

Re: One-Class SVM

Ok, do can you give an example of the data structure?

Learner III pankestyle
Learner III

Re: One-Class SVM

Dear Thomas,

Sure. This dataset is from one of competitions on Kaggle.

And it is reduced to 30% of cases.

 

Thanks in advance,

Milos Panic

Learner III pankestyle
Learner III

Re: One-Class SVM

...Anyone?

Polls
How can RapidMiner increase participation in our new competitions?
Twitter Feed