Gaia
gaia2 Namespace Reference

Main Gaia namespace, which contains all the library functions. More...

Namespaces

 convert
 Utility namespace used for various types of conversion.
 

Classes

class  AddField
 The AddField analyzer allows you to add new fields in a layout of an already existing DataSet. More...
 
class  AddFieldApplier
 AddFieldApplier applier class. More...
 
class  Analyzer
 the Analyzer abstract base class. More...
 
class  Applier
 The Applier abstract base class. More...
 
class  Array
 
class  BaseQueryOptimizer
 The QueryOptimizer class tries to optimize a query by reducing the SearchSpace on which it is supposed to operate, mostly by the means of the associated filter. More...
 
class  BaseResultSet
 This class serves as a ref-counted wrapper for a SearchSpace, which is much more convenient to deal with than having to remember who owns the results or who's responsible for deleting it. More...
 
class  BaseSearchSpace
 A SearchSpace is a structure dedicated to the task of storing pointers to Point with an associated distance and is the structure on which the nearest-neighbours queries are performed. More...
 
class  BaseSearchSpacePool
 The SearchSpacePool accomplishes 2 main functions: More...
 
class  BaseView
 The View class contains a specific view on a dataset. More...
 
class  BPFDistance
 This class composes the breakpoint function specified by its pairs of (split point, value) with the given distance. More...
 
class  Center
 The Center analyzer centers the points around the mean of each descriptor. More...
 
class  Cleaner
 The Cleaner analyzer checks for values that may cause problems when doing mathematical analysis (such as normalize, pca, ...), and removes them. More...
 
