cogniform 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cogniform-0.1.0/LICENSE +21 -0
- cogniform-0.1.0/MANIFEST.in +3 -0
- cogniform-0.1.0/PKG-INFO +133 -0
- cogniform-0.1.0/PUBLISHING.md +24 -0
- cogniform-0.1.0/README.md +117 -0
- cogniform-0.1.0/examples/demo.py +9 -0
- cogniform-0.1.0/examples/demonstrations.json +226 -0
- cogniform-0.1.0/examples/heldout.json +98 -0
- cogniform-0.1.0/examples/situation.json +5 -0
- cogniform-0.1.0/pyproject.toml +26 -0
- cogniform-0.1.0/setup.cfg +4 -0
- cogniform-0.1.0/src/cogniform/__init__.py +7 -0
- cogniform-0.1.0/src/cogniform/__main__.py +2 -0
- cogniform-0.1.0/src/cogniform/cli.py +40 -0
- cogniform-0.1.0/src/cogniform/core.py +265 -0
- cogniform-0.1.0/src/cogniform/evaluation.py +63 -0
- cogniform-0.1.0/src/cogniform/models.py +53 -0
- cogniform-0.1.0/src/cogniform.egg-info/PKG-INFO +133 -0
- cogniform-0.1.0/src/cogniform.egg-info/SOURCES.txt +21 -0
- cogniform-0.1.0/src/cogniform.egg-info/dependency_links.txt +1 -0
- cogniform-0.1.0/src/cogniform.egg-info/entry_points.txt +2 -0
- cogniform-0.1.0/src/cogniform.egg-info/top_level.txt +1 -0
- cogniform-0.1.0/tests/test_cogniform.py +76 -0
cogniform-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Cogniform contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
cogniform-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cogniform
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Learn, inspect, transfer and evaluate decision policies from expert demonstrations.
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Repository, https://github.com/AMallur/Cogniform
|
|
7
|
+
Project-URL: Issues, https://github.com/AMallur/Cogniform/issues
|
|
8
|
+
Keywords: ai,decision-policy,imitation-learning,agents,explainability
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
12
|
+
Requires-Python: >=3.10
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Dynamic: license-file
|
|
16
|
+
|
|
17
|
+
# Cogniform
|
|
18
|
+
|
|
19
|
+
**Learn how an expert decides, not just what they answer.**
|
|
20
|
+
|
|
21
|
+
Cogniform is a zero-dependency Python SDK for learning portable, inspectable decision policies from structured expert demonstrations. It learns a decision tree by information gain, exposes the conditions behind each prediction, and abstains when it encounters uncertainty or out-of-domain values. Optional LLM adapters convert natural-language situations into structured facts before the policy runs.
|
|
22
|
+
|
|
23
|
+
Version 0.1.0 is an alpha release candidate. It is not a foundation model, cognitive emulator, or guarantee of expert judgment. It has not been validated on real-world expert datasets. The name and public registry availability must be confirmed at publication.
|
|
24
|
+
|
|
25
|
+
## Install
|
|
26
|
+
|
|
27
|
+
After the package is published to PyPI:
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
pip install cogniform
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Until then, install from the source directory:
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
git clone https://github.com/AMallur/Cogniform.git
|
|
37
|
+
cd Cogniform
|
|
38
|
+
python -m pip install .
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Python 3.10+; no required runtime dependencies.
|
|
42
|
+
|
|
43
|
+
## 60-second quickstart
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
from cogniform import Judgment
|
|
47
|
+
|
|
48
|
+
examples = [
|
|
49
|
+
{"facts": {"risk": "low", "missed_deadlines": 0}, "decision": "continue"},
|
|
50
|
+
{"facts": {"risk": "low", "missed_deadlines": 1}, "decision": "continue"},
|
|
51
|
+
{"facts": {"risk": "high", "missed_deadlines": 0}, "decision": "escalate"},
|
|
52
|
+
{"facts": {"risk": "high", "missed_deadlines": 1}, "decision": "escalate"},
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
expert = Judgment.learn(examples)
|
|
56
|
+
result = expert.apply({"risk": "high", "missed_deadlines": 1})
|
|
57
|
+
print(result.decision) # escalate
|
|
58
|
+
print(result.evidence) # observed facts and learned branch conditions
|
|
59
|
+
print(result.uncertainty) # 1 - observed leaf class proportion, not calibrated risk
|
|
60
|
+
expert.save("supplier.json")
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Each example is an expert's observed situation and selected action. Facts are finite JSON scalars (strings, numbers, booleans, null). Optional rationale text is accepted as a note in demonstrations; v0.1 does not learn from rationale text. Use domain-specific features and obtain consent to collect expert data.
|
|
64
|
+
|
|
65
|
+
## How the engine works
|
|
66
|
+
|
|
67
|
+
1. Learn candidate conditions on observed categories and numeric values.
|
|
68
|
+
2. Rank splits by information gain and fit a bounded-depth decision tree.
|
|
69
|
+
3. Follow the learned policy for a new situation, returning evidence and empirical class proportions.
|
|
70
|
+
4. Abstain on ties, low support, low confidence, incompatible required facts or unseen observed values in strict mode. Missing values may follow a branch explicitly learned from missing examples.
|
|
71
|
+
5. Export the profile as versioned JSON; share it across applications and model providers without retraining.
|
|
72
|
+
|
|
73
|
+
Numeric split thresholds use the lower observed value, not an inferred exact expert threshold. Strict mode (default) rejects supplied in-schema feature values outside the observed numeric range or categorical vocabulary. It does not detect every out-of-distribution combination. Unknown feature keys supplied directly are ignored by the policy. Use strict=False to permit extrapolation deliberately. Uncertainty is an empirical impurity measure, not calibrated probability. Human review is needed for high-impact decisions.
|
|
74
|
+
|
|
75
|
+
## Natural language input
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
from cogniform import Judgment, OpenAIModel
|
|
79
|
+
from openai import OpenAI
|
|
80
|
+
|
|
81
|
+
expert = Judgment.load("supplier.json")
|
|
82
|
+
model = OpenAIModel(OpenAI(), model="YOUR_MODEL_ID")
|
|
83
|
+
result = expert.apply("Risk is high; the supplier missed one deadline.", model=model)
|
|
84
|
+
print(result.decision)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Install openai or anthropic yourself if using their client. AnthropicModel(client, model=...) and CallableModel(fn) are also available. A callable takes (system_prompt, user_prompt) and returns JSON text. Models are only used for fact extraction; they do not choose the decision. Extracted JSON is type-checked, but a model can still omit or hallucinate facts despite the prompt. Review extracted evidence when accuracy matters. Text and schema are sent to your configured model provider; direct structured prediction is entirely local. No telemetry is included.
|
|
88
|
+
|
|
89
|
+
## Evaluation and audit
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
from cogniform import evaluate, split_demonstrations, Judgment
|
|
93
|
+
import json
|
|
94
|
+
|
|
95
|
+
rows = json.load(open("examples/demonstrations.json"))
|
|
96
|
+
train, test = split_demonstrations(rows, seed=42)
|
|
97
|
+
profile = Judgment.learn(train)
|
|
98
|
+
report = evaluate(profile, test)
|
|
99
|
+
print(report.accuracy, report.coverage, report.selective_accuracy)
|
|
100
|
+
print(report.baseline_accuracy)
|
|
101
|
+
print(profile.rules())
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Accuracy counts abstentions as unsuccessful cases; coverage is the fraction answered; selective accuracy is accuracy among answered cases, or None if none are answered. The baseline is the training set majority class. Duplicate fact vectors are grouped together for the split; correlated or near-duplicate observations can still leak, so use external validation when possible. Avoid tuning against the final held-out set.
|
|
105
|
+
|
|
106
|
+
Run the included synthetic supplier benchmark:
|
|
107
|
+
|
|
108
|
+
```sh
|
|
109
|
+
python examples/demo.py
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
It contains 28 training cases and 12 disjoint held-out cases generated from a known simple policy. It is a functionality demonstration, not evidence of performance on human experts or production data.
|
|
113
|
+
|
|
114
|
+
## CLI
|
|
115
|
+
|
|
116
|
+
```sh
|
|
117
|
+
cogniform learn examples/demonstrations.json -o supplier.json
|
|
118
|
+
cogniform rules supplier.json
|
|
119
|
+
cogniform apply supplier.json examples/situation.json
|
|
120
|
+
cogniform evaluate supplier.json examples/heldout.json
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Use --max-depth, --min-leaf, --min-confidence, and --min-support with learn. Use --allow-extrapolation with apply or evaluate to disable observed-domain checks. Each command outputs JSON. A profile ID is derived from its serialized contents for version tracking. Profiles contain derived training statistics and category values; review them before sharing.
|
|
124
|
+
|
|
125
|
+
## Development
|
|
126
|
+
|
|
127
|
+
```sh
|
|
128
|
+
python -m pip install -e . pytest
|
|
129
|
+
python -m pytest -q
|
|
130
|
+
python examples/demo.py
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
CI tests the supported Python versions and builds distributions. The release workflow runs tests, builds distributions, validates metadata, and publishes via PyPI Trusted Publishing only when manually triggered and authorized. See [PUBLISHING.md](PUBLISHING.md).
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Publishing Cogniform 0.1.0
|
|
2
|
+
|
|
3
|
+
This release candidate has not been uploaded to PyPI. Publishing requires control of an authorized PyPI account. Never share API tokens in chat or commit them to Git.
|
|
4
|
+
|
|
5
|
+
## GitHub Trusted Publishing
|
|
6
|
+
|
|
7
|
+
1. Verify name availability and suitability on PyPI.
|
|
8
|
+
2. Visit https://pypi.org/manage/account/publishing/ and configure a pending publisher with project name cogniform, owner AMallur, repository name Cogniform, workflow release.yml and environment pypi.
|
|
9
|
+
3. Configure the pypi environment in GitHub repository settings, restricting deployments to main and adding review protection where supported.
|
|
10
|
+
4. Confirm CI passes. Open https://github.com/AMallur/Cogniform/actions/workflows/release.yml and manually run **Release to PyPI** on main. Approve the environment if required.
|
|
11
|
+
5. Verify the uploaded package with python -m pip install cogniform==0.1.0 in a clean environment.
|
|
12
|
+
|
|
13
|
+
## Direct upload alternative
|
|
14
|
+
|
|
15
|
+
Create an authorized PyPI API token at https://pypi.org/manage/account/token/ (account-wide for the initial publication; project-scoped thereafter). From the repository directory:
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
python -m pip install --upgrade build twine
|
|
19
|
+
python -m build
|
|
20
|
+
python -m twine check --strict dist/*
|
|
21
|
+
python -m twine upload --username __token__ dist/*
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Enter the token only at the local password prompt. Uploading makes the version public and reserves it; review all files before publishing. For subsequent releases update both pyproject.toml and __version__, rerun tests, build, and publish a new version.
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Cogniform
|
|
2
|
+
|
|
3
|
+
**Learn how an expert decides, not just what they answer.**
|
|
4
|
+
|
|
5
|
+
Cogniform is a zero-dependency Python SDK for learning portable, inspectable decision policies from structured expert demonstrations. It learns a decision tree by information gain, exposes the conditions behind each prediction, and abstains when it encounters uncertainty or out-of-domain values. Optional LLM adapters convert natural-language situations into structured facts before the policy runs.
|
|
6
|
+
|
|
7
|
+
Version 0.1.0 is an alpha release candidate. It is not a foundation model, cognitive emulator, or guarantee of expert judgment. It has not been validated on real-world expert datasets. The name and public registry availability must be confirmed at publication.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
After the package is published to PyPI:
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
pip install cogniform
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Until then, install from the source directory:
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
git clone https://github.com/AMallur/Cogniform.git
|
|
21
|
+
cd Cogniform
|
|
22
|
+
python -m pip install .
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Python 3.10+; no required runtime dependencies.
|
|
26
|
+
|
|
27
|
+
## 60-second quickstart
|
|
28
|
+
|
|
29
|
+
```python
|
|
30
|
+
from cogniform import Judgment
|
|
31
|
+
|
|
32
|
+
examples = [
|
|
33
|
+
{"facts": {"risk": "low", "missed_deadlines": 0}, "decision": "continue"},
|
|
34
|
+
{"facts": {"risk": "low", "missed_deadlines": 1}, "decision": "continue"},
|
|
35
|
+
{"facts": {"risk": "high", "missed_deadlines": 0}, "decision": "escalate"},
|
|
36
|
+
{"facts": {"risk": "high", "missed_deadlines": 1}, "decision": "escalate"},
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
expert = Judgment.learn(examples)
|
|
40
|
+
result = expert.apply({"risk": "high", "missed_deadlines": 1})
|
|
41
|
+
print(result.decision) # escalate
|
|
42
|
+
print(result.evidence) # observed facts and learned branch conditions
|
|
43
|
+
print(result.uncertainty) # 1 - observed leaf class proportion, not calibrated risk
|
|
44
|
+
expert.save("supplier.json")
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Each example is an expert's observed situation and selected action. Facts are finite JSON scalars (strings, numbers, booleans, null). Optional rationale text is accepted as a note in demonstrations; v0.1 does not learn from rationale text. Use domain-specific features and obtain consent to collect expert data.
|
|
48
|
+
|
|
49
|
+
## How the engine works
|
|
50
|
+
|
|
51
|
+
1. Learn candidate conditions on observed categories and numeric values.
|
|
52
|
+
2. Rank splits by information gain and fit a bounded-depth decision tree.
|
|
53
|
+
3. Follow the learned policy for a new situation, returning evidence and empirical class proportions.
|
|
54
|
+
4. Abstain on ties, low support, low confidence, incompatible required facts or unseen observed values in strict mode. Missing values may follow a branch explicitly learned from missing examples.
|
|
55
|
+
5. Export the profile as versioned JSON; share it across applications and model providers without retraining.
|
|
56
|
+
|
|
57
|
+
Numeric split thresholds use the lower observed value, not an inferred exact expert threshold. Strict mode (default) rejects supplied in-schema feature values outside the observed numeric range or categorical vocabulary. It does not detect every out-of-distribution combination. Unknown feature keys supplied directly are ignored by the policy. Use strict=False to permit extrapolation deliberately. Uncertainty is an empirical impurity measure, not calibrated probability. Human review is needed for high-impact decisions.
|
|
58
|
+
|
|
59
|
+
## Natural language input
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
from cogniform import Judgment, OpenAIModel
|
|
63
|
+
from openai import OpenAI
|
|
64
|
+
|
|
65
|
+
expert = Judgment.load("supplier.json")
|
|
66
|
+
model = OpenAIModel(OpenAI(), model="YOUR_MODEL_ID")
|
|
67
|
+
result = expert.apply("Risk is high; the supplier missed one deadline.", model=model)
|
|
68
|
+
print(result.decision)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Install openai or anthropic yourself if using their client. AnthropicModel(client, model=...) and CallableModel(fn) are also available. A callable takes (system_prompt, user_prompt) and returns JSON text. Models are only used for fact extraction; they do not choose the decision. Extracted JSON is type-checked, but a model can still omit or hallucinate facts despite the prompt. Review extracted evidence when accuracy matters. Text and schema are sent to your configured model provider; direct structured prediction is entirely local. No telemetry is included.
|
|
72
|
+
|
|
73
|
+
## Evaluation and audit
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
from cogniform import evaluate, split_demonstrations, Judgment
|
|
77
|
+
import json
|
|
78
|
+
|
|
79
|
+
rows = json.load(open("examples/demonstrations.json"))
|
|
80
|
+
train, test = split_demonstrations(rows, seed=42)
|
|
81
|
+
profile = Judgment.learn(train)
|
|
82
|
+
report = evaluate(profile, test)
|
|
83
|
+
print(report.accuracy, report.coverage, report.selective_accuracy)
|
|
84
|
+
print(report.baseline_accuracy)
|
|
85
|
+
print(profile.rules())
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Accuracy counts abstentions as unsuccessful cases; coverage is the fraction answered; selective accuracy is accuracy among answered cases, or None if none are answered. The baseline is the training set majority class. Duplicate fact vectors are grouped together for the split; correlated or near-duplicate observations can still leak, so use external validation when possible. Avoid tuning against the final held-out set.
|
|
89
|
+
|
|
90
|
+
Run the included synthetic supplier benchmark:
|
|
91
|
+
|
|
92
|
+
```sh
|
|
93
|
+
python examples/demo.py
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
It contains 28 training cases and 12 disjoint held-out cases generated from a known simple policy. It is a functionality demonstration, not evidence of performance on human experts or production data.
|
|
97
|
+
|
|
98
|
+
## CLI
|
|
99
|
+
|
|
100
|
+
```sh
|
|
101
|
+
cogniform learn examples/demonstrations.json -o supplier.json
|
|
102
|
+
cogniform rules supplier.json
|
|
103
|
+
cogniform apply supplier.json examples/situation.json
|
|
104
|
+
cogniform evaluate supplier.json examples/heldout.json
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Use --max-depth, --min-leaf, --min-confidence, and --min-support with learn. Use --allow-extrapolation with apply or evaluate to disable observed-domain checks. Each command outputs JSON. A profile ID is derived from its serialized contents for version tracking. Profiles contain derived training statistics and category values; review them before sharing.
|
|
108
|
+
|
|
109
|
+
## Development
|
|
110
|
+
|
|
111
|
+
```sh
|
|
112
|
+
python -m pip install -e . pytest
|
|
113
|
+
python -m pytest -q
|
|
114
|
+
python examples/demo.py
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
CI tests the supported Python versions and builds distributions. The release workflow runs tests, builds distributions, validates metadata, and publishes via PyPI Trusted Publishing only when manually triggered and authorized. See [PUBLISHING.md](PUBLISHING.md).
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
import json
|
|
3
|
+
from cogniform import Judgment, evaluate
|
|
4
|
+
|
|
5
|
+
here=Path(__file__).parent
|
|
6
|
+
profile=Judgment.learn(here/'demonstrations.json')
|
|
7
|
+
print(json.dumps(profile.apply({'risk':'low','missed_deadlines':4,'alternative':True}).to_dict(),indent=2))
|
|
8
|
+
report=evaluate(profile,json.loads((here/'heldout.json').read_text()))
|
|
9
|
+
print(f'Accuracy: {report.accuracy:.0%}; coverage: {report.coverage:.0%}; majority baseline: {report.baseline_accuracy:.0%}')
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"facts": {
|
|
4
|
+
"risk": "low",
|
|
5
|
+
"missed_deadlines": 0,
|
|
6
|
+
"alternative": true
|
|
7
|
+
},
|
|
8
|
+
"decision": "continue"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"facts": {
|
|
12
|
+
"risk": "low",
|
|
13
|
+
"missed_deadlines": 0,
|
|
14
|
+
"alternative": false
|
|
15
|
+
},
|
|
16
|
+
"decision": "continue"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"facts": {
|
|
20
|
+
"risk": "low",
|
|
21
|
+
"missed_deadlines": 2,
|
|
22
|
+
"alternative": true
|
|
23
|
+
},
|
|
24
|
+
"decision": "continue"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"facts": {
|
|
28
|
+
"risk": "low",
|
|
29
|
+
"missed_deadlines": 2,
|
|
30
|
+
"alternative": false
|
|
31
|
+
},
|
|
32
|
+
"decision": "continue"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"facts": {
|
|
36
|
+
"risk": "low",
|
|
37
|
+
"missed_deadlines": 3,
|
|
38
|
+
"alternative": true
|
|
39
|
+
},
|
|
40
|
+
"decision": "replace"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"facts": {
|
|
44
|
+
"risk": "low",
|
|
45
|
+
"missed_deadlines": 3,
|
|
46
|
+
"alternative": false
|
|
47
|
+
},
|
|
48
|
+
"decision": "monitor"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"facts": {
|
|
52
|
+
"risk": "low",
|
|
53
|
+
"missed_deadlines": 5,
|
|
54
|
+
"alternative": true
|
|
55
|
+
},
|
|
56
|
+
"decision": "replace"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"facts": {
|
|
60
|
+
"risk": "low",
|
|
61
|
+
"missed_deadlines": 5,
|
|
62
|
+
"alternative": false
|
|
63
|
+
},
|
|
64
|
+
"decision": "monitor"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"facts": {
|
|
68
|
+
"risk": "low",
|
|
69
|
+
"missed_deadlines": 6,
|
|
70
|
+
"alternative": true
|
|
71
|
+
},
|
|
72
|
+
"decision": "replace"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"facts": {
|
|
76
|
+
"risk": "low",
|
|
77
|
+
"missed_deadlines": 6,
|
|
78
|
+
"alternative": false
|
|
79
|
+
},
|
|
80
|
+
"decision": "monitor"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"facts": {
|
|
84
|
+
"risk": "low",
|
|
85
|
+
"missed_deadlines": 8,
|
|
86
|
+
"alternative": true
|
|
87
|
+
},
|
|
88
|
+
"decision": "replace"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"facts": {
|
|
92
|
+
"risk": "low",
|
|
93
|
+
"missed_deadlines": 8,
|
|
94
|
+
"alternative": false
|
|
95
|
+
},
|
|
96
|
+
"decision": "monitor"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"facts": {
|
|
100
|
+
"risk": "low",
|
|
101
|
+
"missed_deadlines": 9,
|
|
102
|
+
"alternative": true
|
|
103
|
+
},
|
|
104
|
+
"decision": "replace"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"facts": {
|
|
108
|
+
"risk": "low",
|
|
109
|
+
"missed_deadlines": 9,
|
|
110
|
+
"alternative": false
|
|
111
|
+
},
|
|
112
|
+
"decision": "monitor"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"facts": {
|
|
116
|
+
"risk": "high",
|
|
117
|
+
"missed_deadlines": 0,
|
|
118
|
+
"alternative": true
|
|
119
|
+
},
|
|
120
|
+
"decision": "escalate"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"facts": {
|
|
124
|
+
"risk": "high",
|
|
125
|
+
"missed_deadlines": 0,
|
|
126
|
+
"alternative": false
|
|
127
|
+
},
|
|
128
|
+
"decision": "escalate"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"facts": {
|
|
132
|
+
"risk": "high",
|
|
133
|
+
"missed_deadlines": 2,
|
|
134
|
+
"alternative": true
|
|
135
|
+
},
|
|
136
|
+
"decision": "escalate"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"facts": {
|
|
140
|
+
"risk": "high",
|
|
141
|
+
"missed_deadlines": 2,
|
|
142
|
+
"alternative": false
|
|
143
|
+
},
|
|
144
|
+
"decision": "escalate"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"facts": {
|
|
148
|
+
"risk": "high",
|
|
149
|
+
"missed_deadlines": 3,
|
|
150
|
+
"alternative": true
|
|
151
|
+
},
|
|
152
|
+
"decision": "escalate"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"facts": {
|
|
156
|
+
"risk": "high",
|
|
157
|
+
"missed_deadlines": 3,
|
|
158
|
+
"alternative": false
|
|
159
|
+
},
|
|
160
|
+
"decision": "escalate"
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"facts": {
|
|
164
|
+
"risk": "high",
|
|
165
|
+
"missed_deadlines": 5,
|
|
166
|
+
"alternative": true
|
|
167
|
+
},
|
|
168
|
+
"decision": "escalate"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"facts": {
|
|
172
|
+
"risk": "high",
|
|
173
|
+
"missed_deadlines": 5,
|
|
174
|
+
"alternative": false
|
|
175
|
+
},
|
|
176
|
+
"decision": "escalate"
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"facts": {
|
|
180
|
+
"risk": "high",
|
|
181
|
+
"missed_deadlines": 6,
|
|
182
|
+
"alternative": true
|
|
183
|
+
},
|
|
184
|
+
"decision": "escalate"
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"facts": {
|
|
188
|
+
"risk": "high",
|
|
189
|
+
"missed_deadlines": 6,
|
|
190
|
+
"alternative": false
|
|
191
|
+
},
|
|
192
|
+
"decision": "escalate"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"facts": {
|
|
196
|
+
"risk": "high",
|
|
197
|
+
"missed_deadlines": 8,
|
|
198
|
+
"alternative": true
|
|
199
|
+
},
|
|
200
|
+
"decision": "escalate"
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"facts": {
|
|
204
|
+
"risk": "high",
|
|
205
|
+
"missed_deadlines": 8,
|
|
206
|
+
"alternative": false
|
|
207
|
+
},
|
|
208
|
+
"decision": "escalate"
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"facts": {
|
|
212
|
+
"risk": "high",
|
|
213
|
+
"missed_deadlines": 9,
|
|
214
|
+
"alternative": true
|
|
215
|
+
},
|
|
216
|
+
"decision": "escalate"
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"facts": {
|
|
220
|
+
"risk": "high",
|
|
221
|
+
"missed_deadlines": 9,
|
|
222
|
+
"alternative": false
|
|
223
|
+
},
|
|
224
|
+
"decision": "escalate"
|
|
225
|
+
}
|
|
226
|
+
]
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"facts": {
|
|
4
|
+
"risk": "low",
|
|
5
|
+
"missed_deadlines": 1,
|
|
6
|
+
"alternative": true
|
|
7
|
+
},
|
|
8
|
+
"decision": "continue"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"facts": {
|
|
12
|
+
"risk": "low",
|
|
13
|
+
"missed_deadlines": 1,
|
|
14
|
+
"alternative": false
|
|
15
|
+
},
|
|
16
|
+
"decision": "continue"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"facts": {
|
|
20
|
+
"risk": "low",
|
|
21
|
+
"missed_deadlines": 4,
|
|
22
|
+
"alternative": true
|
|
23
|
+
},
|
|
24
|
+
"decision": "replace"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"facts": {
|
|
28
|
+
"risk": "low",
|
|
29
|
+
"missed_deadlines": 4,
|
|
30
|
+
"alternative": false
|
|
31
|
+
},
|
|
32
|
+
"decision": "monitor"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"facts": {
|
|
36
|
+
"risk": "low",
|
|
37
|
+
"missed_deadlines": 7,
|
|
38
|
+
"alternative": true
|
|
39
|
+
},
|
|
40
|
+
"decision": "replace"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"facts": {
|
|
44
|
+
"risk": "low",
|
|
45
|
+
"missed_deadlines": 7,
|
|
46
|
+
"alternative": false
|
|
47
|
+
},
|
|
48
|
+
"decision": "monitor"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"facts": {
|
|
52
|
+
"risk": "high",
|
|
53
|
+
"missed_deadlines": 1,
|
|
54
|
+
"alternative": true
|
|
55
|
+
},
|
|
56
|
+
"decision": "escalate"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"facts": {
|
|
60
|
+
"risk": "high",
|
|
61
|
+
"missed_deadlines": 1,
|
|
62
|
+
"alternative": false
|
|
63
|
+
},
|
|
64
|
+
"decision": "escalate"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"facts": {
|
|
68
|
+
"risk": "high",
|
|
69
|
+
"missed_deadlines": 4,
|
|
70
|
+
"alternative": true
|
|
71
|
+
},
|
|
72
|
+
"decision": "escalate"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"facts": {
|
|
76
|
+
"risk": "high",
|
|
77
|
+
"missed_deadlines": 4,
|
|
78
|
+
"alternative": false
|
|
79
|
+
},
|
|
80
|
+
"decision": "escalate"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"facts": {
|
|
84
|
+
"risk": "high",
|
|
85
|
+
"missed_deadlines": 7,
|
|
86
|
+
"alternative": true
|
|
87
|
+
},
|
|
88
|
+
"decision": "escalate"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"facts": {
|
|
92
|
+
"risk": "high",
|
|
93
|
+
"missed_deadlines": 7,
|
|
94
|
+
"alternative": false
|
|
95
|
+
},
|
|
96
|
+
"decision": "escalate"
|
|
97
|
+
}
|
|
98
|
+
]
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "cogniform"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Learn, inspect, transfer and evaluate decision policies from expert demonstrations."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
keywords = ["ai", "decision-policy", "imitation-learning", "agents", "explainability"]
|
|
13
|
+
classifiers = ["Development Status :: 3 - Alpha", "Programming Language :: Python :: 3", "Topic :: Scientific/Engineering :: Artificial Intelligence"]
|
|
14
|
+
|
|
15
|
+
[project.urls]
|
|
16
|
+
Repository = "https://github.com/AMallur/Cogniform"
|
|
17
|
+
Issues = "https://github.com/AMallur/Cogniform/issues"
|
|
18
|
+
|
|
19
|
+
[project.scripts]
|
|
20
|
+
cogniform = "cogniform.cli:main"
|
|
21
|
+
|
|
22
|
+
[tool.setuptools.packages.find]
|
|
23
|
+
where = ["src"]
|
|
24
|
+
|
|
25
|
+
[tool.pytest.ini_options]
|
|
26
|
+
pythonpath = ["src"]
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"""Cogniform: portable, inspectable decision policies."""
|
|
2
|
+
from .core import Condition, Decision, Demonstration, Judgment
|
|
3
|
+
from .models import Model, CallableModel, OpenAIModel, AnthropicModel
|
|
4
|
+
from .evaluation import Evaluation, evaluate, split_demonstrations
|
|
5
|
+
|
|
6
|
+
__version__ = '0.1.0'
|
|
7
|
+
__all__ = ['Condition','Decision','Demonstration','Judgment','Model','CallableModel','OpenAIModel','AnthropicModel','Evaluation','evaluate','split_demonstrations']
|