Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • P PRIMO
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 8
    • Issues 8
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 1
    • Merge requests 1
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Social Cognitive SystemsSocial Cognitive Systems
  • PRIMO
  • Merge requests
  • !10

Create Marginal class as common return type for inference methods

  • Review changes

  • Download
  • Email patches
  • Plain diff
Open Jan Pöppel requested to merge jpoeppel:marginals into master Feb 23, 2017
  • Overview 4
  • Commits 9
  • Changes 6

Created by: jpoeppel

This is a work in progress. So far I've started creating fundamental tests for the different use cases that we have considered. They still need to be expanded upon with more complex marginals as well as other convenience functions. The reason I am already opening the PR is to discuss the proposed interface, which is already quite flexible, but I am not too sure about the dictionary return yet.

Currently I handle a request like m.get_probabilities({"A":["True","False"]}, returnDict=True}) for a marginal containing the binary variables A and B like so:

{"True": np.array([P(A=True, B=True), P(A=True, B=False)]), "False": np.array([P(A=False, B=True), P(A=False, B=False)])}.

A request such as: m.get_probabilities({"A":["True", "False"], "B": "False"}, returnDict=True}) [note that you do not have to insert single instantiations in lists, but can just specify them as values directly] yields:

{A: {"True": np.array([P(A=True, B=False)]), "False":np.array(P(A=False,B=False))}, B: {"False": np.array([P(A=True,B=False)])}}

since the request desires the probability for this combination. When returnDict=False this method basically behaves as Factor.get_potential with the additional convencience of not having to specify single instantiations in lists as well as allowing things like "get_probabilities("A")".

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: jpoeppel:marginals