class  CosineAngleDistance
 This class computes the angle in radians between 2 points and divides it by Pi (so that it's normalized between 0 and 1). More...
 
class  CosineDistance
 
class  CosineSimilarity
 This class computes the cosine similarity of a given Region. More...
 
class  CrossSegmentDistance
 This class calculates a distance between segments from two points. More...
 
class  DataSet
 This class represents a dataset and all related information. More...
 
class  DescCompare
 Compare the descriptor names using the following criteria: More...
 
class  DescriptorTree
 
class  DistAggr
 
class  DistanceFunction
 
class  Distribute
 Distribute applier class. More...
 
class  DotProduct
 DotProduct applier class. More...
 
class  Enumerate
 The Enumerate analyzer allows you to specify a list of string descriptors which you want to be stored as enumerations. More...
 
class  EnumerateApplier
 EnumerateApplier applier class. More...
 
class  EuclideanDistance
 This class computes the euclidean distance of a given Region. More...
 
class  ExponentialCompressDistance
 This class compresses a distance from [0; inf) into [0; 1) using the following formula: dist = 1 - exp(-alpha*dist), alpha being a compression factor. More...
 
class  Extract
 The Extract analyzer allows you to extract only specific dimensions from any given number of descriptors. More...
 
class  ExtractApplier
 Extract applier class. More...
 
class  Factory
 A basic implementation of a generic factory class. More...
 
class  Filter
 The Filter class allows to check whether a predicate is true for a given Point. More...
 
class  FixLength
 The FixLength analyzer allows you to specify a list of descriptors for which you want to fix the length definitely. More...
 
class  FixLengthApplier
 FixLengthApplier applier class. More...
 
class  ForceIdentityDistance
 This metric forces the identity condition to be valid on the composed distance by checking first if the 2 points are equal and returning 0 if that is the case. More...
 
class  FrozenCosineAngleDistance
 
class  FrozenDataSet
 A FrozenDataSet is a dataset that has been flagged as immutable. More...
 
class  FrozenDistance
 
class  FrozenEuclideanDistance
 
class  FrozenExponentialCompressDistance
 
class  FrozenLinearCombinationDistance
 
class  FrozenSearchPoint
 
class  GaiaException
 Exception class that can take up to 3 arguments of any type, which will be serialized into a QString for the error message. More...
 
class  GaiaMap
 Map class (derived from QMap) but that throws a custom Exception instead of returning a default constructed value when the key isn't in there. More...
 
class  Gaussianize
 The Gaussianize analyzer fits each descriptor into a gaussian distribution. More...
 
class  InnerDim
 
class  InverseProjection
 The inverse projection Analyzer computes the inverse the previous transformation, given it was a linear projection (such as PCA or RCA). More...
 
class  Key
 
class  KeyDistance
 This class computes the harmonic distance between keys. More...
 
class  KullbackLeiblerDistance
 This class computes the symmetric Kullback-Leibler distance of a given Region. More...
 
class  LayoutAwareFactory
 A tuned implementation of a factory. More...
 
class  LinearCombinationDistance
 This class computes a distance that is the linear combination of any number of other DistanceFunctions. More...
 
class  Logger
 Asynchronous thread-safe logger object. More...
 
class  ManhattanDistance
 This class computes the Manhattan distance of a given Region. More...
 
class  MatMult
 MatMult class. More...
 
class  Merge
 Merge applier class. More...
 
class  MergeRegion
 The MergeRegion analyzer allows you to merge multiple descriptors into a single one. More...
 
class  MergeRegionApplier
 MergeRegion applier class. More...
 
class  MinkowskiDistance
 This class computes the Minkowski distance of a Region. More...
 
class  Normalize
 The Normalize analyzer normalizes real descriptors. More...
 
class  NullDistance
 This class computes a distance which is always equal to 0. More...
 
class  ParamCheckingFactory
 
class  Parameter
 
class  ParameterMap
 
class  PCA
 The PCA Analyzer computes the Principal Components Analysis of the given DataSet using the specified descriptors. More...
 
class  Point
 
class  PointArray
 A PointArray is a simple subclass of a QVector<Point*> that owns the memory to the points (hence will delete them when it is itself deleted). More...
 
class  PointLayout
 This class describes the layout of a point. More...
 
class  PointLayoutData
 
class  RandomDistance
 This class computes a distance which returns a random number between 0 and the specified range. More...
 
class  RCA
 The RCA Analyzer computes the Relevant Components Analysis of the given DataSet using the specified descriptors. More...
 
class  Region
 A region is a physical location in the point layout which consists in a list of segments. More...
 
class  Remove
 The Remove analyzer allows you to discard specific descriptors. More...
 
class  RemoveDesc
 RemoveDesc applier class. More...
 
class  RemoveVL
 The RemoveVL analyzer checks for descriptors which are variable-length descriptors, such as the list of beats, ticks, chords, etc. and removes them. More...
 
class  Rename
 The Rename analyzer allows you to rename an existing field. More...
 
class  RenameApplier
 Rename applier class. More...
 
class  ResistorAverageDistance
 This class computes the symmetric resistor-average distance of a given Region. More...
 
class  RhythmDistance
 This class computes the rhythm distance of a given descriptor. More...
 
class  Scope
 
class  ScopedData
 
class  SearchPoint
 
class  SearchSpaceWrapper
 
class  Segment
 A segment is a physical contiguous location of descriptors of the same type in the point layout. More...
 
class  Select
 The Select analyzer allows you to keep only specific descriptors. More...
 
class  SelectDesc
 SelectDesc applier class. More...
 
class  SemanticClassifierDistance
 : desc is wrong, still the wpearson one... More...
 
class  SingleValueMorphable
 
class  SortNode
 
class  SortOn
 
class  Stringifier
 
class  SummedSegmentDistance
 This class calculates a distance between segments from two points and sums the results. More...
 
class  SVMPredict
 SVMPredict applier class. More...
 
class  SVMTrain
 The SVMTrain analyzer creates a SVM model for the given dataset using libsvm. More...
 
class  TextProgress
 This class is a very simple class which allows you to print a progress percentage on the standard output. More...
 
class  Timer
 This class allows you to measure a certain amount of time, for instance if you want to know how long the execution of a given function takes. More...
 
class  TransfoChain
 
class  Transformation
 Class containing all info pertaining to a specific transformation, ie: the name of the analyzer class, the input parameters, the results of this analysis (= the applier parameters), and the name of the applier class. More...
 
class  UnscopedData
 
class  WeightedEuclideanDistance
 This class computes the euclidean distance of a given Region, applying a weight on each descriptor. More...
 
class  WeightedPearsonDistance
 This class computes the weighted Pearson correlation between 2 points. More...
 

Typedefs

typedef ParamCheckingFactory< QString, Analyzer, ParameterMapAnalyzerFactory
 
typedef Factory< QString, Applier, TransformationApplierFactory
 
typedef QMap< Segment, QPair< RealDescriptor, RealDescriptor > > CoeffMap
 
typedef QMap< QString, QVariant > VMap
 
typedef BaseView< DataSet, Point, SearchPoint, DistanceFunctionView
 
typedef SingleValueMorphable< QString > StringDescriptor
 
typedef SingleValueMorphable< Real > RealDescriptor
 
typedef SingleValueMorphable< Enum > EnumDescriptor
 
typedef BaseView< FrozenDataSet, FrozenPoint, FrozenSearchPoint, FrozenDistanceFrozenView
 
typedef LayoutAwareFactory< QString, DistanceFunction, PointLayout, ParameterMapMetricFactory
 
typedef MetricFactory DistanceFunctionFactory
 
typedef QPair< int, Real > DimWeight
 
typedef LayoutAwareFactory< QString, FrozenDistance, FrozenDataSet, ParameterMapFrozenMetricFactory
 
typedef FrozenMetricFactory FrozenDistanceFunctionFactory
 
typedef NullDistance LabelDistance
 
typedef QMap< Enum, QString > EnumMap
 
typedef QMap< QString, Enum > ReverseEnumMap
 
typedef BaseQueryOptimizer< SearchPoint, DataSetQueryOptimizer
 
typedef QPair< QString, Real > Result
 
typedef QList< Result > SearchResults
 
typedef BaseSearchSpace< SearchPoint, DataSetSearchSpace
 
typedef BaseSearchSpace< FrozenSearchPoint, FrozenDataSetFrozenSearchSpace
 
typedef BaseResultSet< SearchPoint, DataSetResultSet
 
typedef ResultSet InputSpace
 
typedef BaseSearchSpacePool< SearchPoint, DataSetSearchSpacePool
 
typedef BaseSearchSpacePool< FrozenSearchPoint, FrozenDataSetFrozenSearchSpacePool
 
typedef std::pair< float, int > fspoint
 
typedef float Real
 
typedef int Enum
 
typedef Eigen::Matrix< float, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > MatrixRXf
 
typedef Eigen::RowVectorXf FrozenPoint
 
typedef QList< QPair< Segment, Segment > > IndexMap
 
typedef BaseResultSet< FrozenSearchPoint, FrozenDataSetFrozenResultSet
 

Enumerations

enum  DebuggingModule {
  GMemory = 1 << 0, GAlgorithms = 1 << 1, GMath = 1 << 2, GParser = 1 << 3,
  GIO = 1 << 4, GPerf = 1 << 5, GTools = 1 << 6, GDataSet = 1 << 10,
  GDescriptorTree = 1 << 11, GRegion = 1 << 12, GPoint = 1 << 13, GView = 1 << 14,
  GSearchSpace = 1 << 15, GNone = 0, GAll = (1 << 30) -1
}
 
enum  DescriptorType { UndefinedType, RealType, StringType, EnumType }
 The possible types of descriptors accepted.
 
enum  DescriptorLengthType { FixedLength, VariableLength }
 Either fixed-length or variable-length.
 
enum  UpdateType { UpdateOnUnit, UpdateOnPercent }
 
enum  BinaryFileFormat { Gaia_2_0 = 100, Gaia_2_1 = 101, Gaia_2_3 = 102 }
 

Functions

QPair< Point, PointgetRegionMeanVar (const DataSet &dataset, const Region &region)
 Gets the mean and variance of the descriptors in the given region. More...
 
QPair< Point, PointgetRegionMinMax (const DataSet &dataset, const Region &region)
 Gets the mean and variance of the descriptors in the given region. More...
 
QStringList findVariableLengthDescriptors (const DataSet *dataset)
 For all variable-length descriptors in this DataSet, find all the ones which actually are of different lengths, ie: those such that there exists 2 points p1 and p2 such as len(p1.desc) != len(p2.desc). More...
 
void registerAnalyzers ()
 Registers all the analyzers available inside the AnalyzerFactory. More...
 
void registerAppliers ()
 
Real totalVariancePercentage (const VectorXd &eigenValues, int targetDimension)
 
const char * debugModuleDescription (DebuggingModule module)
 
void setDebugLevel (int levels)
 
void unsetDebugLevel (int levels)
 
template<typename T >
SingleValueMorphable< T > operator- (const T &x, const SingleValueMorphable< T > &y)
 
template<typename T >
SingleValueMorphable< T > operator/ (const T &x, const SingleValueMorphable< T > &y)
 
template<typename T >
SingleValueMorphable< T > operator+ (const T &x, const SingleValueMorphable< T > &y)
 
template<typename T >
SingleValueMorphable< T > operator* (const T &x, const SingleValueMorphable< T > &y)
 
template<typename T >
Stringifieroperator<< (Stringifier &out, const SingleValueMorphable< T > &array)
 
template<>
RealDescriptor sqrt (const RealDescriptor &x)
 
void init ()
 Init function that makes sure that all the factories have correctly registered all the types they can create. More...
 
void shutdown ()
 Shutdown function that mostly frees up resources (statically) allocated for having better performance in gaia.
 
QTextStream & operator<< (QTextStream &out, const QPair< int, int > &p)
 
QTextStream & operator<< (QTextStream &out, const QStringList &slist)
 
 GAIA_DEFINE_EXCEPTION (FixedLengthException)
 
double erfinv (double P)
 Computes the inverse error function (http://en.wikipedia.org/wiki/Error_function).
 
double norminv (double P, double mu=0, double sigma=1)
 Computes the inverse of the normal cdf with parameter mu and sigma.
 
double chi2inv (double P, int v)
 Computes the inverse of the chi-square cdf with v degrees of freedom.
 
template<typename T >
bool isnan (T x)
 
template<typename T >
bool isinf (T x)
 
template<typename T >
mean (const T *array, uint n)
 Computes the mean of an array.
 
template<typename T >
mean (const std::vector< T > &v)
 
template<typename T >
variance (const T *array, uint n)
 Computes the variance of an array.
 
template<typename T >
variance (const std::vector< T > &v)
 
template<typename T >
skewness (const T *array, uint n)
 Computes the skewness of an array. More...
 
template<typename T >
skewness (const std::vector< T > &v)
 
template<typename T >
kurtosis (const T *array, uint n)
 Computes the kurtosis of an array. More...
 
template<typename T >
kurtosis (const std::vector< T > &v)
 
template<typename RandomAccessIterator >
void sort (RandomAccessIterator first, RandomAccessIterator last)
 
template<typename RandomAccessIterator , typename StrictWeakOrdering >
void sort (RandomAccessIterator first, RandomAccessIterator last, StrictWeakOrdering comp)
 
template<typename Container >
void sort (Container &container)
 
template<typename T >
void hist (const T *array, uint n, int *n_array, T *x_array, uint n_bins)
 Given a set of values, computes the associated histogram. More...
 
template<typename T >
sgn (T x)
 
template<typename T >
intpow (T x, int n)
 Computes the integral power n of x.
 
template<template< typename > class Container, typename T >
int binarySearch (const Container< T > &v, T value)
 Iterative function for binary search (more efficient than recursive one). More...
 
template<typename T >
sqrt (const T &x)
 
Real clip (Real value, Real minv, Real maxv)
 Returns the given value clipped inside the specified interval.
 
template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > covarianceMatrix_tmpl (const PointArray &v, const Region &region)
 
Eigen::MatrixXf covarianceMatrixSinglePrecision (const PointArray &v, const Region &region)
 
Eigen::MatrixXd covarianceMatrix (const PointArray &v, const Region &region)
 Computes the covariance matrix given a set of points. More...
 
template<typename T , typename Compare >
void sortEigenVectors (Eigen::Matrix< T, Eigen::Dynamic, 1 > &values, Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &vectors, Compare cmp)
 Sort the eigen vectors and their corresponding values according to the given compare function.
 
template<typename T >
void sortEigenVectors (Eigen::Matrix< T, Eigen::Dynamic, 1 > &values, Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &vectors)
 Sort the eigen vectors and their corresponding values in ascending order.
 
void registerMetrics ()
 Registers all the metrics available inside the MetricFactory. More...
 
void registerFrozenMetrics ()
 
Real traceMatrixProduct (const Real *m1, const Real *m2, int size)
 Compute the trace of the matrix product of m1 and m2. More...
 
Real traceMatrixProductMean (const Real *m1, const Real *m2, const Real *v1, const Real *v2, int size)
 Compute the trace of the product of 2 matrices and vectors using the formula: trace((m1+m2)*(v1-v2)*(v1-v2)') More...
 
ParameterMap toParameterMap (const yaml::Node &node)
 
bool isAlwaysTrue (parser::Predicate *pred)
 Returns true if the given predicate is always true (ie: it is a boolean constant which value is True).
 
bool isAlwaysFalse (parser::Predicate *pred)
 Returns true if the given predicate is always false (ie: it is a boolean constant which value is False).
 
QDataStream & operator<< (QDataStream &out, const ScopedData &s)
 
QDataStream & operator>> (QDataStream &in, ScopedData &s)
 
QString typeToString (DescriptorType type)
 
QString lengthTypeToString (DescriptorLengthType ltype)
 
yaml::Node toYaml (const SearchResults &results)
 
template<typename SearchPointType >
bool pointerOrderCompare (const SearchPointType &p1, const SearchPointType &p2)
 
template<>
bool pointerOrderCompare (const SearchPoint &p1, const SearchPoint &p2)
 
template<>
bool pointerOrderCompare (const FrozenSearchPoint &p1, const FrozenSearchPoint &p2)
 
template<typename SearchPointType , typename DataSetType >
void copySearchPoints (BaseSearchSpace< SearchPointType, DataSetType > *dest, const BaseSearchSpace< SearchPointType, DataSetType > *src, int start, int end, int destStart)
 
template<typename SearchPointType , typename DataSetType >
void copySearchPoints (BaseSearchSpace< SearchPointType, DataSetType > *dest, const BaseSearchSpace< SearchPointType, DataSetType > *src, int start, int end)
 
template<typename SearchPointType , typename DataSetType >
void copySearchPoints (BaseSearchSpace< SearchPointType, DataSetType > *dest, const BaseSearchSpace< SearchPointType, DataSetType > *src)
 
template<typename SearchPointType >
const PointrefPoint (const SearchPointType &p, const DataSet *refDataSet)
 
template<>
const PointrefPoint (const SearchPoint &p, const DataSet *refDataSet)
 
template<>
const PointrefPoint (const FrozenSearchPoint &p, const DataSet *refDataSet)
 
template<typename SearchPointType , typename DataSetType >
const PointrefPoint (const SearchPointType &p, const BaseSearchSpace< SearchPointType, DataSetType > &sspace)
 
template<>
const PointrefPoint (const SearchPoint &p, const SearchSpace &sspace)
 
template<>
const PointrefPoint (const FrozenSearchPoint &p, const FrozenSearchSpace &sspace)
 
template<typename SearchSpaceType >
int binarySearch (const SearchSpaceType &sspace, int idx, Real value, int start, int end)
 
QString RTIME (double t)
 
void normalSearch (DataSet &dataset, const DistanceFunction *dist, const Point &query, int N)
 
template<typename DistanceFunction >
void frozenSearch (const DataSet &dataset, const float *frozenDataSet, int dimension, const float *queryPoint, int N, const DistanceFunction &dist)
 
void deepFreeze (FrozenDataSet &frozenDS, const FrozenDistance &dist, const Eigen::RowVectorXf &queryPoint, int N)
 
void deepFoldedFreeze (FrozenDataSet &frozenDS, const FrozenDistance &dist, const Eigen::RowVectorXf &queryPoint, int N)
 
void deepMultiFreeze (FrozenDataSet &frozenDS, const QList< FrozenDistance * > &dists, const QList< Eigen::RowVectorXf > queries, int N)
 
QDataStream & operator<< (QDataStream &out, const Transformation &transfo)
 
QDataStream & operator>> (QDataStream &in, Transformation &transfo)
 
QDataStream & operator<< (QDataStream &out, const TransfoChain &transfo)
 
QDataStream & operator>> (QDataStream &in, TransfoChain &transfo)
 
DataSettransform (DataSet *ds, const QString &name, const ParameterMap &params)
 
DataSetapplyTransfoChain (DataSet *ds, const QString &yamlTransfoChain)
 
DataSetapplyTransfoChain (DataSet *ds, const std::string &yamlTransfoChain)
 
template<typename T >
QDataStream & operator<< (QDataStream &out, const Array< T > &array)
 
template<typename T >
QDataStream & operator>> (QDataStream &in, Array< T > &array)
 
template<typename Key , typename Value , typename ExceptionType >
Stringifieroperator<< (Stringifier &out, const GaiaMap< Key, Value, ExceptionType > &gmap)
 
QPair< QString, int > parseDimension (const QString &dimension)
 Parse a string representing a descriptor + optional dimension as a QPair<QString, int>. More...
 
void checkIsomorphDataSets (const DataSet *dataset1, const DataSet *dataset2, bool checkOriginalLayout=true)
 Returns normally if both dataset are isomorph, meaning that they can be linked together, merged together, etc... More...
 
QStringList selectDescriptors (const PointLayout &layout, DescriptorType type=UndefinedType, const QStringList &select=QStringList("*"), const QStringList &exclude=QStringList(), bool failOnUnmatched=true)
 This function returns the region of descriptors from a layout that match the patterns given by the select argument but that do not match the ones given by the exclude argument.
 
void createIndexMappings (const PointLayout &oldLayout, PointLayout &newLayout, const Region &region, IndexMap &realMap, IndexMap &stringMap, IndexMap &enumMap)
 Creates mappings from indices in the NEW layout to indices in the OLD layout.
 
void transferPointData (const Point *p, Point *result, const IndexMap &realMap, const IndexMap &stringMap, const IndexMap &enumMap)
 Given a set of mappings, transfers the data from a Point to a new one.
 
PointmapPoint (const Point *p, const PointLayout &newLayout, const IndexMap &realMap, const IndexMap &stringMap, const IndexMap &enumMap)
 Creates a new Point that is a mapping of the given one, copying only those descriptors that are in newLayout. More...
 
RealDescriptor mergeDescriptors (const Point *p, int nseg, const Region &region)
 Merges the descriptors contained into the given region into a single one.
 
PointLayout mergeLayouts (const PointLayout &layout1, const PointLayout &layout2)
 Merges two PointLayouts together, provided that they don't overlap.
 
PointmergePoints (const Point *ds1, const Point *ds2)
 Merges two points together, provided that their layout don't overlap, and return the resulting point.
 
DataSetmergeDataSets (const DataSet *ds1, const DataSet *ds2)
 Merges two datasets together, provided that their layout don't overlap, and return the resulting dataset.
 
QMap< int, QString > mapRegionIndicesToNames (const Region &region, const DataSet *dataset)
 Given a DataSet (for reference) and a Region, returns the mapping between the region indices and the names of the corresponding descriptors. More...
 
QList< QPair< double, QString > > dimensionParticipation (const Eigen::VectorXd &values, const QMap< int, QString > &dnames)
 Given a list of values and a map from their indices to their respective names, returns a list of pairs containing the participation of each original dimension in the target space, expressed as a percentage of the total (meaning the sum of the participation is equal to 100).
 
QList< QPair< double, QString > > dimensionBoost (const Eigen::MatrixXf &featureVector, const Region &region, const DataSet *dataset)
 Dimension boost after applying the rotation/scaling defined by the given base vectors. More...
 
QString formatDimensionParticipation (const QList< QPair< double, QString > > &participation, bool ratio=false)
 Formats the results of the dimensionParticipation function into a nicely printable string. More...
 
QMap< QString, QList< int > > dimensionListToMapping (const QStringList &dims)
 Converts a list of dimensions names in the format descriptorName[dim] to a map of descriptor name to list of integers representing the dimensions selected for each one.
 
int gaiaVersion (const QDataStream &stream)
 Returns the Gaia version of this stream.
 
void setDataStreamVersion (QDataStream &out)
 Sets the version of the QDataStream to the current version of Gaia. More...
 
void checkValidDataStream (QDataStream &in)
 Checks that the input QDataStream is a valid one (ie: supported by our version of Gaia) and sets its corresponding type so that it's ready to be read.
 
int memoryUsage (QString mtype="VmSize")
 Returns the memory currently used by this process, in KBs. More...
 
QString mergeName (const QStringList &name)
 Utility function that merges a sequence of node names into a single fully-qualified name.
 
QStringList splitName (const QString &name, bool includeRootNode=false)
 Splits a fully-qualified name into its consecutive node names.
 

Variables

int activatedDebugLevels = 0
 
Logger loggerInstance
 
bool verbose
 Flag that controls whether gaia should be silent or not, in general. More...
 
const char * version = GAIA_VERSION
 
const char * version_git_sha = GAIA_GIT_SHA
 
const ParameterMap noParams
 

Detailed Description

Main Gaia namespace, which contains all the library functions.

Function Documentation

template<template< typename > class Container, typename T >
int gaia2::binarySearch ( const Container< T > &  v,
value 
)

Iterative function for binary search (more efficient than recursive one).

If n is the size of the vector, the returned value will be between 0 and n (inclusive) and correspond to the interval between numbers. Ex: r = 0 means it is lower than the lowest value in v, r = n means it is greater than the greatest value in v.

Referenced by gaia2::Distribute::mapPoint(), and gaia2::DataSet::pointIndex().

void gaia2::checkIsomorphDataSets ( const DataSet dataset1,
const DataSet dataset2,
bool  checkOriginalLayout = true 
)

Returns normally if both dataset are isomorph, meaning that they can be linked together, merged together, etc...

In particular, they need to have exactly the same points and the same original layout (we don't care about the transformation history). In the case they aren't, throw an exception with an error message. In case any of the 2 datasets is the null pointer, this doesn't throw an exception.

References gaia2::Point::name(), and gaia2::DataSet::originalLayout().

Referenced by mergeDataSets(), gaia2::DataSet::setReferenceDataSet(), and splitName().

Eigen::MatrixXd gaia2::covarianceMatrix ( const PointArray v,
const Region region 
)

Computes the covariance matrix given a set of points.

Parameters
vthe set of points for which to compute the covariance matrix.
regionthe Region containing the descriptors to be included in the covariance matrix computation.

Referenced by gaia2::RCA::analyze(), and gaia2::RCA::computeCovarianceMatrix().

QList< QPair< double, QString > > gaia2::dimensionBoost ( const Eigen::MatrixXf &  featureVector,
const Region region,
const DataSet dataset 
)

Dimension boost after applying the rotation/scaling defined by the given base vectors.

Useful in particular in RCA (where the vectors are not an orthonormal base).

References mapRegionIndicesToNames().

Referenced by gaia2::RCA::analyze(), and splitName().

QStringList gaia2::findVariableLengthDescriptors ( const DataSet dataset)

For all variable-length descriptors in this DataSet, find all the ones which actually are of different lengths, ie: those such that there exists 2 points p1 and p2 such as len(p1.desc) != len(p2.desc).

If there is a descriptor which has len == 0 for all points, then this descriptor is considered variable-length as well. The rationale is the following: if they're all empty, it only makes sense if they're actually lists of values which (by chance) happen to be all empty, but it can in no case be a fixed-length descriptor, because that would be completely stupid to have such an empty descriptor.

References gaia2::PointLayout::descriptorName(), gaia2::DataSet::layout(), and gaia2::PointArray::samplePoint().

QString gaia2::formatDimensionParticipation ( const QList< QPair< double, QString > > &  participation,
bool  ratio = false 
)

Formats the results of the dimensionParticipation function into a nicely printable string.

If ratio == true, prints "x 1.23" instead of "1.23%".

Referenced by gaia2::RCA::analyze(), and splitName().

QPair< Point, Point > gaia2::getRegionMeanVar ( const DataSet dataset,
const Region region 
)

Gets the mean and variance of the descriptors in the given region.

As those concepts only make sense for real numbers, the string descriptors contained in this region will be silently ignored. This function requires all descriptors in the region to be fixed-length, otherwise it throws an exception.

References gaia2::Region::checkLengthTypeOnlyFrom(), gaia2::PointLayout::copy(), gaia2::DataSet::layout(), gaia2::Region::select(), gaia2::Point::setLayout(), and gaia2::PointArray::totalSegments().

QPair< Point, Point > gaia2::getRegionMinMax ( const DataSet dataset,
const Region region 
)

Gets the mean and variance of the descriptors in the given region.

As those concepts only make sense for real numbers, the string descriptors contained in this region will be silently ignored. This function requires all descriptors in the region to be fixed-length, otherwise it throws an exception.

References gaia2::Region::checkLengthTypeOnlyFrom(), gaia2::PointLayout::copy(), gaia2::DataSet::layout(), gaia2::PointArray::samplePoint(), gaia2::Region::select(), and gaia2::Point::setLayout().

template<typename T >
void gaia2::hist ( const T *  array,
uint  n,
int *  n_array,
T *  x_array,
uint  n_bins 
)

Given a set of values, computes the associated histogram.

This method is designed to work the same way as in MatLab/Octave. It is based on the algorithms used in Octave rather than Matlab. The result structures (n_arr, x_arr) have to be allocated before calling this function.

Parameters
arraythe input array, containing the data values
nthe number of elements of this array
n_arraythe array where the distribution will be written
x_arraythe array that will contain the centers of each bin
n_binsthe number of desired bins for the distribution
void gaia2::init ( )

Init function that makes sure that all the factories have correctly registered all the types they can create.

You need to call this function once in your program, as soon as you can.

References registerAnalyzers(), and registerMetrics().

template<typename T >
T gaia2::kurtosis ( const T *  array,
uint  n 
)

Computes the kurtosis of an array.

It is mathematically defined as: kurtosis = mu_4 / mu_2**{2}, where mu_i is the i_th central moment.

References mean(), and variance().

Point * gaia2::mapPoint ( const Point p,
const PointLayout newLayout,
const IndexMap &  realMap,
const IndexMap &  stringMap,
const IndexMap &  enumMap 
)
QMap< int, QString > gaia2::mapRegionIndicesToNames ( const Region region,
const DataSet dataset 
)

Given a DataSet (for reference) and a Region, returns the mapping between the region indices and the names of the corresponding descriptors.

This function will throw if the Region is not composed of a single type of descriptors.

References gaia2::PointLayout::descriptorName(), gaia2::DataSet::layout(), gaia2::PointArray::samplePoint(), gaia2::Region::select(), and gaia2::Region::type().

Referenced by dimensionBoost(), and splitName().

int gaia2::memoryUsage ( QString  mtype = "VmSize")

Returns the memory currently used by this process, in KBs.

mtype can be either one of:

  • VmSize: total virtual memory
  • VmRSS: resident segment size

NB: Only works on linux at the moment, will return 0 on other platforms.

Referenced by splitName().

QPair< QString, int > gaia2::parseDimension ( const QString &  dimension)

Parse a string representing a descriptor + optional dimension as a QPair<QString, int>.

In case the dimension is not specified, 0 will be returned.

Referenced by gaia2::Distribute::mapPoint(), and splitName().

void gaia2::registerAnalyzers ( )

Registers all the analyzers available inside the AnalyzerFactory.

NB: For the python docstrings to work correctly, the name with which the analyzer is registered needs to be the exact same name as the class name (case-sensitive).

Referenced by init().

void gaia2::registerMetrics ( )

Registers all the metrics available inside the MetricFactory.

NB: For the python docstrings to work correctly, the name with which the distance is registered needs to be the exact same name as the class name, with the trailing "Distance" removed (case-sensitive).

References gaia2::PointLayout::descriptorLocation(), and selectDescriptors().

Referenced by init().

void gaia2::setDataStreamVersion ( QDataStream &  out)

Sets the version of the QDataStream to the current version of Gaia.

This function must be called before serializing anything in the stream.

Referenced by gaia2::DataSet::mergeFiles(), gaia2::TransfoChain::retransformDataSet(), gaia2::FrozenDataSet::save(), splitName(), gaia2::Point::toBase64(), and gaia2::DataSet::toBase64().

template<typename T >
T gaia2::skewness ( const T *  array,
uint  n 
)

Computes the skewness of an array.

It is mathematically defined as: skewness = mu_3 / mu_2**{3/2}, where mu_i is the i_th central moment.

References mean(), and variance().

Real gaia2::traceMatrixProduct ( const Real *  m1,
const Real *  m2,
int  size 
)
inline

Compute the trace of the matrix product of m1 and m2.

Both matrices need to be squared of dimension size.

Referenced by gaia2::KullbackLeiblerDistance::operator()().

Real gaia2::traceMatrixProductMean ( const Real *  m1,
const Real *  m2,
const Real *  v1,
const Real *  v2,
int  size 
)
inline

Compute the trace of the product of 2 matrices and vectors using the formula: trace((m1+m2)*(v1-v2)*(v1-v2)')

m1 and m2 are square matrices of dimension size, v1 and v2 are vectors of dimension size.

Referenced by gaia2::KullbackLeiblerDistance::operator()().

Variable Documentation

bool gaia2::verbose

Flag that controls whether gaia should be silent or not, in general.

That could include information such as transformation progress, time needed for doing queries, etc...