![]() |
ProvSQL SQL API
Adding support for provenance and uncertainty management to PostgreSQL databases
|
Functions for computing probabilities, expected values, and game-theoretic contribution measures (Shapley/Banzhaf values) from provenance circuits. More...
Functions | |
| DOUBLE PRECISION | provsql.probability_evaluate (UUID token, TEXT method=NULL, TEXT arguments=NULL) |
| Compute the probability of a provenance token. | |
| DOUBLE PRECISION | provsql.expected (ANYELEMENT input, UUID prov=gate_one(), TEXT method=NULL, TEXT arguments=NULL) |
| Compute the expected value of an aggregate expression. | |
| DOUBLE PRECISION | provsql.shapley (UUID token, UUID variable, TEXT method=NULL, TEXT arguments=NULL, BOOLEAN banzhaf='f') |
| Compute the Shapley value of an input variable. | |
| SETOF RECORD | provsql.shapley_all_vars (UUID token, TEXT method=NULL, TEXT arguments=NULL, BOOLEAN banzhaf='f', OUT UUID variable, OUT DOUBLE PRECISIONvalue) |
| Compute Shapley values for all input variables at once. | |
| DOUBLE PRECISION | provsql.banzhaf (UUID token, UUID variable, TEXT method=NULL, TEXT arguments=NULL) |
| Compute the Banzhaf power index of an input variable. | |
| SETOF RECORD | provsql.banzhaf_all_vars (UUID token, TEXT method=NULL, TEXT arguments=NULL, OUT UUID variable, OUT DOUBLE PRECISIONvalue) |
| Compute Banzhaf power indices for all input variables at once. | |
Functions for computing probabilities, expected values, and game-theoretic contribution measures (Shapley/Banzhaf values) from provenance circuits.
| DOUBLE PRECISION provsql.banzhaf | ( | UUID | token, |
| UUID | variable, | ||
| TEXT | method = NULL, |
||
| TEXT | arguments = NULL |
||
| ) |
Compute the Banzhaf power index of an input variable.
| SETOF RECORD provsql.banzhaf_all_vars | ( | UUID | token, |
| TEXT | method = NULL, |
||
| TEXT | arguments = NULL, |
||
| OUT UUID | variable, | ||
| OUT DOUBLE PRECISION | value | ||
| ) |
Compute Banzhaf power indices for all input variables at once.
| DOUBLE PRECISION provsql.expected | ( | ANYELEMENT | input, |
| UUID | prov = gate_one(), |
||
| TEXT | method = NULL, |
||
| TEXT | arguments = NULL |
||
| ) |
Compute the expected value of an aggregate expression.
Computes E[input | prov], the expected value of an aggregate result conditioned on a provenance expression. Supports SUM, MIN, and MAX aggregation functions.
| input | aggregate expression (AGG_TOKEN) to compute the expected value of |
| prov | provenance condition (defaults to gate_one(), i.e., unconditional) |
| method | knowledge compilation method |
| arguments | additional arguments for the method |
| DOUBLE PRECISION provsql.probability_evaluate | ( | UUID | token, |
| TEXT | method = NULL, |
||
| TEXT | arguments = NULL |
||
| ) |
Compute the probability of a provenance token.
Compiles the provenance circuit to d-DNNF and evaluates the probability. The compilation method can be selected explicitly.
| token | provenance token to evaluate |
| method | knowledge compilation method (NULL for default) |
| arguments | additional arguments for the method |
| DOUBLE PRECISION provsql.shapley | ( | UUID | token, |
| UUID | variable, | ||
| TEXT | method = NULL, |
||
| TEXT | arguments = NULL, |
||
| BOOLEAN | banzhaf = 'f' |
||
| ) |
Compute the Shapley value of an input variable.
Measures the contribution of a specific input variable to the truth of a provenance expression, using game-theoretic Shapley values.
| token | provenance token to evaluate |
| variable | UUID of the input variable |
| method | knowledge compilation method |
| arguments | additional arguments for the method |
| banzhaf | if true, compute the Banzhaf value instead |
| SETOF RECORD provsql.shapley_all_vars | ( | UUID | token, |
| TEXT | method = NULL, |
||
| TEXT | arguments = NULL, |
||
| BOOLEAN | banzhaf = 'f', |
||
| OUT UUID | variable, | ||
| OUT DOUBLE PRECISION | value | ||
| ) |
Compute Shapley values for all input variables at once.