Help save net neutrality! Learn more.
Close

Possible bug : GArffRelation relation name

Help
2012-04-11
2012-09-14
  • Nobody/Anonymous

    When saving a GMatrix as Arff using GMatrix::saveArff(...) and using an
    GArffRelation with the name setted with GArffRelation::setName(...), the
    relation title in the arff file is still "@RELATION Untitled". I think it
    should be the name that we defined in the GArffRelation.

    Thanks for this great API!

     
  • Nobody/Anonymous

    Thanks. I have pushed a fix into our git repository.

     
  • doityth777

    doityth777 - 2012-04-30

    same situation appears to me!!

    ///////

    GMatrix features;

    ......

    (features.relation().get())->setName("relation_test");

    //////

    debugging, it appears:

    error C2039: 'setName' : is not a member of 'GClasses::GRelation'

    using type casting as followed,

    ((GArffRelation*)(features.relation().get()))->setName(UnicodeToAnsi(_T("ftet"
    )));

    it compiles successfully, but the .exe runs corrupted!!

     
  • doityth777

    doityth777 - 2012-04-30

    could you put the fixed code here!?

     
  • Mike Gashler

    Mike Gashler - 2012-04-30

    The GRelation class has 3 sub-classes: GUniformRelation, GMixedRelation, and
    GArffRelation. Only GArffRelation has a setName(const char*) method. The other
    two do not store a name.

    Perhaps this is what you are trying to do?

    GMatrix m(23, 13);

    size_t cols = m.cols();

    sp_relation pRel = new GArffRelation();

    pRel->setName("ftet");

    for(size_t i = 0; i < cols; i++)

    {

    std::string s = "col_";

    s += to_str(i);

    pRel->addAttribute(s.c_str(), 0, NULL);

    }

    m.setRelation(pRel);

     
  • doityth777

    doityth777 - 2012-04-30

    vc2008 with the latest waffles downloaded by git. compiling and showing error
    about stdint.h included in file GRand.h.

    substitute the file GRand.h and the .cpp in "waffles-2011-12-6-source" for the
    latest vision by git. all compiled successfully with Commentting out the line
    as followed,

    //runTest("GRand", GRand::test);

    //runTest("GRandMersenneTwister", GRandMersenneTwister::test);

    in file src\test\main.cpp

    but with all the changes done above. the problem of using GArrfRelation to set
    GMatrix relation name is not sovled!!

    i use the code in waffles\demos\hello_ml\src\main.cpp to test of using
    GArrfRelation to set GMatrix relation name in funtion void doit(). with the
    code you mentioned above. it comes,

    ///////

    e:\waffles-2011-12-6-source_4_4dlg.cpp(70) : error C2039: 'setName' : is
    not a member of 'GClasses::GRelation'

    1> e:\waffles-2011-12-6-source\waffles\src\gclasses\gmatrix.h(49) : see
    declaration of 'GClasses::GRelation'

    1>e:\waffles-2011-12-6-source_4_4dlg.cpp(76) : error C2039: 'addAttribute' :
    is not a member of 'GClasses::GRelation'

    1> e:\waffles-2011-12-6-source\waffles\src\gclasses\gmatrix.h(49) : see
    declaration of 'GClasses::GRelation'

     
  • doityth777

    doityth777 - 2012-04-30

    sp_relation pRel = new GArffRelation();

    pRel->setName("ftet");

    size_t c = features.cols();

    for(size_t i = 0; i < c; i++)

    {

    std::string s = "col_";

    s += to_str(i);

    pRel->addAttribute(s.c_str(), 0, NULL);

    }

    features.setRelation(pRel);

     
  • Nobody/Anonymous

    Sorry, I should have compiled it before posting. This code should compile:

    GArffRelation* pArffRel = new GArffRelation();

    sp_relation pRel = pArffRel;

    pArffRel->setName("ftet");

    size_t c = features.cols();

    for(size_t i = 0; i < c; i++)

    {

    std::string s = "col_";

    s += to_str(i);

    pArffRel->addAttribute(s.c_str(), 0, NULL);

    }

    features.setRelation(pRel);

     
  • doityth777

    doityth777 - 2012-05-01

    thanks a lot!!! it is solved!!!

     


Anonymous

Cancel  Add attachments