Logic Scoring of Preference - interpretable multi-criteria aggregation
Project description
LogicScore Core
LogicScore Core is a focused Python library for Logic Scoring of Preference (LSP): it provides deterministic, interpretable tree-based aggregation math and companion utilities for suitability mapping, validation, sensitivity analysis, and traversal.
Install
pip install logicscore-core
uv add logicscore-core
Quickstart
from logicscore.core import TreeNode, compute_tree, SuitabilityCurve, validate_tree
# Map raw signals to suitability in [0.0, 1.0].
temperature_curve = SuitabilityCurve.linear((0.0, 100.0), low_suitability=0.0, high_suitability=1.0)
volatility_curve = SuitabilityCurve.inverted_u(peak=20.0, width=20.0, peak_suitability=1.0, base_suitability=0.2)
temperature = TreeNode(
id="temperature",
name="Temperature",
weight=0.6,
score=temperature_curve(72.0),
)
volatility = TreeNode(
id="volatility",
name="Volatility",
weight=0.4,
score=volatility_curve(18.0),
)
root = TreeNode(
id="market_quality",
name="Market Quality",
operator=0.5, # canonical neutral UGCD operator
children=[temperature, volatility],
)
validation = validate_tree(root)
if not validation.valid:
raise ValueError(f"invalid tree: {validation.errors}")
score = compute_tree(root)
print(f"Final score: {score:.4f}")
What this package is / is not
In scope
- Core tree math and utilities (
TreeNode, UGCD aggregation, validation, sensitivity, traversal) - Deterministic score computation from already-prepared node inputs
Out of scope
- Runtime decision labels or score-to-action mapping
- Clock/timestamp enforcement and staleness orchestration
- Policy orchestration and execution/runtime adapters
For boundary details, see runtime-boundary.md.
API surface
Canonical imports are from logicscore.core:
TreeNodecompute_treeSuitabilityCurvevalidate_tree,ValidationResultcompute_sensitivityget_all_leaves,get_all_nodes
Development
uv sync --extra dev
uv run ruff check logicscore/ tests/
uv run mypy logicscore/
uv run pytest
If your environment does not expose script entry points through uv run, use:
uv run --extra dev python -m mypy logicscore/
uv run --extra dev python -m pytest
Release Validation
uv run ruff check logicscore/ tests/
uv run mypy logicscore/
uv run pytest
uv build
uv run twine check dist/*
License
Licensed under the MIT License. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file logicscore_core-0.1.0.tar.gz.
File metadata
- Download URL: logicscore_core-0.1.0.tar.gz
- Upload date:
- Size: 52.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a532add2b681e3c119eac3f1e199a3d52a27d7bc34cfb549e8120752f3722f28
|
|
| MD5 |
17d314edb732cb8880d2e7bcbb4cf4b0
|
|
| BLAKE2b-256 |
e773909aa0953d2dc6dc6682e5d3e0ee1d03902ac540f03f8d30416bb1f755da
|
File details
Details for the file logicscore_core-0.1.0-py3-none-any.whl.
File metadata
- Download URL: logicscore_core-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da9d54a32b8f619f5d1062de2cc2681154d713bfc08acdbda7f01475ef49aba9
|
|
| MD5 |
9ca7d0c5812a8a10dc3f4856afeeb301
|
|
| BLAKE2b-256 |
5fb9551631867ac7e08cce1c060a80afa7dac827891ce3559832a1c891b1b677
|