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!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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);
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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,
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'
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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!
Thanks. I have pushed a fix into our git repository.
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!!
could you put the fixed code here!?
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);
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,
///////
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'
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);
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);
thanks a lot!!! it is solved!!!