"Loop over different values of a constant used in Generate Attributes?"

srt19170srt19170 Member Posts: 44 Contributor II
edited May 2019 in Help
My apologies if the answer to this exists somewhere -- if it does, I wasn't able to find it.

I have a "Generate Attributes" block in my process that creates a derived attribute with an equation that looks something like this:

    Foo = 3*Bar + 2*Baz

Foo is then later used in classification.  I'd like to set up a loop of some sort to try all combinations of constants in this equation, e.g., 1*Bar + 1*Baz, 2*Bar + 1*Baz, etc.  Essentially what "Optimize Parameters" does, but over some constants (macros?) that I can use within Generate Attributes.

Any thoughts on how to accomplish this?

Answers

  • IngoRMIngoRM Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, Community Manager, RMResearcher, Member, University Professor Posts: 1,751 RM Founder
    Hi,

    even better: I found the problem interesting enough to spend a bit of time for some serious process design  ;)

    The result is a nice little process creating all linear combinations for two attributes by using a specified number of coefficients for each of both and generating one new attribute for each combination (why I would do this and not let the learner doing this is another question  ;D )

    Ok, I have uploaded the final process to myExperiment. You can download it with our Community Extension (search the forum for a description how). The process is named "Create Linear Combinations" ( http://www.myexperiment.org/workflows/2061.html )

    Have fun optimizing it for your setting. Cheers,
    Ingo
  • srt19170srt19170 Member Posts: 44 Contributor II
    Ingo, thanks for the help!  Looks like exactly what I need!

    On a related note, to do something like this task, I have to take my existing process and make it the inner process of the Loop operator.  I can do that with a cut & paste, but then I end up with two different copies of the inner process, and if I change one the other doesn't change, so I have to remember to make changes in both places.  Is there a way to call my existing process as a "subroutine" from within the inner process...?
  • IngoRMIngoRM Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, Community Manager, RMResearcher, Member, University Professor Posts: 1,751 RM Founder
    Hi,

    Is there a way to call my existing process as a "subroutine" from within the inner process...?
    of course (the answer to any "Is-there-a-possibility-in-RapidMiner-to-achieve-XYZ"-Question will always be "of course"  ;D )

    There is an operator called "Execute Process" in the group Utility - Execution which does exactly that. You could also simply store a process into your repository and drag it into a new process - RapidMiner will automatically create an "Execute Process" operator for this subroutine then. You can also parameterize this subprocess by propagating macros inside of it and if you want event the meta data propagation during process design can be executed.

    Have fun,
    Ingo
Sign In or Register to comment.