Community & Support
Learn
Marketplace
Discussions
Categories
Discussions
General
Platform
Academic
Partner
Regional
User Groups
Documentation
Events
Altair Exchange
Share or Download Projects
Resources
News & Instructions
Programs
YouTube
Employee Resources
This tab can be seen by employees only. Please do not share these resources externally.
Groups
Join a User Group
Support
Altair RISE
A program to recognize and reward our most engaged community members
Nominate Yourself Now!
Home
Discussions
Altair RapidMiner
Traverse trough dataset in reverse order
wessel
Dear All, I posted the script below a long time ago, it creates some attributes with values depending on previous data rows.
Is it possible to do the loop: for (Example e : exampleSet) { } in reverse order somehow?
import com.rapidminer.operator.Operator;
import com.rapidminer.Process;
import com.rapidminer.MacroHandler;
import com.rapidminer.tools.Ontology
ExampleSet exampleSet = operator.getInput(ExampleSet.class);
Attribute sum = AttributeFactory.createAttribute("sum", Ontology.REAL);
exampleSet.getExampleTable().addAttribute(sum);
exampleSet.getAttributes().addRegular(sum);
Attribute avg = AttributeFactory
.createAttribute("avg", Ontology.REAL);
exampleSet.getExampleTable().addAttribute(avg);
exampleSet.getAttributes().addRegular(avg);
last = 0;
n = 0;
for (Example e : exampleSet) {
e["sum"] = e["abs"] + last; // iterate over an attribute using the name of the attribute
last = e["sum"];
n++;
e["avg"] = last / n;
}
return exampleSet
Find more posts tagged with
AI Studio
Comments
There are no comments yet
Quick Links
All Categories
Recent Discussions
Activity
My Discussions
Unanswered
日本語 (Japanese)
한국어(Korean)
Groups