aGrUM/pyAgrum 3.3.0 released
pyAgrum
- Configuration in C++:
pyagrum.configis now the C++gum::Configuration(PyAgrumConfigurationandpyagrum/config.pyremoved), with the same API and the samedefaults.ini/pyagrum.inifiles. - Renamed configuration keys: the
default_prefix is dropped and the keys of the look of the graphs
(notebook,factorgraph,dynamicBN,influenceDiagram,credalnet,causal) are now lowerCamelCase keys
defined in aGrUM. The old names are deprecated (still accepted, with aDeprecationWarning). - Graphs drawn by aGrUM: the raw
toDot()of graphs and models now gives the look displayed in notebooks, and
accepts a newpyagrum.DotOptions(size, layout, labels, colors of nodes and arcs). Font colors can beadaptive
(black or white according to the background, the new default). Graphs given by the user are shown as they are.
Code parsing the text of atoDot()may have to be adapted. pyagrum.lib._colorsrenamedpyagrum.lib.dotstyle(deprecated relay kept);hex2rgbdeprecated (usecolor2rgb);CausalModel.toDot()argumentsSHOW_LATENT_NAMES,NODE_BG,NODE_FG,EDGE_COLdeprecated.skbn.BNClassifier:priorWeightnow defaults to the configuration.- Fixed
proba2hex(invalid colors) andCLGInference2dot(without evidence). pyAgrum requirespydot>=2. - Exceptions: all the aGrUM exceptions are now exported by
pyagrum(FactoryError,NotImplementedYet,IncompatibleEvidence,LearningError, ...).TypeErrorandIOErrorare renamedGumTypeErrorandGumIOErrorso thatfrom pyagrum import *no longer shadows the Python builtins.pyagrum.IOErroris deprecated
(useGumIOError), aspyagrum.SyntaxError: syntax errors are raised as the builtinSyntaxError(the aGrUM
class is no longer wrapped). A few checks of Python arguments (e.g.setEvidenceorsetTargetswith a wrong
type) anddel pyagrum.config[...]now raise the builtinTypeErrororSyntaxErrorinstead of the aGrUM ones.
- Configuration in C++:
aGrUM
- New:
gum::Configuration: thread-safe, typed and documented configuration singleton (defaults embedded in
the library from several sources,agrum.iniread at start-up, domains of validity, hooks,push/pop,save/load). - Defaults from the configuration: approximation schemes, sampling/Gibbs/LBP inferences, KL distances, learners
(new keylearning.BNLearnerPreferredAlgo), jgum writers and the text display of tensors read their defaults from
the configuration. The corresponding macros (DEFAULT_EPSILON,GIBBSKL_DEFAULT_*,GUM_CHI_EPSILON, ...) are
removed. - Numerical tolerances:
core.epsilonCoarse,epsilonStandardandepsilonFinereplace hard-coded literals
(some tolerances change slightly, e.g. inIBayesNet::check()andAlmostDifferent). - New
gum::dot(DotStyle,DotWriter,DotOptions, colors): all thetoDot()share the same writer, read
the configuration and acceptDotOptions; newCredalNet::toDot(); several malformed dot outputs fixed. KTBNLearnerandKTBNAdaptiveLearnergainusePC(),useFCI()anduseGreedyThickThinning().- Fixed the copy/move of
IBNLearnerandBNLearner::copyState(), which lost some options. GibbsBNdistancenow draws the variables at random by default (gibbsKL.drawnAtRandom).- Much faster reading of models with clang and MSVC (BIF, DSL, NET, UAI, O3PRM...): e.g. a large BIF file from
8 s to 0.1 s with clang. - Aggregators
min,max,median,amplitude,sumon values: they worked on the indices of the
parents, which was wrong for ranges not starting at 0 and for parents with different domains. They now work on
the values of the parents and give the closest value of the aggregator (saturated at both bounds).sumandamplitudeneed numerical variables (usecountto count the true parents),min,maxandmedianaccept
labelized variables (order of the labels) or numerical ones, but not both: an incompatible variable is rejected
withTypeError(GumTypeErrorin pyAgrum). The decomposition of aggregators now gives the right domains to the
intermediate nodes (#198, #201). The aggregators derive fromMultiDimFoldAggregator(count,exists,forall,and,or:neutralElt_()andfold_()on the indices of the parents) or fromMultiDimValueAggregator(min,max,median,amplitude,sum:buildValue_()on their values). - O3PRM: the error of a system that cannot be instantiated gives the reason (e.g. an unassigned reference slot or a
parent refused by an aggregator) instead of an unknown error.
- New:
Bug fixes (aGrUM and pyAgrum), thanks to @jschueller for issues #181 to #205
ImportanceSampling: the weight of a sample kept only the ratio of the last node (#181).- Hybrid samplers (
LoopySamplingInference,Loopy*Samplingin pyAgrum): they stopped too early, while the LBP
prior still outweighed the samples, and the prior was weighted in the wrong units with weighted samplers (#181). LoopyBeliefPropagation: the error of a sweep was never reset, so LBP stopped after two sweeps (#182).ShaferShenoyLIMIDInference: the optimal policy of a decision now keeps its decision parents (#183), and the
variance ofMEU()includes the covariances between utilities (#188, thanks to Mathias Alerini, Equinor).StructuredPlaner: action-dependent rewards are taken into account (#184);FMDPSimulatorand the planners no
longer crash on a variable without transition for an action, which now keeps its value (#187).ShaferShenoyMRFInference::jointPosterior(wanted, declared)returned the joint of the declared target, not of
the wanted one (#185).MultiDimFunctionGraphManager:setSonanderaseNodeleft inconsistent parent links (#186).MultiDimNoisyORCompound: a causal weight lower than the leak (invalid model, giving probabilities outside
[0,1]) is now rejected withOutOfBounds(#190).evidenceProbability()(LazyPropagation,ShaferShenoyInference,ShaferShenoyMRFInference) ignored the
connected components without target; the MRF one returned Z(e) instead of P(e) (#191, #193).evidenceImpact,evidenceJointImpactandjointMutualInformation(BN and MRF) no longer replace the targets
and the evidence of the user (#192).GibbsSampling: the chain could freeze on a starting state of null probability; it now starts from a state of
positive probability (or raisesIncompatibleEvidence/OperationNotAllowed) (#189); exactlyburnIn()
transitions are done andburnIn(0)is allowed (#194).MeekRules: rule R4 was not Meek's R4, so some compelled edges stayed undirected (#195, thanks to
@ldesreumaux).MultiDimNoisyORCompound,MultiDimNoisyORNet,MultiDimNoisyAND: weights outside [0,1] or NaN (and a null
leak forNoisyAND, also through its setter) are rejected (#205).BayesNet::addArcandaddWeightedArcno
longer leave an arc in the graph when the CPT refuses it.- PRM: the CPT of a cast descendant (
setAsCastDescendant) ignored the label map (#199). qBNSampling:qBNRejectionreused stale operators aftersetEvidence/useFragmentBN(#197); the quantum
registers are created in the order of the qubit map (#200); the binarized parent states follow the CPT order
(#204); a variable with a single state is rejected withOperationNotAllowedinstead of crashing (#203).