Stats Regression#
Source: examples/stats_regression.py
Introduction#
Estimate a linear trend between prototype iteration index and novelty score for a compact design-study sample.
Technical Implementation#
Define one explanatory feature (iteration count).
Fit an OLS regression through the package helper.
Print the serialized coefficient and fit diagnostics.
1from __future__ import annotations
2
3import design_research_analysis as dran
4
5
6def main() -> None:
7 """Run and print a small linear model."""
8 prototype_iteration = [[0.0], [1.0], [2.0], [3.0], [4.0]]
9 novelty_score = [1.0, 3.0, 5.0, 7.0, 9.0]
10 result = dran.fit_regression(
11 prototype_iteration,
12 novelty_score,
13 feature_names=["prototype_iteration"],
14 )
15 print(result.to_dict())
16
17
18if __name__ == "__main__":
19 main()
Expected Results#
Run Command
PYTHONPATH=src python examples/stats_regression.py
Prints regression coefficients, intercept, R2, MSE, and input-shape metadata.
References#
docs/analysis_recipes.rst