Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

Data Class Reference

A class representing a multidimensional dataset. More...

#include <Data.hpp>

List of all members.

Public Member Functions

 Data ()
 Default constructor.
 Data (uint nbp, uint nbv)
 Constructor.
 ~Data ()
 Destructor.
uint Get_N ()
 Get the number of observations.
uint Get_D ()
 Get the dimension.
void Get (uint i, vector< double > &obs)
 Get the observation at a given site i.
double Get (uint i, uint d)
 Get X_i[d].
uint GetLabel (uint i)
 Get the label of site i.
void GetLabels (vector< uint > &labs)
 Get all the labels.
void Set (uint i, vector< double > const &obs)
 Set the observation at the site i.
void SetLabel (uint i, uint lab)
 Set the label of site i.
void ReadFromFile (string filename)
 read data from a file, dimension = 1
void ReadFromFile (string filename, uint dim)
 read data in file , dimension = dim
void WriteToFile (string filename)
 Write data in file.
void Stats (vector< double > &mean, vector< double > &cov)
 Compute the (empirical) mean and covariance of the data.
void K_means (uint K, vector< double > &centers, vector< uint > &labels)
 K-means algorithm.
void Info ()
 Display some (statistical) information about the dataset.


Detailed Description

Author:
Lemine Abdallahi
Date:
Aug. 2005
A dataset is a set of observations on a set of NbPts sites. These observations are supposed of dimension Dim.

The data may be labelled (TBD).


Constructor & Destructor Documentation

Data::Data  ) 
 

Default constructor for class Data

Sets the number of observations to zero, and assumes working in dimension 1.

Data::Data uint  nbp,
uint  dim
 

Constructor for class Data

Parameters:
nbp : Number of observations in the dataset.
dim : dimension.
Sets the number of observations to nbp, and assumes working in dimension dim.

Data::~Data  ) 
 

Destructor for class Data

Frees the memory used by the observation and labels associated.


Member Function Documentation

double Data::Get uint  i,
uint  d
 

Get X_i[d]

void Data::Get uint  i,
vector< double > &  obs
 

Get the observation at the site i.

Parameters:
i : a site.
obs : a vector containing the observation at the site i.

uint Data::Get_D  ) 
 

Get the dimension.

Returns:
The dimension of the dataset.

uint Data::Get_N  ) 
 

Get the number of observations.

Returns:
The number of observations in the dataset.

uint Data::GetLabel uint  i  ) 
 

Get the label at the site i.

Parameters:
i : a site.
Returns:
the label at the site i.

void Data::GetLabels vector< uint > &  labs  ) 
 

Get the labels.

Returns:
the labels at all the sites.

void Data::Info  ) 
 

Display some info about the dataset.

This method is here for verification purposes. It displays a set of (statistical ) descriptors about the data.

Current descriptos are: the size, dimension, column means , standard deviations, maxima , minima

void Data::K_means uint  K,
vector< double > &  centers,
vector< uint > &  labels
 

draw centers at random

void Data::ReadFromFile string  filename,
uint  dim
 

Read data from a text file in a specific dimension.

Parameters:
filename : File to read the data from.
dim : Dimension
The data must be read from the file sequentially.

The file must contain a sequence of dim*nbPts doubles. Dimension is set to dim.

void Data::ReadFromFile string  filename  ) 
 

Read data from a text file.

Parameters:
filename : File to read the data from.
The data must be read from the file sequentially.

The file must contain a sequence of dim*nbPts doubles. Dimension is assumed to be 1.

void Data::Set uint  i,
vector< double > const &  obs
 

Set the observation at the site i.

Parameters:
i : a site.
obs : a vector containing the new values of the observation at the site i.

void Data::SetLabel uint  i,
uint  lab
 

Set the label at the site i.

Parameters:
i : a site.
lab : the new label at the site i.

void Data::Stats vector< double > &  mean,
vector< double > &  cov
 

Compute simple statistics from the data (mean and covariance).

Useful for estimating a gaussain distribution.

void Data::WriteToFile string  filename  ) 
 

Write data to a text file.

Parameters:
filename : File to be created.
The dataset is written the file sequentially.

The file will contain a sequence of dim*nbPts double values. Each observation is written on a separated line. This format is compatible with the format required by ReadFromFile


The documentation for this class was generated from the following files:
Generated on Thu Jan 12 11:55:00 2006 for NEM by  doxygen 1.4.4