Options

UserError when settingSpecialAttribute()

mtgreenmtgreen Member Posts: 9 Contributor II
edited November 2018 in Help
Hi,

I'm testing my own operator and I've been getting a UserError while it is running.  I've isolated the issue to the fact that I am modifying one of the attributes from a cloned version of the input exampleset.  I am calling Attributes.setSpecialAttribute() within my operator.  There error message states:

Certain operations are not allowed during the running of an experiment. These operations include the adding or the removal of an operator. Please do not perform these setup changes during runtime but stop the experiment, change the setup, and start it again.

Is there any "safe" mechanism for modifying the special/regular status of an attribute while an operator is running.  In my code, I "clean up" when done by returning to the original state, but I can understand why the system would not like this behavior.

My reaons for changing the status of the Attributes.setSpecialAttribute() is because I am calling an operator (LinearRegression) within my operator and I want to suppress certain attributes for consideration in the regression.  I also add a new attribute that is based on the output of yet another operator (DecisionTree).  Once linear regression has produced the results I need, I simply return the exampleset to its original condition.

Right now, I can think of only one option:
Option:  Break apart my "super" operator so that it can be executed in discrete steps of a "Rapid Miner" process.  This would enable me to modify examplesets prior to calling the next operator in the process.

Of course I don't like this option because I have a difficult time manipulating examplesets (like adding new attributes) without using java directly.  Any help/suggestions would be appreciated.  Thanks!

mtgreen

Answers

  • Options
    landland RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 2,531 Unicorn
    Hi,
    probably this error message results from an "ConcurrentModificationException". If such an exception occurs and is not catched, the process believes to have changed itself.
    You probably will iterate over a collection from attributes and change the collection or its elements. This will cause such an exception. I had been trapped by this error message myself a few times in the past :)

    Instead of setting the attributes' roles to special, you could simply remove them in the cloned exampleset. Later you could add the resulting attributes to the original example set, which still contains the unneeded attributes.

    Greeting,
      Sebastian
  • Options
    mtgreenmtgreen Member Posts: 9 Contributor II
    Thanks.  This is exactly what I did (after examining how it was done in existing operators) and it now works.  Thanks Sebastian!
Sign In or Register to comment.