Bounded experimental design, alias analysis and candidate-set optimal design in pure MoonBit
moon add shangwuxi/moondoe@0.1.0import {
"shangwuxi/moondoe" @doe,
}///|
fn main raise {
let factors = [@doe.factor("temperature", 20.0, 80.0)]
let candidates = @doe.factorial(factors, [5])
let model = @doe.terms(factors, 1)
let chosen = @doe.d_optimal(candidates, model, 2)
assert_true(@doe.diagnose(chosen.plan, model).estimable)
println(@doe.plan_csv(chosen.plan))
}moon run examples/screening
moon run examples/response
moon run examples/candidates| 阶段 | API / 文件 | 行为 |
|---|---|---|
| 数据边界 | factor, plan, coded_plan, physical_plan | 有限值、维度、唯一 ID、复制隔离 |
| 规则设计 | factorial, two_level, fraction | 混合水平全因子;有符号二水平生成元 |
| 混杂分析 | defining_relation, resolution, aliases, effect_name | XOR 定义群、最短非单位词、带符号效应别名 |
| 设计扩增 | foldover, replicate, add_centers | 保留区组和来源、生成新的执行 ID |
| 响应面 | central_composite, box_behnken, terms | CCD/BBD;显式0/1/2阶单项式 |
| 线性代数 | matrix_rank, information, inverse, log_determinant | 列均衡秩、加权信息、行缩放求逆、SPD Cholesky |
| 模型验证 | least_squares, fit_plan, diagnose, alias_matrix | 列主元两遍 MGS QR;可估计性和遗漏项投影 |
| 预测 | predict, gradient, covariance, leverage, variance_profile | 编码坐标导数和线性模型不确定性 |
| 有限选点 | d_optimal, augment_optimal, refine_selection | 秩递增种子、贪心补齐、有限轮单点交换、锁定前缀 |
| 可行性/执行 | filter_candidates, filter_points, unique_points, randomize, balanced_blocks | 线性约束、隔离谓词、精确去重、可复现洗牌 |
| 残差拆分 | partition_error, standardized_residuals | 区组敏感重复组、纯误差/失拟 SS 和自由度 |
| 交换格式 | plan_csv, plan_from_csv, plan_json, plan_from_json, diagnostics_json | 受限文本;严格字段;moondoe/1 模式 |
moon info && moon fmt
moon fmt --check
moon check --deny-warn
moon test --deny-warn
moon build --deny-warn
bash scripts/verify.sh wasm-gc
bash scripts/verify.sh wasm
bash scripts/verify.sh js
CC=gcc bash scripts/verify.sh native
python scripts/audit.pyfn aliases(effect : Int, base : Int, generators : Array[Generator]) -> Array[DefiningWord] raise DesignErrorfn augment_optimal(candidates : Plan, model : Array[Term], fixed_indices : Array[Int], total_runs : Int, passes? : Int) -> OptimalResult raise DesignErrorfn central_composite(factors : Array[Factor], alpha : Double, centers? : Int) -> Plan raise DesignErrorfn d_optimal(candidates : Plan, model : Array[Term], count : Int, passes? : Int) -> OptimalResult raise DesignErrorfn defining_relation(base : Int, generators : Array[Generator]) -> Array[DefiningWord] raise DesignErrorfn factorial(factors : Array[Factor], levels : Array[Int], centers? : Int) -> Plan raise DesignErrorfn filter_candidates(p : Plan, constraints : Array[LinearConstraint], tol? : Double) -> Plan raise DesignErrorfn partition_error(p : Plan, model : Array[Term], responses : Array[Double], separate_blocks? : Bool) -> ErrorPartition raise DesignErrorfn predict(coefficients : Array[Double], model : Array[Term], point : Array[Double]) -> Double raise DesignErrorfn prediction_variance(row : Array[Double], covariance : Array[Array[Double]]) -> Double raise DesignErrorfn refine_selection(candidates : Plan, model : Array[Term], initial : Array[Int], locked_prefix? : Int, passes? : Int) -> OptimalResult raise DesignErrorInstall
Download zipBounded experimental design, alias analysis and candidate-set optimal design in pure MoonBit