Commit 6f086b8c authored by Christophe Gonzales's avatar Christophe Gonzales

adding support for missing values in pyAgrum BNLearnrer

parent dda9d8e2
Pipeline #21698719 failed with stages
in 50 minutes and 58 seconds
......@@ -36,7 +36,7 @@ namespace gum {
// check that the database does not contain any missing value
if ( __database.hasMissingValues () )
GUM_ERROR ( MissingValueInDatabase,
"For the moment, the BNLearaner is unable to cope "
"For the moment, the BNLearner is unable to cope "
"with missing values in databases" );
// get the domain sizes of the variables
......
......@@ -60,7 +60,7 @@ from .pyAgrum import isOMP, setNumberOfThreads, getThreadNumber, getNumberOfRunn
from .pyAgrum import getNestedParallelism, setNestedParallelism
from .pyAgrum import DefaultInLabel, DuplicateElement, DuplicateLabel, EmptyBSTree, EmptySet, GumException, FatalError, FormatNotFound, GraphError, IOError, IdError, InvalidArc, InvalidArgument, InvalidArgumentsNumber, InvalidDirectedCycle, InvalidEdge, InvalidNode, NoChild, NoNeighbour, NoParent, NotFound, NullElement, OperationNotAllowed, OutOfBounds, OutOfLowerBound, OutOfUpperBound, ReferenceError, SizeError, SyntaxError, UndefinedElement, UndefinedIteratorKey, UndefinedIteratorValue, UnknownLabelInDatabase
from .pyAgrum import DefaultInLabel, DuplicateElement, DuplicateLabel, EmptyBSTree, EmptySet, GumException, FatalError, FormatNotFound, GraphError, IOError, IdError, InvalidArc, InvalidArgument, InvalidArgumentsNumber, InvalidDirectedCycle, InvalidEdge, InvalidNode, NoChild, NoNeighbour, NoParent, NotFound, NullElement, OperationNotAllowed, OutOfBounds, OutOfLowerBound, OutOfUpperBound, ReferenceError, SizeError, SyntaxError, UndefinedElement, UndefinedIteratorKey, UndefinedIteratorValue, UnknownLabelInDatabase, MissingValueInDatabase
# selection of imports extracted from dir(pyAgrum)
__all__=[
......
......@@ -30,6 +30,7 @@ static void SetPythonizeAgrumException() {
PYGUM_CATCH(FatalError)
PYGUM_CATCH(UndefinedElement)
PYGUM_CATCH(InvalidArgument)
PYGUM_CATCH(MissingValueInDatabase)
catch ( gum::Exception& e ) {
PyErr_SetString ( PyExc_Exception, e.what().c_str() );
}
......
......@@ -3406,6 +3406,36 @@ class MissingVariableInDatabase(LearningError):
MissingVariableInDatabase_swigregister = _pyAgrum.MissingVariableInDatabase_swigregister
MissingVariableInDatabase_swigregister(MissingVariableInDatabase)
class MissingValueInDatabase(LearningError):
"""Proxy of C++ gum::MissingValueInDatabase class."""
__swig_setmethods__ = {}
for _s in [LearningError]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, MissingValueInDatabase, name, value)
__swig_getmethods__ = {}
for _s in [LearningError]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, MissingValueInDatabase, name)
__repr__ = _swig_repr
def __init__(self, *args):
"""
__init__(self, aMsg, aType) -> MissingValueInDatabase
__init__(self, aMsg) -> MissingValueInDatabase
__init__(self, src) -> MissingValueInDatabase
"""
this = _pyAgrum.new_MissingValueInDatabase(*args)
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
__swig_destroy__ = _pyAgrum.delete_MissingValueInDatabase
def __del__(self):
return None
MissingValueInDatabase_swigregister = _pyAgrum.MissingValueInDatabase_swigregister
MissingValueInDatabase_swigregister(MissingValueInDatabase)
class UnknownLabelInDatabase(LearningError):
"""Proxy of C++ gum::UnknownLabelInDatabase class."""
......@@ -26415,8 +26445,10 @@ class BNLearner_double(_object):
def __init__(self, *args):
"""
__init__(self, filename, missing_symbols) -> BNLearner_double
__init__(self, filename) -> BNLearner_double
__init__(self, db) -> BNLearner_double
__init__(self, filename, src, missing_symbols) -> BNLearner_double
__init__(self, filename, src) -> BNLearner_double
__init__(self, arg2) -> BNLearner_double
__init__(self, arg2) -> BNLearner_double
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment