neurolang.probabilistic.cplogic package¶
- neurolang.probabilistic.cplogic.build_always_true_provenance_relation(relation, prob_col=None)¶
Construct a provenance set from a relation with probabilities of 1 for all tuples in the relation.
The provenance column is named after the
prob_colargument. Ifprob_colis already in the columns of the relation, it is removed before being re-added.- Parameters:
- relationNamedRelationalAlgebraFrozenSet
The relation containing the tuples that will be in the resulting provenance set.
- prob_colConstant[ColumnStr]
Name of the provenance column that will contain constant probabilities of 1.
- Returns:
- ProvenanceAlgebraSet
- neurolang.probabilistic.cplogic.fresh_name_relation(ra_set)¶
- neurolang.probabilistic.cplogic.rename_columns_for_args_to_match(relation, src_args, dst_args)¶
Rename the columns of a relation so that they match the targeted args.
- Parameters:
- relationProvenanceAlgebraSet or RelationalAlgebraOperation
The relation on which the renaming of the columns should happen.
- src_argstuple of Symbols
The predicate’s arguments currently matching the columns.
- dst_argstuple of Symbols
New args that the naming of the columns should match.
- Returns:
- RelationalAlgebraOperation
The unsolved nested operations that apply the renaming scheme.
Subpackages¶
Submodules¶
- neurolang.probabilistic.cplogic.cplogic_to_gm module
AndPlateNodeBernoulliPlateNodeCPLogicGroundingToGraphicalModelTranslatorCPLogicGroundingToGraphicalModelTranslator.add_plate_node()CPLogicGroundingToGraphicalModelTranslator.block_of_groundings()CPLogicGroundingToGraphicalModelTranslator.extensional_set_grounding()CPLogicGroundingToGraphicalModelTranslator.intensional_rule_grounding()CPLogicGroundingToGraphicalModelTranslator.probabilistic_choice_grounding()CPLogicGroundingToGraphicalModelTranslator.probfact_set_grounding()CPLogicGroundingToGraphicalModelTranslator.type
GraphicalModelNaryChoicePlateNodeNaryChoiceResultPlateNodePlateNodeProbabilisticPlateNodeis_extensional_grounding()
- neurolang.probabilistic.cplogic.gm_provenance_solver module
CPLogicGraphicalModelProvenanceSolverCPLogicGraphicalModelProvenanceSolver.and_truth_conditional_probability()CPLogicGraphicalModelProvenanceSolver.bernoulli_probability()CPLogicGraphicalModelProvenanceSolver.nary_choice_probability()CPLogicGraphicalModelProvenanceSolver.nary_choice_result()CPLogicGraphicalModelProvenanceSolver.nary_choice_result_truth_conditional_probability()CPLogicGraphicalModelProvenanceSolver.node_always_true()CPLogicGraphicalModelProvenanceSolver.single_node_truth_probability()CPLogicGraphicalModelProvenanceSolver.type
NodeValueProbabilityOperationProvenanceExpressionTransformerSelectionOutPusherSelectionOutPusherMixinSelectionOutPusherMixin.nested_same_selection()SelectionOutPusherMixin.nested_selections_not_same_tuple_symbol()SelectionOutPusherMixin.nested_tuple_selection()SelectionOutPusherMixin.njoin_left_selection()SelectionOutPusherMixin.njoin_right_selection()SelectionOutPusherMixin.selection_in_projection()SelectionOutPusherMixin.swap_rename_selection()SelectionOutPusherMixin.typeSelectionOutPusherMixin.union_of_projection()SelectionOutPusherMixin.union_of_selection_not_same_tuple_symbol()
TupleEqualSymbolTupleSymbolUnionOverTuplesUnionRemoverUnionRemoverMixinadd_query_to_program()make_conjunction_rule()ra_binary_to_nary()solve_marg_query()solve_succ_query()
- neurolang.probabilistic.cplogic.grounding module
ChaseDatalogbuild_extensional_grounding()build_grounding()build_pchoice_grounding()build_pfact_grounding_from_set()build_probabilistic_grounding()build_rule_grounding()cplogic_to_datalog()get_grounding_dependencies()get_grounding_pred_symb()get_grounding_predicate()ground_cplogic_program()remove_probability_column()topological_sort_groundings()topological_sort_groundings_util()
- neurolang.probabilistic.cplogic.problog_solver module
- neurolang.probabilistic.cplogic.program module
CPLogicMixinCPLogicMixin.add_probabilistic_choice_from_tuples()CPLogicMixin.add_probabilistic_facts_from_tuples()CPLogicMixin.extensional_database()CPLogicMixin.marg_implication()CPLogicMixin.pchoice_pred_symb_set_symbCPLogicMixin.pchoice_pred_symbsCPLogicMixin.pfact_pred_symb_set_symbCPLogicMixin.pfact_pred_symbsCPLogicMixin.predicate_symbolsCPLogicMixin.probabilistic_choices()CPLogicMixin.probabilistic_fact()CPLogicMixin.probabilistic_facts()CPLogicMixin.probabilistic_predicate_symbolsCPLogicMixin.protected_keywordsCPLogicMixin.query_based_probabilistic_choice()CPLogicMixin.query_based_probabilistic_fact()CPLogicMixin.query_based_probabilistic_predicate()CPLogicMixin.typeCPLogicMixin.union_with_probabilistic_facts()CPLogicMixin.within_language_marg_query()CPLogicMixin.within_language_prob_queries()CPLogicMixin.within_language_succ_query()
CPLogicProgram
- neurolang.probabilistic.cplogic.testing module
TestRAPToLaTeXTranslatorTestRAPToLaTeXTranslator.naturaljoin()TestRAPToLaTeXTranslator.prettify()TestRAPToLaTeXTranslator.projection()TestRAPToLaTeXTranslator.provenance_algebra_set()TestRAPToLaTeXTranslator.rename_column()TestRAPToLaTeXTranslator.selection()TestRAPToLaTeXTranslator.selection_by_tuple_symbol()TestRAPToLaTeXTranslator.typeTestRAPToLaTeXTranslator.union_over_tuples()
build_gm()build_ra_provenance_set_from_named_ra_set()eq_prov_relations()get_named_relation_tuples()inspect_resolution()make_prov_set()rap_expression_to_latex()temp_seed()