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.

exampleSet.getExampleFromId returns null

navyboysnavyboys Member Posts: 15 Contributor II
edited November 2018 in Help
I want to retrieve an example object by the "exampleSet.getExampleFromId" method, but got an NullPointerException error, anybody can tell me how to use this method?

Sample source likes this (Simplified Version)
-------------------------------------------------------------------------------------
Set<Double> exampleIds = new HashSet<Double>(exampleSet.size());

for (Example example: exampleSet) {
exampleIds.add(example.getId());
}

for (Double exampleId: exampleIds) {
Example example = exampleSet.getExampleFromId(exampleId);
example.getWeight();
}
-------------------------------------------------------------------------------------
Tagged:

Answers

  • fischerfischer Member Posts: 439 Maven
    Hi,

    hard to tell without an error message. Does your example set actually have an id attribute?

    Best,
    Simon
  • fischerfischer Member Posts: 439 Maven
    oh, and it looks like you did not call ExmpleSet.remapIds().

    Best,
    Simon
  • navyboysnavyboys Member Posts: 15 Contributor II
    Hi, Simon

    Problem resolved by adding ExampleSet.remapIds().
    Thank you very much.

    Yours ZHENG
Sign In or Register to comment.