aGrUM  0.13.2
gum::learning Namespace Reference

Classes

struct  __GraphChangesGenerator4K2
 
class  Apriori
 the base class for all apriori More...
 
class  AprioriDirichletFromDatabase
 A dirichlet priori: computes its N'_ijk from a database. More...
 
struct  AprioriDirichletType
 
class  AprioriNoApriori
 the no a priori class: corresponds to 0 weight-sample More...
 
struct  AprioriNoAprioriType
 
class  AprioriSmoothing
 the smooth a priori: adds a weight w to all the countings More...
 
struct  AprioriSmoothingType
 
class  ArcAddition
 The class for notifying learning algorithms of new arc additionsThis class is convenient to know at compile time which graph change we are dealing with. More...
 
class  ArcDeletion
 The class for notifying learning algorithms of arc removalsThis class is convenient to know at compile time which graph change we are dealing with. More...
 
class  ArcReversal
 The class for notifying learning algorithms of arc reversalsThis class is convenient to know at compile time which graph change we are dealing with. More...
 
class  BNDatabaseGenerator
 
class  BNLearner
 A pack of learning algorithms that can easily be used. More...
 
class  BNLearnerListener
 A class that redirects gum_signal from algorithms to the listeners of BNLearn. More...
 
class  Cache43ptInfo
 
class  Cache4IndepTest
 
class  Cache4PartEntropy
 a cache for caching partial entropy in PartEntropy classCaching previously computed scores is very important for learning algorithms because computing a score requires parsing the database and this is the most time consuming operation in learning. More...
 
class  Cache4Score
 a cache for caching 3 points mutual information in 3off2Caching previously computed scores is very important for learning algorithms because computing independence tests requires parsing the database and this is the most time consuming operation in learning. More...
 
class  CorrectedMutualInformation
 class CorrectedMutualInformation, used in the 3off2 algorithm More...
 
class  Counter
 The counting class for all the scores used for learning (BIC, BDeu, etc) as well as for all the independence tests. More...
 
class  CSVParser
 Class for fast parsing of CSV file (never more than one line in application memory) More...
 
class  DAG2BNLearner
 A class that, given a structure and a parameter estimator returns a full Bayes net. More...
 
class  DatabaseTable
 The class representing a tabular database as used by learning tasks. More...
 
class  DBCell
 The class representing the original values of the cells of databases. More...
 
class  DBHandler
 The base class for all database handlers. More...
 
class  DBInitializerFromCSV
 The class for initializing DatabaseTable and RawDatabaseTable instances from CSV files. More...
 
class  DBInitializerFromSQL
 The class for initializing DatabaseTable and RawDatabaseTable instances from SQL databases. More...
 
class  DBRow
 The class for storing a record in a database. More...
 
class  DBRowGenerator
 The base class for all DBRow generators. More...
 
class  DBRowGeneratorIdentity
 A DBRowGenerator class that returns exactly the rows it gets in input. More...
 
class  DBRowGeneratorParser
 the class used to read a row in the database and to transform it into a set of DBRow instances that can be used for learning. More...
 
class  DBRowGeneratorSet
 The class used to pack sets of generators. More...
 
union  DBTranslatedValue
 The union class for storing the translated values in learning databases. More...
 
class  DBTranslator
 The base class for all the tabular database cell translators. More...
 
class  DBTranslator4ContinuousVariable
 The databases' cell translators for continuous variables. More...
 
class  DBTranslator4DiscretizedVariable
 The databases' cell translators for discretized variables. More...
 
class  DBTranslator4LabelizedVariable
 The databases' cell translators for labelized variables. More...
 
class  DBTranslator4RangeVariable
 The databases' cell translators for range variables. More...
 
class  DBTranslatorSet
 the class for packing together the translators used to preprocess the datasets More...
 
class  EdgeAddition
 The class for notifying learning algorithms of new edge additionsThis class is convenient to know at compile time which graph change we are dealing with. More...
 
