Skip to content

Bayesian Network: Utils

osvaldosp1982 edited this page Jun 9, 2024 · 1 revision

Bayesian Network Functions and Classes

Classes

OrderedSet

  1. __init__: Initializes the set with the given iterable.
  2. add: Adds an element to the set.
  3. discard: Removes an element from the set if it exists.
  4. __contains__: Checks if an element is in the set.
  5. __len__: Returns the number of elements in the set.
  6. __iter__: Returns an iterator over the elements in the set.
  7. __str__: Returns a string representation of the set.
  8. __repr__: Returns a detailed string representation of the set.

Functions

Bayesian Network Utilities

  1. var_deps: Returns a dictionary mapping variable names to their dependencies.
  2. fillcols: Creates a hierarchical structure of variables based on their dependencies.
  3. make_tree: Constructs a hierarchical tree of the Bayesian network variables and returns it as a DataFrame.
  4. complexity_check: Checks the complexity of the Bayesian network against specified limits and returns a tuple (passes, errors).
  5. get_var_positions: Returns a dictionary mapping variable names to their positions.
  6. get_var_val_positions: Returns a dictionary mapping variable names to their value positions.
  7. get_internal_var_val_positions: Returns a dictionary mapping internal variable names to their value positions.
  8. get_var_names: Returns a dictionary mapping variable indices to their names.
  9. get_var_val_names: Returns a dictionary mapping variable names to their value names.
  10. parse_net: Parses a Bayesian network query and returns the parsed components.
  11. detect_anomalies: Detects anomalies in the given time series data using the specified Bayesian network and anomaly detection parameters.
  12. readable: Converts a response from the Bayesian network into a human-readable format.
  13. create_query: Creates a query for the Bayesian network.
  14. get_template_priors: Returns the template priors for the Bayesian network.
  15. predict_proba_adjusted: Predicts probabilities for the given evidence using the adjusted Bayesian network.
  16. batch_query: Executes a batch query on the Bayesian network.
  17. query: Executes a query on the Bayesian network.
  18. explain_why_bad: Explains why a result is bad.
  19. explain_why_good: Explains why a result is good.
  20. internal_query: Executes an internal query on the Bayesian network.
  21. explain: Provides an explanation for the given evidence and explanation list.
  22. make_nmap: Creates a mapping of value ranges.
  23. dictVarsAndValues: Returns a dictionary of variables and their values from the Bayesian network and CPT.
  24. any_of: Constructs a CPT where any of the input variables can lead to the output variable.
  25. all_of: Constructs a CPT where all of the input variables must lead to the output variable.
  26. avg: Constructs a CPT based on the average value of the input variables.
  27. if_then_else: Constructs a CPT based on if-then-else conditions.
  28. addCpt: Adds a CPT to the Bayesian network.
  29. bayesInitialize: Initializes the Bayesian network for use with Pomegranate.
  30. non_cpt_descriptions: Returns a description of the non-CPT parts of the Bayesian network.
  31. get_priors: Returns the priors for the Bayesian network.
  32. get_frequencies: Returns the frequencies of the keylist in the Bayesian network.
  33. rr_prob_a_and_not_a_given_b_and_not_b: Calculates the probabilities given relative risks.
  34. ss_prob_a_and_not_a_given_b_and_not_b: Calculates the probabilities given sensitivity and specificity.
  35. prob_a_and_not_a_given_b_and_not_b: Calculates the probabilities given invars, priors, and outvars.
  36. get_good_vars: Returns the good variables for the given variable.
  37. get_rr_vals: Returns the relative risk values for the given variable.
  38. replace_rr: Replaces the relative risk value in the invars.
  39. dependency: Constructs a dependency CPT based on the input variables and output variables.
  40. align_ci: Aligns the confidence interval.
  41. normalize_ci: Normalizes the confidence interval.
  42. get_window: Returns the window for the Bayesian network.
  43. get_stat_info: Returns the statistical information for the given variable and value.
  44. validation: Validates the given probability and condition value.
  45. dependency_direct: Directly constructs a dependency CPT based on the input variables and output variables.