GClasses
|
Holds the metadata for a dataset.
The metadata includes which attributes are continuous or nominal, and how many values each nominal attribute supports.
#include <GMatrix.h>
Public Types |
Public Member Functions | |
GRelation () | |
virtual | ~GRelation () |
virtual bool | areContinuous (size_t first=0, size_t count=INVALID_INDEX) const =0 |
Returns true iff all of the attributes in the specified range are continuous. The default range is all of them. More... | |
virtual bool | areNominal (size_t first=0, size_t count=INVALID_INDEX) const =0 |
Returns true iff all of the attributes in the specified range are nominal. The default range is all of them. More... | |
virtual std::string | attrNameStr (std::size_t nAttr) const |
Returns the name of the attribute with index nAttr as a standard string object or "" if the atribute has no name. More... | |
virtual GRelation * | clone () const =0 |
Makes a deep copy of this relation. More... | |
virtual GRelation * | cloneMinimal () const =0 |
Returns a relation containing the same value counts as this object, but not containing superfluous things, such as human-readable strings. (The returned relation may be of a different type.) More... | |
virtual GRelation * | cloneSub (size_t start, size_t count) const =0 |
Makes a deep copy of the specified subset of this relation. More... | |
virtual void | deleteAttributes (size_t index, size_t count)=0 |
Deletes the specified attribute. More... | |
virtual bool | isCompatible (const GRelation &that) const |
Returns true iff this and that have the same number of values for each attribute. More... | |
void | print (std::ostream &stream) const |
Prints this relation in ARFF format to the specified stream. More... | |
virtual void | printAttrName (std::ostream &stream, size_t column) const |
Prints the specified attribute name to a stream. More... | |
virtual void | printAttrValue (std::ostream &stream, size_t column, double value, const char *missing="?") const |
Prints the specified value to a stream. More... | |
void | printRow (std::ostream &stream, const double *pRow, char separator= ',', const char *missing="?") const |
Print a single row of data in ARFF format. More... | |
void | save (const GMatrix *pData, const char *szFilename) const |
Saves to a file. More... | |
virtual GDomNode * | serialize (GDom *pDoc) const =0 |
Marshal this object into a DOM, which can then be converted to a variety of serial formats. More... | |
virtual size_t | size () const =0 |
Returns the number of attributes (columns) More... | |
virtual void | swapAttributes (size_t nAttr1, size_t nAttr2)=0 |
Swaps two attributes. More... | |
virtual RelationType | type () const =0 |
Returns the type of relation. More... | |
virtual size_t | valueCount (size_t nAttr) const =0 |
Returns the number of values in the specified attribute. (Returns 0 for continuous attributes.) More... | |
Static Public Member Functions | |
static GRelation * | deserialize (const GDomNode *pNode) |
Load from a DOM. More... | |
static void | test () |
Performs unit tests for this class. Throws an exception if there is a failure. More... | |
|
inline |
|
inlinevirtual |
|
pure virtual |
Returns true iff all of the attributes in the specified range are continuous. The default range is all of them.
Implemented in GClasses::GMixedRelation, and GClasses::GUniformRelation.
|
pure virtual |
Returns true iff all of the attributes in the specified range are nominal. The default range is all of them.
Implemented in GClasses::GMixedRelation, and GClasses::GUniformRelation.
|
inlinevirtual |
Returns the name of the attribute with index nAttr as a standard string object or "" if the atribute has no name.
nAttr | the index of the attribute whose name is returned |
Reimplemented in GClasses::GArffRelation.
|
pure virtual |
Makes a deep copy of this relation.
Implemented in GClasses::GArffRelation, GClasses::GMixedRelation, and GClasses::GUniformRelation.
|
pure virtual |
Returns a relation containing the same value counts as this object, but not containing superfluous things, such as human-readable strings. (The returned relation may be of a different type.)
Implemented in GClasses::GArffRelation, GClasses::GMixedRelation, and GClasses::GUniformRelation.
|
pure virtual |
Makes a deep copy of the specified subset of this relation.
Implemented in GClasses::GArffRelation, GClasses::GMixedRelation, and GClasses::GUniformRelation.
|
pure virtual |
Deletes the specified attribute.
Implemented in GClasses::GArffRelation, GClasses::GMixedRelation, and GClasses::GUniformRelation.
Load from a DOM.
|
virtual |
Returns true iff this and that have the same number of values for each attribute.
Reimplemented in GClasses::GArffRelation, and GClasses::GUniformRelation.
void GClasses::GRelation::print | ( | std::ostream & | stream | ) | const |
Prints this relation in ARFF format to the specified stream.
|
virtual |
Prints the specified attribute name to a stream.
Reimplemented in GClasses::GArffRelation.
|
virtual |
Prints the specified value to a stream.
Reimplemented in GClasses::GArffRelation.
void GClasses::GRelation::printRow | ( | std::ostream & | stream, |
const double * | pRow, | ||
char | separator = ',' , |
||
const char * | missing = "?" |
||
) | const |
Print a single row of data in ARFF format.
void GClasses::GRelation::save | ( | const GMatrix * | pData, |
const char * | szFilename | ||
) | const |
Saves to a file.
Marshal this object into a DOM, which can then be converted to a variety of serial formats.
Implemented in GClasses::GArffRelation, GClasses::GMixedRelation, and GClasses::GUniformRelation.
|
pure virtual |
Returns the number of attributes (columns)
Implemented in GClasses::GMixedRelation, and GClasses::GUniformRelation.
|
pure virtual |
Swaps two attributes.
Implemented in GClasses::GArffRelation, GClasses::GMixedRelation, and GClasses::GUniformRelation.
|
static |
Performs unit tests for this class. Throws an exception if there is a failure.
|
pure virtual |
Returns the type of relation.
Implemented in GClasses::GArffRelation, GClasses::GMixedRelation, and GClasses::GUniformRelation.
|
pure virtual |
Returns the number of values in the specified attribute. (Returns 0 for continuous attributes.)
Implemented in GClasses::GMixedRelation, and GClasses::GUniformRelation.