class  EdgeDeletion
 The class for notifying learning algorithms of edge removalsThis class is convenient to know at compile time which graph change we are dealing with. More...
 
class  genericBNLearner
 A pack of learning algorithms that can easily be used. More...
 
class  GraphChange
 
class  GraphChangesGenerator4DiGraph
 The basic class for computing the next graph changes possible in a structure learning algorithm. More...
 
class  GraphChangesGenerator4K2
 The basic class for computing the next graph changes possible in a structure learning algorithm. More...
 
class  GraphChangesGenerator4UndiGraph
 The basic class for computing the next graph changes possible in an undirected structure learning algorithm. More...
 
class  GraphChangesGeneratorOnSubDiGraph
 The basic class for computing the next graph changes possible in a structure learning algorithm. More...
 
class  GraphChangesSelector4DiGraph
 The mecanism to compute the next available graph changes for directed structure learning search algorithms. More...
 
class  GreaterAbsPairOn2nd
 
class  GreaterPairOn2nd
 
class  GreaterTupleOnLast
 
class  GreedyHillClimbing
 The greedy hill climbing learning algorithm (for directed graphs) More...
 
class  IDatabaseTable
 The common class for the tabular database tables. More...
 
struct  IDatabaseTableInsert4DBCell
 
struct  IDatabaseTableInsert4DBCell< ALLOC, false >
 
struct  IDatabaseTableInsert4DBCell< ALLOC, true >
 
class  IDBInitializer
 The base class for initializing DatabaseTable and RawDatabaseTable instances from CSV files or SQL databases. More...
 
class  IdSet
 transforms an unordered set of ids into an (increasingly) ordered one More...
 
class  IGraphChangesGenerator4DiGraph
 
class  IGraphChangesGenerator4UndiGraph
 
class  IndependenceTest
 the abstract class for all the independence testsThe class should be used as follows: first, to speed-up computations, you should consider computing all the independence tests you need in one pass. More...
 
class  IndepTestChi2
 the class for computing Chi2 independence test scoresThe class should be used as follows: first, to speed-up computations, you should consider computing all the independence tests you need in one pass. More...
 
class  IndepTestG2
 the class for computing G2 independence test scores
 The class should be used as follows: first, to speed-up computations,
 you should consider computing all the independence tests you need in one
 pass.
More...
 
class  K2
 The K2 algorithm. More...
 
class  KNML
 the class for computing Chi2 independence test scores More...
 
class  LocalSearchWithTabuList
 The local search with tabu list learning algorithm (for directed graphs) More...
 
class  Miic
 The miic learning algorithm. More...
 
class  NanodbcParser
 Class for parsing SQL results using Nanodbc. More...
 
class  ParamEstimator
 The base class for estimating parameters of CPTsThe class should be used as follows: first, to speed-up computations, you should consider computing all the parameters you need in one pass. More...
 
class  ParamEstimatorML
 The class for estimating parameters of CPTs using Maximum LikelihoodThe class should be used as follows: first, to speed-up computations, you should consider computing all the parameters you need in one pass. More...
 
class  PartialEntropy
 
class  RawDatabaseTable
 The table containing the raw/original data of a databaseClass RawDatabaseTable is intended to store in RAM the raw/original data of a database. More...
 
class  RecordCounter
 The class that computes countings of observations from the database. More...
 
class  RecordCounterThread
 This class computes the number of observations of tuples of variables in the database A RecordCounterThread just computes the number of records observed for each value of its target nodes in the database (a target node usually represents either a single Discrete Variable or a pair of Discrete Variables). More...
 
class  RecordCounterThreadBase
 The database-independent class for preparing the computation of the number of observations of tuples of variables in a database. More...
 
class  Score
 The base class for all the scores used for learning (BIC, BDeu, etc)The class should be used as follows: first, to speed-up computations, you should consider computing all the scores you need in one pass. More...
 
class  ScoreAIC
 the class for computing AIC scores More...
 
