GClasses
GClasses::GUniformRelation Class Reference

Detailed Description

A relation with a minimal memory footprint that assumes all attributes are continuous, or all of them are nominal and have the same number of possible values.

#include <GMatrix.h>

Inheritance diagram for GClasses::GUniformRelation:
GClasses::GRelation

Public Member Functions

 GUniformRelation (size_t attrCount, size_t values=0)
 
 GUniformRelation (const GDomNode *pNode)
 
virtual bool areContinuous (size_t first=0, size_t count=INVALID_INDEX) const
 See the comment for GRelation::areContinuous. More...
 
virtual bool areNominal (size_t first=0, size_t count=INVALID_INDEX) const
 See the comment for GRelation::areNominal. More...
 
virtual GRelationclone () const
 Returns a copy of this object. More...
 
virtual GRelationcloneMinimal () const
 Returns a copy of this object. More...
 
virtual GRelationcloneSub (size_t, size_t count) const
 Returns a deep copy of the specified subset of this relation. More...
 
virtual void deleteAttributes (size_t index, size_t count)
 Drop 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...
 
virtual GDomNodeserialize (GDom *pDoc) const
 Serializes this object. More...
 
virtual size_t size () const
 Returns the number of attributes (columns) More...
 
virtual void swapAttributes (size_t, size_t)
 Swap two attributes (since all attributes are identical, does nothing) More...
 
virtual RelationType type () const
 Returns the type of relation. More...
 
virtual size_t valueCount (size_t) const
 Returns the number of values in each nominal attribute (or 0 if the attributes are continuous) More...
 
- Public Member Functions inherited from GClasses::GRelation
 GRelation ()
 
virtual ~GRelation ()
 
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...
 
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...
 

Protected Attributes

size_t m_attrCount
 
size_t m_valueCount
 

Additional Inherited Members

- Public Types inherited from GClasses::GRelation
- Static Public Member Functions inherited from GClasses::GRelation
static GRelationdeserialize (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...
 

Constructor & Destructor Documentation

GClasses::GUniformRelation::GUniformRelation ( size_t  attrCount,
size_t  values = 0 
)
inline
GClasses::GUniformRelation::GUniformRelation ( const GDomNode pNode)

Member Function Documentation

virtual bool GClasses::GUniformRelation::areContinuous ( size_t  first = 0,
size_t  count = INVALID_INDEX 
) const
inlinevirtual

See the comment for GRelation::areContinuous.

Implements GClasses::GRelation.

virtual bool GClasses::GUniformRelation::areNominal ( size_t  first = 0,
size_t  count = INVALID_INDEX 
) const
inlinevirtual

See the comment for GRelation::areNominal.

Implements GClasses::GRelation.

virtual GRelation* GClasses::GUniformRelation::clone ( ) const
inlinevirtual

Returns a copy of this object.

Implements GClasses::GRelation.

virtual GRelation* GClasses::GUniformRelation::cloneMinimal ( ) const
inlinevirtual

Returns a copy of this object.

Implements GClasses::GRelation.

virtual GRelation* GClasses::GUniformRelation::cloneSub ( size_t  ,
size_t  count 
) const
inlinevirtual

Returns a deep copy of the specified subset of this relation.

Implements GClasses::GRelation.

virtual void GClasses::GUniformRelation::deleteAttributes ( size_t  index,
size_t  count 
)
virtual

Drop the specified attribute.

Implements GClasses::GRelation.

virtual bool GClasses::GUniformRelation::isCompatible ( const GRelation that) const
virtual

Returns true iff this and that have the same number of values for each attribute.

Reimplemented from GClasses::GRelation.

virtual GDomNode* GClasses::GUniformRelation::serialize ( GDom pDoc) const
virtual

Serializes this object.

Implements GClasses::GRelation.

virtual size_t GClasses::GUniformRelation::size ( ) const
inlinevirtual

Returns the number of attributes (columns)

Implements GClasses::GRelation.

virtual void GClasses::GUniformRelation::swapAttributes ( size_t  ,
size_t   
)
inlinevirtual

Swap two attributes (since all attributes are identical, does nothing)

Implements GClasses::GRelation.

virtual RelationType GClasses::GUniformRelation::type ( ) const
inlinevirtual

Returns the type of relation.

Implements GClasses::GRelation.

virtual size_t GClasses::GUniformRelation::valueCount ( size_t  ) const
inlinevirtual

Returns the number of values in each nominal attribute (or 0 if the attributes are continuous)

Implements GClasses::GRelation.

Member Data Documentation

size_t GClasses::GUniformRelation::m_attrCount
protected
size_t GClasses::GUniformRelation::m_valueCount
protected