scientific-method 0.2.0

The parts of the scientific method used to define and evaluate experiments.
Documentation
  • Coverage
  • 21.57%
    22 out of 102 items documented0 out of 0 items with examples
  • Size
  • Source code size: 49.2 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.1 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 4s Average build duration of successful builds.
  • all releases: 2s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • jameshuntt/scientific-method
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • jameshuntt

scientific-method

The parts of the scientific method used to define and evaluate experiments.

scientific-method models questions, hypotheses, predictions, independent and dependent variables, controls, observations, measurements, criteria, and conclusions. It does not run experiments or know about repositories, commands, files, or benchmarks.

Criteria are machine-evaluable and can be composed. A method evaluates its declared criteria against observations and concludes supported, not_supported, or inconclusive. That scientific conclusion is intentionally separate from any later decision to accept, promote, or retain an implementation.

use scientific_method::{
    Criterion, Direction, Hypothesis, Measurement, Observation, ObservationRef,
    Observations, ScientificMethod,
};

let method = ScientificMethod::new(Hypothesis::new("the candidate lowers latency"))
    .criterion(Criterion::improvement(
        ObservationRef::new("baseline", "latency"),
        ObservationRef::new("candidate", "latency"),
        Direction::LowerIsBetter,
        0.05,
    ));

let observations = Observations::new()
    .with(Observation::new("baseline", Measurement::new("latency", 100.0)))
    .with(Observation::new("candidate", Measurement::new("latency", 90.0)));

let evaluation = method.evaluate(&observations)?;
assert!(evaluation.criteria[0].passed);
# Ok::<(), scientific_method::CriterionError>(())

Serde

Serialization is optional:

scientific-method = { version = "0.2", features = ["serde"] }

The crate keeps serialization separate from execution so experiment frameworks can choose their own file formats and storage.

Releasing

Bump version in Cargo.toml, add a dated ## <version> (YYYY-MM-DD) entry to CHANGELOG.md, and push to main. CI tests stable and Rust 1.89, runs clippy, and publishes a version that is not already on crates.io through trusted publishing.

Ownership

Developed and published by James Hunt. Repository: https://github.com/jameshuntt/scientific-method.

License

MIT OR Apache-2.0