riantr/moonbit_dowhy/overrule does not have a README file

    Rule

    type Rule = Array[RuleAtom]

    A rule of a ruleset: the literals that have to hold at the same time.

    RuleSet

    type RuleSet = Array[Array[RuleAtom]]

    The rules of a ruleset estimator.

    BeamSearchResult

    pub struct BeamSearchResult {
    values : Array[Double]
    z : Array[Array[Bool]]
    }

    The result of the beam search.

    BinarizedData

    pub struct BinarizedData {
    literals : Array[Literal]
    columns : Array[Array[Double]]
    feature_of : Array[Int]
    n_rows : Int
    }

    The binarised features of a data set.

    BooleanRule

    pub struct BooleanRule {
    alpha : Double
    lambda0 : Double
    lambda1 : Double
    k : Int
    d : Int
    b : Int
    iter_max : Int
    eps : Double
    rounding : RoundingStrategy
    w : Array[Double]
    w_raw : Array[Double]
    z : Array[Array[Bool]]
    lp_objective : Double
    }

    The estimator of a boolean rule set, the port of the OverlapBooleanRule of the upstream.

    The rules are learned with a column generation: a program is solved, the conjunctions that are worth adding are searched for with a beam search, and the program is solved again with the new conjunctions. The coefficients of the program are rounded into rules at the end.

    BooleanRule::covers

    fn BooleanRule::covers(self : BooleanRule, coverage : Array[Double]) -> Bool

    Whether a rule covers the given row.

    BooleanRule::fit

    fn BooleanRule::fit(self : BooleanRule, data : BinarizedData, y : Array[Double]) -> Unit

    Learn the rules of the given rows.

    The labels of the rows are one for the rows that have to be covered, zero for the rows that have to be avoided and minus one for the background, the way the upstream labels them.

    BooleanRule::lp_value

    fn BooleanRule::lp_value(self : BooleanRule) -> Double

    The value of the program of the rules.

    BooleanRule::new

    fn BooleanRule::new(alpha : Double, lambda0 : Double, lambda1 : Double, k : Int, d : Int, b : Int, iter_max : Int, eps : Double, rounding : RoundingStrategy) -> BooleanRule

    The estimator of a boolean rule set.

    BooleanRule::predict

    fn BooleanRule::predict(self : BooleanRule, data : BinarizedData) -> Array[Bool]

    Whether the rules cover every row of the given covariates.

    BooleanRule::rules

    fn BooleanRule::rules(self : BooleanRule, literals : Array[Literal]) -> Array[Array[RuleAtom]]

    The rules of the estimator.

    FeatureBinarizer

    pub struct FeatureBinarizer {
    names : Array[String]
    negations : Bool
    num_thresholds : Int
    kind : Array[FeatureKind]
    levels : Array[Array[Double]]
    thresholds : Array[Array[Double]]
    }

    The binariser of the features, the port of the FeatureBinarizer of the upstream.

    Every feature is turned into a set of literals, and every literal holds for the rows whose value of the feature satisfies it. A feature with at most two distinct values becomes one literal and, with the negations, its negation. A feature with more distinct values becomes one literal per threshold, and the thresholds are the quantiles of the values.

    FeatureBinarizer::fit

    fn FeatureBinarizer::fit(self : FeatureBinarizer, columns : Array[Array[Double]]) -> Unit

    Learn the literals of the features from the given rows.

    The binariser keeps the distinct values of the binary features and the thresholds of the ordinal ones, so that it can transform other rows with the same literals.

    FeatureBinarizer::new

    fn FeatureBinarizer::new(names : Array[String], num_thresholds : Int, negations : Bool) -> FeatureBinarizer

    A binariser of the features that is not fitted yet.

    FeatureBinarizer::transform

    fn FeatureBinarizer::transform(self : FeatureBinarizer, columns : Array[Array[Double]]) -> BinarizedData

    Turn the given rows into the literals of the features.

    FeatureKind

    pub enum FeatureKind {
    Binary
    Ordinal
    }

    The kind of a feature of the binariser.

    Literal

    pub struct Literal {
    feature : String
    operation : LiteralOperation
    value : Double
    }

    A literal of a binarised feature: a condition on the value of a feature.

    LiteralOperation

    pub enum LiteralOperation {
    Binary
    Negation
    LessEqual
    Greater
    }

    The operation of a literal of a binarised feature.

    LiteralOperation::name

    fn LiteralOperation::name(self : LiteralOperation) -> String

    The name of the operation, the way the upstream reports it in a rule.

    OverlapAnalyzer

    pub struct OverlapAnalyzer {
    backdoor_vars : Array[String]
    treatment_name : String
    support_config : SupportConfig
    overlap_config : OverlapConfig
    overlap_eps : Double
    support_only : Bool
    overlap_only : Bool
    support_estimator : RulesetEstimator?
    overlap_estimator : RulesetEstimator?
    support_indicator : Array[Bool]
    overlap_indicator : Array[Bool]
    raw_overlap : Array[Bool]
    fitted : Bool
    }

    The analyzer of the support and the overlap rules, the port of the OverruleAnalyzer of the upstream.

    The support rules describe the region of the covariates the data cover, and the overlap rules describe the region where the treatment and the control overlap, which is found with the propensity scores.

    OverlapAnalyzer::fit

    fn OverlapAnalyzer::fit(self : OverlapAnalyzer, columns : Array[Array[Double]], treatment : Array[Double]) -> Unit

    Learn the rules of the given covariates.

    The columns are the backdoor variables and the treatment is the column of the treatment, the way the upstream takes them.

    OverlapAnalyzer::new

    fn OverlapAnalyzer::new(backdoor_vars : Array[String], treatment_name : String, support_config : SupportConfig, overlap_config : OverlapConfig, overlap_eps? : Double, support_only? : Bool, overlap_only? : Bool) -> OverlapAnalyzer

    An analyzer of the support and the overlap rules.

    The range of the propensity scores that describes the overlap region is (overlap_eps, 1 - overlap_eps), and only the support or only the overlap rules are learned when the analyzer is asked for one of them.

    OverlapAnalyzer::overlap_indicator

    fn OverlapAnalyzer::overlap_indicator(self : OverlapAnalyzer) -> Array[Bool]

    The rows of the overlap region.

    OverlapAnalyzer::overlap_objective

    fn OverlapAnalyzer::overlap_objective(self : OverlapAnalyzer) -> Double

    The value of the program of the overlap rules.

    OverlapAnalyzer::overlap_rules

    fn OverlapAnalyzer::overlap_rules(self : OverlapAnalyzer) -> Array[Array[RuleAtom]]

    The rules of the overlap region.

    OverlapAnalyzer::predict_overlap_support

    fn OverlapAnalyzer::predict_overlap_support(self : OverlapAnalyzer, columns : Array[Array[Double]]) -> Array[Bool]

    The rows of the covariates that the support rules cover and the overlap rules cover.

    OverlapAnalyzer::support_indicator

    fn OverlapAnalyzer::support_indicator(self : OverlapAnalyzer) -> Array[Bool]

    The rows of the support.

    OverlapAnalyzer::support_objective

    fn OverlapAnalyzer::support_objective(self : OverlapAnalyzer) -> Double

    The value of the program of the support rules.

    OverlapAnalyzer::support_rules

    fn OverlapAnalyzer::support_rules(self : OverlapAnalyzer) -> Array[Array[RuleAtom]]

    The rules of the support.

    OverlapConfig

    pub struct OverlapConfig {
    alpha : Double
    lambda0 : Double
    lambda1 : Double
    k : Int
    d : Int
    b : Int
    iter_max : Int
    num_thresholds : Int
    rounding : RoundingStrategy
    }

    The configuration of the overlap rules, the port of the OverlapConfig of the upstream.

    OverlapConfig::new

    The configuration of the overlap rules, with the defaults of the upstream.

    RoundingStrategy

    pub enum RoundingStrategy {
    Greedy
    GreedySweep
    }

    The strategy of the rounding of the coefficients of the rules.

    RoundingStrategy::greedy

    The rounding with a fixed reward for the positive samples.

    RuleAtom

    pub struct RuleAtom {
    feature : String
    operation : String
    value : String
    }

    An atom of a rule, the way the upstream reports it.

    RulesetConfig

    pub struct RulesetConfig {
    n_ref_multiplier : Double
    alpha : Double
    lambda0 : Double
    lambda1 : Double
    k : Int
    d : Int
    b : Int
    iter_max : Int
    eps : Double
    num_thresholds : Int
    negations : Bool
    rounding : RoundingStrategy
    seed : Int
    }

    The configuration of a ruleset estimator, the port of the parameters of the BCSRulesetEstimator of the upstream.

    RulesetEstimator

    pub struct RulesetEstimator {
    config : RulesetConfig
    binarizer : FeatureBinarizer
    literals : Array[Literal]
    rule : BooleanRule
    fitted : Bool
    }

    The estimator of a boolean rule set, the port of the BCSRulesetEstimator of the upstream.

    The estimator learns the rules of a region of the covariates: the support of the data or the region where the treatment and the control overlap.

    RulesetEstimator::fit

    fn RulesetEstimator::fit(self : RulesetEstimator, columns : Array[Array[Double]], names : Array[String], labels : Array[Double]) -> Unit

    Learn the rules of the given rows.

    The labels of the rows are one for the rows the rules have to cover and zero for the rows they have to avoid. The reference samples are the background the rules are learned against.

    RulesetEstimator::new

    An estimator of a boolean rule set.

    RulesetEstimator::objective

    fn RulesetEstimator::objective(self : RulesetEstimator) -> Double

    The value of the program of the rules.

    RulesetEstimator::predict

    fn RulesetEstimator::predict(self : RulesetEstimator, columns : Array[Array[Double]]) -> Array[Bool]

    Whether the rules cover every row of the given covariates.

    RulesetEstimator::rules

    The rules of the estimator.

    SupportConfig

    pub struct SupportConfig {
    n_ref_multiplier : Double
    seed : Int
    alpha : Double
    lambda0 : Double
    lambda1 : Double
    k : Int
    d : Int
    b : Int
    iter_max : Int
    num_thresholds : Int
    rounding : RoundingStrategy
    }

    The configuration of the support rules, the port of the SupportConfig of the upstream.

    SupportConfig::new

    The configuration of the support rules, with the defaults of the upstream.
    fn beam_search(r : Array[Double], data : BinarizedData, lambda0 : Double, lambda1 : Double, k : Int, ub : Double, eps : Double, b : Int, d : Int, w_lb : Double) -> BeamSearchResult

    Search the conjunctions with a negative reduced cost, the port of the beam search of the upstream.

    The search starts from the empty conjunction and adds one literal at a time, keeping the best candidates of every degree. The value of a conjunction is the sum of the residuals of the rows it covers and the regularisation of its literals, so the candidates are the literals that make the value the smallest.

    distinct_values

    fn distinct_values(values : Array[Double]) -> Array[Double]

    The distinct values of a column, in the increasing order.

    refute_assess_overlap

    fn refute_assess_overlap(columns : Array[Array[Double]], names : Array[String], backdoor_vars : Array[String], treatment_name : String, support_config : SupportConfig, overlap_config : OverlapConfig, overlap_eps : Double, support_only : Bool, overlap_only : Bool) -> OverlapAnalyzer

    Learn the rules of the support and of the overlap of the covariates.

    The rules are learned with respect to the backdoor variables only, and the treatment is the column of the treatment, the way the upstream takes them. The columns that are not named are left out of the rules.

    sample_reference

    fn sample_reference(columns : Array[Array[Double]], n : Int, random :
    Random
    , seed : Int) -> Array[Array[Double]]

    Draw the reference samples of the upstream, the port of sample_reference.

    The reference samples are drawn uniformly over the range of every column, and they are the background the rules are learned against. A column with two distinct values is drawn from its two values, and a column with more distinct values is drawn uniformly between its smallest and its largest value, the way the upstream does it with a generator of its own for every column.

    Powered by MoonBit

    Site sourceReport issueModulesSkillsBuild queueStatistics

    © 2026 mooncakes.io