The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here

Creating Memory ExampleSet

JacksonhiJacksonhi Member Posts: 7 Contributor II
edited November 2018 in Help
Hi,

I am reading an SQL table to create an ExampleSet and also trying to create a matching ExampleSet in memory.

First a question about the sql generated set.
System.out.println(exampleSet.toResultString());
Attributes tributes = exampleSet.getAttributes();
System.out.println(tributes.toString());
When I run this on my SQL generated ExampleSet I see in 4.6

SimpleExampleSet:
59 examples,
8 regular attributes,
special attributes = {
    label = #9: RNK (nominal/single_value)/values=[A, B, C, D, E]
    id = #8: inc (integer/single_value)
}
SimpleAttributes: sl3, sl5, sl8, sl13, sl21, mvv, hl, mvp, label := RNK, id := inc


Where did the id come from? I manipulated the id so that it became the sql key by  adding inc and by placing it next to the label. Before I did this, the double mvp was not a regular expression, it seemed to be left out, becoming id. Could this be a bug?

This is my Memory Example set that has a null pointer exception.

SimpleExampleSet:
59 examples,
8 regular attributes,
special attributes = {
    label = #8: RNK (nominal/single_value)/values=[A, B, C, D, E]
}
SimpleAttributes: sl3, sl5, sl8, sl13, sl21, mvv, hl, mvp, label := RNK

Answers

  • landland RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 2,531 Unicorn
    Hi,
    how did you create the exampleset resulting from the sql query? Did you use the DatabaseExamplesetSource? Please provide the process or code fragment where the exampleset is created. Otherwise I can't see your parameter settings...

    The same applies to the second question. Without having the stack trace, the fragment creating the exampleset and the lines, where the null pointer exception occurs, I cannot give you any reasonable advise.

    Greetings,
      Sebastian
  • JacksonhiJacksonhi Member Posts: 7 Contributor II
    If I remove the attribute inc and also from the query I notice mvp is no longer a regular attribute but becomes id.

           Operator inputOperator;
            // create operator 1 - IMPORT DATA FROM MYSQL


            inputOperator = OperatorService.createOperator("DatabaseExampleSource");
            // set parameters

            inputOperator.setParameter("database_url", "jdbc:mysql://192.168.0.15:3306/ctl");
            inputOperator.setParameter("id_attribute", "sl3");
            inputOperator.setParameter("id_attribute", "sl5");
            inputOperator.setParameter("id_attribute", "sl8");
            inputOperator.setParameter("id_attribute", "sl13");
            inputOperator.setParameter("id_attribute", "mvv");
            inputOperator.setParameter("id_attribute", "hl");
            inputOperator.setParameter("id_attribute", "mvp");
            inputOperator.setParameter("id_attribute", "inc");
            inputOperator.setParameter("label_attribute", "RNK");
            inputOperator.setParameter("query", "SELECT sl3, sl5, sl8, sl13, sl21, mvv, hl, mvp, inc, RNK FROM training where inc < 250");
            inputOperator.setParameter("username", "ibt");
            inputOperator.setParameter("password", "88bitz");


            IOContainer container = inputOperator.apply(new IOContainer());
            ExampleSet exampleSet = container.get(ExampleSet.class);

                        //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

                System.out.println(exampleSet.size());
                System.out.println(exampleSet.toResultString());

                Attributes tributes = exampleSet.getAttributes();
                System.out.println(tributes.toString());
                //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  • landland RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 2,531 Unicorn
    Hi,
    you are setting the same parameter "id_attribute" again and again, each time overwriting it's previous value. So if you remove the line of code, setting inc as id attribute, the line before will be set the parameter to its final value and hence this mvp becomes id_attribute.

    Greetings,
      Sebastian
  • JacksonhiJacksonhi Member Posts: 7 Contributor II
    Thank you, I see my error is obvious.  :)

Sign In or Register to comment.