67 std::vector<ExtractedRule>
rules;
72 [[nodiscard]] std::vector<datalog::Rule>
Program()
const;
86 const std::vector<std::string>& class_names = {});
96 std::vector<datalog::Rule>
rules;
106 const std::string& sample)
const;
One JSON value: null, a boolean, a number, a string, an array or an object.
Definition json.hpp:22
Frosst and Hinton's soft decision tree, (N, inputs) to (N, classes) log-probabilities.
Definition soft_decision_tree.hpp:63
A fact database: a set of ground atoms. Boolean semiring only (Mission 0's scope) – a fact is simply ...
Definition datalog_fact_database.hpp:23
A rule: a head atom entailed whenever every body atom is simultaneously satisfiable under one consist...
Definition datalog_rule.hpp:27
A weighted fact database: a map from ground atom to a semiring value type T (bool for the trivial/boo...
Definition datalog_weighted_fact_database.hpp:49
A set of ground (fully-constant) Datalog atoms. Phase 3 Mission 0 of campaign_exai_dl_library_neuro_s...
A Datalog rule: head :- body1, body2, ..., range-restricted (safe) by construction....
A map from ground Datalog atom to a semiring-typed weight. Phase 3 Mission 1 of campaign_exai_dl_libr...
A small strict JSON value, parser and deterministic writer (RFC 8259).
Definition acquisition_functions.hpp:16
std::vector< int64_t > ClassifyWithRules(const TreeRules &rules, const std::vector< std::vector< float > > &inputs)
Runs the rules on each input with the Datalog engine and returns the class whose predict fact it deri...
JsonValue ToJson(const AttackResult &result, const AttackOptions &options)
The result as a pulsatrix.attack.v1 document, without the adversarial inputs.
TreeRules ExtractRules(const SurrogateTree &tree, const std::vector< std::string > &feature_names={}, const std::vector< std::string > &class_names={})
The rules of a classification tree, one per leaf, in the tree's node order.
std::string FormatRule(const datalog::Rule &rule)
A rule in Datalog's usual text: head(A, b) :- body1(A), body2(A, c).
std::vector< double > ClassProbabilitiesFromRules(const SoftTreeRules &rules, const SoftDecisionTree &tree, int64_t row)
Each class's probability for row row of tree's last forward(), from the rules evaluated over the real...
A soft decision tree (Frosst and Hinton, "Distilling a Neural Network Into a Soft Decision Tr...
One test on a path: x[feature] > threshold when greater, x[feature] <= threshold otherwise.
Definition rule_extraction.hpp:45
double threshold
Definition rule_extraction.hpp:48
bool greater
Definition rule_extraction.hpp:47
int64_t feature
Definition rule_extraction.hpp:46
A soft decision tree's rules, one per leaf, over weighted facts.
Definition rule_extraction.hpp:95
std::vector< std::string > class_names
Definition rule_extraction.hpp:97
datalog::WeightedFactDatabase< double > Facts(const SoftDecisionTree &tree, int64_t row, const std::string &sample) const
The weighted facts for row row of tree's last forward(): right and left with its gate probabilities,...
std::vector< datalog::Rule > rules
Definition rule_extraction.hpp:96
int64_t inner
Definition rule_extraction.hpp:98
int64_t leaves
Definition rule_extraction.hpp:99
A fitted tree. nodes[0] is the root.
Definition surrogate_tree.hpp:80
A crisp tree's rules, one per leaf.
Definition rule_extraction.hpp:66
std::vector< datalog::Rule > Program() const
The rules alone, for the engine.
std::vector< ExtractedRule > rules
Definition rule_extraction.hpp:67
std::vector< std::string > class_names
Definition rule_extraction.hpp:69
datalog::FactDatabase Facts(const std::string &sample, const std::vector< float > &x) const
sample(<id>) and an le or gt fact for every (feature, threshold) the rules test.
std::vector< std::string > feature_names
Definition rule_extraction.hpp:68
A global surrogate: a shallow decision tree fitted to a model's predictions, with its fidelity to the...