class  ScoreBD
 The class for computing Bayesian Dirichlet (BD) log2 scores. More...
 
class  ScoreBDeu
 The class for computing BDeu scores (actually their log2 value) More...
 
class  ScoreBIC
 The class for computing BIC scores. More...
 
class  ScoreInternalApriori
 the base class for all the score's internal apriorisSome scores include an apriori. More...
 
class  ScoreInternalBDeuApriori
 the internal apriori for the BDeu score (N' / (r_i * q_i)Some scores include an apriori. More...
 
class  ScoreInternalK2Apriori
 the internal apriori for the K2 score: Laplace AprioriSome scores include an apriori. More...
 
class  ScoreInternalNoApriori
 the internal apriori for the scores without apriori (e.g., BD)Some scores include an apriori. More...
 
class  ScoreK2
 The class for computing K2 scores (actually their log2 value) More...
 
class  ScoreLog2Likelihood
 the class for computing log2-likelihood scores More...
 
class  StructuralConstraintDAG
 The base class for structural constraints imposed by DAGs. More...
 
class  StructuralConstraintDiGraph
 The base class for structural constraints used by learning algorithms that learn a directed graph structure. More...
 
class  StructuralConstraintEmpty
 the base class for all structural constraints More...
 
class  StructuralConstraintForbiddenArcs
 the structural constraint for forbidding the creation of some arcs during structure learning More...
 
class  StructuralConstraintIndegree
 the class for structural constraints limiting the number of parents of nodes in a directed graph More...
 
class  StructuralConstraintMandatoryArcs
 the structural constraint indicating that some arcs shall never be removed or reversed More...
 
class  StructuralConstraintSetStatic
 the "meta-programming" class for storing structural constraintsIn aGrUM, there are two ways to store sets of structural constraints: the first one is to put them into a StructuralConstraintSetDynamic. More...
 
class  StructuralConstraintSliceOrder
 the structural constraint imposing a partial order over nodes More...
 
class  StructuralConstraintTabuList
 The class imposing a N-sized tabu list as a structural constraints for learning algorithms. More...
 
class  StructuralConstraintUndiGraph
 The base class for structural constraints used by learning algorithms that learn an undirected graph structure. More...
 

Enumerations

enum  DBRowGeneratorGoal : char { DBRowGeneratorGoal::ONLY_REMOVE_MISSING_VALUES, DBRowGeneratorGoal::OTHER_THINGS_THAN_REMOVE_MISSING_VALUES }
 the type of things that a DBRowGenerator is designed for More...
 
enum  DBTranslatedValueType : char { DBTranslatedValueType::DISCRETE, DBTranslatedValueType::CONTINUOUS }
 The nature of the elements handled by translators (discrete, continuous). More...
 
enum  GraphChangeType {
  ARC_ADDITION, ARC_DELETION, ARC_REVERSAL, EDGE_ADDITION,
  EDGE_DELETION
}
 the type of modification that can be applied to the graph More...
 

Functions

DatabaseTable readFile (const std::string &filename)
 
template<typename Alloc >
std::ostream & operator<< (std::ostream &stream, const IdSet< Alloc > &idset)
 the display operator More...
 
std::ostream & operator<< (std::ostream &stream, const GraphChange &change)
 a << operator for GraphChanges More...
 
std::ostream & operator<< (std::ostream &stream, const ArcAddition &change)
 a << operator for ArcAddition More...
 
std::ostream & operator<< (std::ostream &stream, const ArcDeletion &change)
 a << operator for ArcDeletion More...
 
std::ostream & operator<< (std::ostream &stream, const ArcReversal &change)
 a << operator for ArcReversal More...
 
std::ostream & operator<< (std::ostream &stream, const EdgeAddition &change)
 a << operator for EdgeAddition More...
 
std::ostream & operator<< (std::ostream &stream, const EdgeDeletion &change)
 a << operator for EdgeDeletion More...
 

Enumeration Type Documentation

the type of modification that can be applied to the graph

Enumerator
ARC_ADDITION 
ARC_DELETION 
ARC_REVERSAL 
EDGE_ADDITION 
EDGE_DELETION 

Definition at line 44 of file graphChange.h.

Function Documentation

std::ostream & gum::learning::operator<< ( std::ostream &  stream,
const GraphChange change 
)

a << operator for GraphChanges

Definition at line 105 of file graphChange.cpp.

References gum::learning::GraphChange::toString().

105  {
106  return stream << change.toString();
107  }

+ Here is the call graph for this function:

std::ostream & gum::learning::operator<< ( std::ostream &  stream,
const ArcAddition change 
)

a << operator for ArcAddition

Definition at line 110 of file graphChange.cpp.

References gum::learning::ArcAddition::toString().

110  {
111  return stream << change.toString();
112  }

+ Here is the call graph for this function:

std::ostream & gum::learning::operator<< ( std::ostream &  stream,
const ArcDeletion change 
)

a << operator for ArcDeletion

Definition at line 115 of file graphChange.cpp.

References gum::learning::ArcDeletion::toString().

115  {
116  return stream << change.toString();
117  }

+ Here is the call graph for this function:

std::ostream & gum::learning::operator<< ( std::ostream &  stream,
const ArcReversal change 
)

a << operator for ArcReversal

Definition at line 120 of file graphChange.cpp.

References gum::learning::ArcReversal::toString().

120  {
121  return stream << change.toString();
122  }

+ Here is the call graph for this function:

std::ostream & gum::learning::operator<< ( std::ostream &  stream,
const EdgeAddition change 
)

a << operator for EdgeAddition

Definition at line 125 of file graphChange.cpp.

References gum::learning::EdgeAddition::toString().

125  {
126  return stream << change.toString();
127  }

+ Here is the call graph for this function:

std::ostream & gum::learning::operator<< ( std::ostream &  stream,
const EdgeDeletion change 
)

a << operator for EdgeDeletion

Definition at line 130 of file graphChange.cpp.

References gum::learning::EdgeDeletion::toString().

130  {
131  return stream << change.toString();
132  }

+ Here is the call graph for this function:

template<typename Alloc >
std::ostream& gum::learning::operator<< ( std::ostream &  stream,
const IdSet< Alloc > &  idset 
)

the display operator

DatabaseTable gum::learning::readFile ( const std::string &  filename)

Definition at line 392 of file genericBNLearner.cpp.

References gum::learning::IDBInitializer< ALLOC >::fillDatabase(), GUM_ERROR, gum::learning::DBTranslatorSet< ALLOC >::insertTranslator(), gum::learning::DatabaseTable< ALLOC >::setVariableNames(), and gum::learning::IDBInitializer< ALLOC >::variableNames().

392  {
393  // get the extension of the file
394  Size filename_size = Size(filename.size());
395 
396  if (filename_size < 4) {
397  GUM_ERROR(FormatNotFound,
398  "genericBNLearner could not determine the "
399  "file type of the database");
400  }
401 
402  std::string extension = filename.substr(filename.size() - 4);
403  std::transform(
404  extension.begin(), extension.end(), extension.begin(), ::tolower);
405 
406  if (extension != ".csv") {
407  GUM_ERROR(OperationNotAllowed,
408  "genericBNLearner does not support yet this type "
409  "of database file");
410  }
411 
412  DBInitializerFromCSV<> initializer(filename);
413 
414  const auto& var_names = initializer.variableNames();
415  const std::size_t nb_vars = var_names.size();
416 
417  DBTranslatorSet<> translator_set;
418  DBTranslator4LabelizedVariable<> translator;
419  for (std::size_t i = 0; i < nb_vars; ++i) {
420  translator_set.insertTranslator(translator, i);
421  }
422 
423  DatabaseTable<> database(translator_set);
424  database.setVariableNames(initializer.variableNames());
425  initializer.fillDatabase(database);
426 
427  return database;
428  }
unsigned long Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:50
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66

+ Here is the call graph for this function: