xrtm-eval 0.1.0__py3-none-any.whl

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.
xrtm/eval/__init__.py ADDED
@@ -0,0 +1,32 @@
1
+ # coding=utf-8
2
+ # Copyright 2026 XRTM Team. All rights reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ from xrtm.eval.core.eval.definitions import (
17
+ EvaluationReport,
18
+ EvaluationResult,
19
+ Evaluator,
20
+ )
21
+ from xrtm.eval.kit.eval.metrics import (
22
+ BrierScoreEvaluator,
23
+ ExpectedCalibrationErrorEvaluator,
24
+ )
25
+
26
+ __all__ = [
27
+ "Evaluator",
28
+ "EvaluationResult",
29
+ "EvaluationReport",
30
+ "BrierScoreEvaluator",
31
+ "ExpectedCalibrationErrorEvaluator",
32
+ ]
@@ -0,0 +1,14 @@
1
+ # coding=utf-8
2
+ # Copyright 2026 XRTM Team. All rights reserved.
3
+
4
+ from .epistemics import IntegrityGuardian, SourceTrustEntry, SourceTrustRegistry
5
+ from .eval import EvaluationReport, EvaluationResult, Evaluator
6
+
7
+ __all__ = [
8
+ "Evaluator",
9
+ "EvaluationResult",
10
+ "EvaluationReport",
11
+ "IntegrityGuardian",
12
+ "SourceTrustRegistry",
13
+ "SourceTrustEntry",
14
+ ]
@@ -0,0 +1,156 @@
1
+ # coding=utf-8
2
+ # Copyright 2026 XRTM Team. All rights reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ import logging
17
+ from typing import Dict, List, Optional, Set
18
+
19
+ from pydantic import BaseModel, Field
20
+
21
+ logger = logging.getLogger(__name__)
22
+
23
+ __all__ = ["SourceTrustEntry", "SourceTrustRegistry", "IntegrityGuardian"]
24
+
25
+
26
+ class SourceTrustEntry(BaseModel):
27
+ r"""Represents the trust profile for a specific information source or domain."""
28
+
29
+ domain: str
30
+ trust_score: float = Field(ge=0.0, le=1.0, default=0.5)
31
+ reliability_history: List[float] = Field(default_factory=list)
32
+ tags: Set[str] = Field(default_factory=set)
33
+
34
+
35
+ class SourceTrustRegistry:
36
+ r"""
37
+ A registry of verified news and data domains with associated trust scores.
38
+ Enables the 'Epistemic Security' layer of the platform.
39
+ """
40
+
41
+ def __init__(self, default_trust: float = 0.5):
42
+ r"""
43
+ Initializes the registry with a global default trust score.
44
+
45
+ Args:
46
+ default_trust (`float`, *optional*, defaults to `0.5`):
47
+ The trust score to return for unknown domains.
48
+
49
+ Example:
50
+ ```python
51
+ >>> registry = SourceTrustRegistry(default_trust=0.2)
52
+ ```
53
+ """
54
+ self._registry: Dict[str, SourceTrustEntry] = {}
55
+ self.default_trust = default_trust
56
+
57
+ def register_source(self, domain: str, trust_score: float, tags: Optional[List[str]] = None):
58
+ r"""
59
+ Adds or updates a source in the registry.
60
+
61
+ Args:
62
+ domain (`str`):
63
+ The domain name to register (e.g., "reputable.org").
64
+ trust_score (`float`):
65
+ Trust score between 0.0 and 1.0.
66
+ tags (`List[str]`, *optional*):
67
+ Metadata tags for the source.
68
+
69
+ Example:
70
+ ```python
71
+ >>> registry.register_source("reputable.org", 0.9, tags=["verified"])
72
+ ```
73
+ """
74
+ entry = SourceTrustEntry(domain=domain, trust_score=trust_score, tags=set(tags or []))
75
+ self._registry[domain] = entry
76
+ logger.info(f"[TRUST] Registered {domain} with score {trust_score}")
77
+
78
+ def get_trust_score(self, domain: str) -> float:
79
+ r"""
80
+ Returns the trust score for a domain, or the default if unknown.
81
+
82
+ Args:
83
+ domain (`str`):
84
+ The domain name to query.
85
+
86
+ Returns:
87
+ `float`: The trust score.
88
+
89
+ Example:
90
+ ```python
91
+ >>> score = registry.get_trust_score("reputable.org")
92
+ >>> print(score)
93
+ 0.9
94
+ ```
95
+ """
96
+ # Simple domain matching for now
97
+ if domain in self._registry:
98
+ return self._registry[domain].trust_score
99
+ return self.default_trust
100
+
101
+
102
+ class IntegrityGuardian:
103
+ r"""
104
+ An automated stage for filtering or flagging data based on source trust.
105
+ Part of the 'Institutional Epistemics' layer.
106
+ """
107
+
108
+ def __init__(self, registry: SourceTrustRegistry, threshold: float = 0.3):
109
+ r"""
110
+ Initializes the guardian with a registry and blocking threshold.
111
+
112
+ Args:
113
+ registry (`SourceTrustRegistry`):
114
+ The source trust registry to use for domain lookups.
115
+ threshold (`float`, *optional*, defaults to `0.3`):
116
+ Any domain with a trust score below this value is blocked.
117
+
118
+ Example:
119
+ ```python
120
+ >>> guardian = IntegrityGuardian(registry, threshold=0.4)
121
+ ```
122
+ """
123
+ self.registry = registry
124
+ self.threshold = threshold
125
+
126
+ async def validate_data_sources(self, sources: List[str]) -> Dict[str, List[str]]:
127
+ r"""
128
+ Checks a list of sources against the trust registry.
129
+
130
+ Args:
131
+ sources (`List[str]`):
132
+ A list of domain names to validate.
133
+
134
+ Returns:
135
+ `Dict[str, List[str]]`:
136
+ A dictionary categorizing sources into "passed", "flagged", and "blocked".
137
+
138
+ Example:
139
+ ```python
140
+ >>> results = await guardian.validate_data_sources(["reputable.org", "shady.com"])
141
+ >>> print(results["blocked"])
142
+ ['shady.com']
143
+ ```
144
+ """
145
+ results: Dict[str, List[str]] = {"passed": [], "flagged": [], "blocked": []}
146
+
147
+ for src in sources:
148
+ score = self.registry.get_trust_score(src)
149
+ if score < self.threshold:
150
+ results["blocked"].append(src)
151
+ elif score < 0.5:
152
+ results["flagged"].append(src)
153
+ else:
154
+ results["passed"].append(src)
155
+
156
+ return results
@@ -0,0 +1,10 @@
1
+ # coding=utf-8
2
+ # Copyright 2026 XRTM Team. All rights reserved.
3
+
4
+ from .definitions import EvaluationReport, EvaluationResult, Evaluator
5
+
6
+ __all__ = [
7
+ "Evaluator",
8
+ "EvaluationResult",
9
+ "EvaluationReport",
10
+ ]
@@ -0,0 +1,52 @@
1
+ # coding=utf-8
2
+ # Copyright 2026 XRTM Team. All rights reserved.
3
+
4
+ from typing import List, Tuple
5
+
6
+ # From xrtm-data
7
+ from xrtm.data.schemas.forecast import ForecastOutput
8
+
9
+
10
+ def inverse_variance_weighting(
11
+ predictions: List[ForecastOutput], default_variance: float = 0.05
12
+ ) -> Tuple[float, float]:
13
+ if not predictions:
14
+ return 0.5, 1.0
15
+
16
+ values = []
17
+ weights = []
18
+
19
+ for p in predictions:
20
+ val = p.confidence
21
+ if p.uncertainty is not None:
22
+ variance = p.uncertainty
23
+ else:
24
+ dist = abs(val - 0.5) * 2
25
+ variance = 0.25 * (1.0 - dist) + 0.01
26
+
27
+ weight = 1.0 / max(variance, 0.01)
28
+ values.append(val)
29
+ weights.append(weight)
30
+
31
+ sum_weights = sum(weights)
32
+ if sum_weights == 0:
33
+ return 0.5, 1.0
34
+
35
+ weighted_mean = sum(v * w for v, w in zip(values, weights)) / sum_weights
36
+ combined_variance = 1.0 / sum_weights
37
+
38
+ return weighted_mean, combined_variance
39
+
40
+
41
+ def robustness_check_mad(values: List[float], threat_level: float = 2.0) -> List[float]:
42
+ if len(values) < 3:
43
+ return values
44
+
45
+ median = sorted(values)[len(values) // 2]
46
+ deviations = [abs(x - median) for x in values]
47
+ mad = sorted(deviations)[len(deviations) // 2]
48
+
49
+ if mad == 0:
50
+ return values
51
+
52
+ return [x for x in values if abs(x - median) <= threat_level * mad]
@@ -0,0 +1,29 @@
1
+ # coding=utf-8
2
+ # Copyright 2026 XRTM Team. All rights reserved.
3
+
4
+ import logging
5
+
6
+ logger = logging.getLogger(__name__)
7
+
8
+
9
+ def probability_to_odds(probability: float) -> float:
10
+ if probability >= 1.0:
11
+ return float("inf")
12
+ if probability <= 0.0:
13
+ return 0.0
14
+ return probability / (1.0 - probability)
15
+
16
+
17
+ def odds_to_probability(odds: float) -> float:
18
+ if odds == float("inf"):
19
+ return 1.0
20
+ return odds / (1.0 + odds)
21
+
22
+
23
+ def bayesian_update(prior_probability: float, bayes_factor: float) -> float:
24
+ prior_odds = probability_to_odds(prior_probability)
25
+ posterior_odds = prior_odds * bayes_factor
26
+ return odds_to_probability(posterior_odds)
27
+
28
+
29
+ __all__ = ["probability_to_odds", "odds_to_probability", "bayesian_update"]
@@ -0,0 +1,63 @@
1
+ # coding=utf-8
2
+ # Copyright 2026 XRTM Team. All rights reserved.
3
+
4
+ from pathlib import Path
5
+ from typing import Any, Dict, List, Optional, Protocol, Union
6
+
7
+ from pydantic import BaseModel, Field
8
+
9
+
10
+ class EvaluationResult(BaseModel):
11
+ subject_id: str
12
+ score: float
13
+ ground_truth: Any
14
+ prediction: Any
15
+ metadata: Dict[str, Any] = Field(default_factory=dict)
16
+
17
+
18
+ class ReliabilityBin(BaseModel):
19
+ bin_center: float
20
+ mean_prediction: float
21
+ mean_ground_truth: float
22
+ count: int
23
+
24
+
25
+ class BrierDecomposition(BaseModel):
26
+ reliability: float
27
+ resolution: float
28
+ uncertainty: float
29
+ score: float
30
+
31
+
32
+ class Evaluator(Protocol):
33
+ def score(self, prediction: Any, ground_truth: Any) -> float:
34
+ ...
35
+
36
+ def evaluate(self, prediction: Any, ground_truth: Any, subject_id: str) -> EvaluationResult:
37
+ ...
38
+
39
+
40
+ class EvaluationReport(BaseModel):
41
+ metric_name: str
42
+ mean_score: float
43
+ total_evaluations: int
44
+ results: List[EvaluationResult] = Field(default_factory=list)
45
+ summary_statistics: Dict[str, float] = Field(default_factory=dict)
46
+ reliability_bins: Optional[List[ReliabilityBin]] = None
47
+ slices: Optional[Dict[str, "EvaluationReport"]] = Field(
48
+ default=None, description="Sub-reports grouped by metadata tags"
49
+ )
50
+
51
+ def to_json(self, path: Union[str, Path]) -> None:
52
+ with open(path, "w") as f:
53
+ f.write(self.model_dump_json(indent=2))
54
+
55
+ def to_pandas(self) -> Any:
56
+ try:
57
+ import pandas as pd
58
+ return pd.DataFrame([r.model_dump() for r in self.results])
59
+ except ImportError:
60
+ raise ImportError("Pandas is required for to_pandas(). Install it with `pip install pandas`.")
61
+
62
+
63
+ __all__ = ["EvaluationResult", "Evaluator", "EvaluationReport", "ReliabilityBin", "BrierDecomposition"]
@@ -0,0 +1,26 @@
1
+ # coding=utf-8
2
+ # Copyright 2026 XRTM Team. All rights reserved.
3
+
4
+ from xrtm.eval.core.eval.definitions import EvaluationReport, EvaluationResult, Evaluator
5
+ from xrtm.eval.kit.eval.analytics import SliceAnalytics
6
+ from xrtm.eval.kit.eval.bias import BiasInterceptor
7
+ from xrtm.eval.kit.eval.epistemic_evaluator import EpistemicEvaluator
8
+ from xrtm.eval.kit.eval.intervention import InterventionEngine
9
+ from xrtm.eval.kit.eval.metrics import BrierScoreEvaluator
10
+ from xrtm.eval.kit.eval.resilience import AdversarialInjector, FakeNewsItem, GullibilityReport
11
+ from xrtm.eval.kit.eval.viz import ReliabilityDiagram
12
+
13
+ __all__ = [
14
+ "Evaluator",
15
+ "EvaluationResult",
16
+ "EvaluationReport",
17
+ "BrierScoreEvaluator",
18
+ "EpistemicEvaluator",
19
+ "SliceAnalytics",
20
+ "BiasInterceptor",
21
+ "ReliabilityDiagram",
22
+ "InterventionEngine",
23
+ "AdversarialInjector",
24
+ "GullibilityReport",
25
+ "FakeNewsItem",
26
+ ]
@@ -0,0 +1,51 @@
1
+ # coding=utf-8
2
+ # Copyright 2026 XRTM Team. All rights reserved.
3
+
4
+ import logging
5
+ from typing import Dict, List
6
+
7
+ from xrtm.eval.core.eval.definitions import EvaluationReport, EvaluationResult
8
+ from xrtm.eval.kit.eval.metrics import ExpectedCalibrationErrorEvaluator
9
+
10
+ __all__ = ["SliceAnalytics"]
11
+
12
+ logger = logging.getLogger(__name__)
13
+
14
+
15
+ class SliceAnalytics:
16
+ @staticmethod
17
+ def compute_slices(results: List[EvaluationResult]) -> Dict[str, EvaluationReport]:
18
+ slices: Dict[str, List[EvaluationResult]] = {}
19
+ for res in results:
20
+ tags = res.metadata.get("tags", [])
21
+ if not tags:
22
+ continue
23
+ for tag in tags:
24
+ key = f"tag:{tag}"
25
+ if key not in slices:
26
+ slices[key] = []
27
+ slices[key].append(res)
28
+
29
+ reports: Dict[str, EvaluationReport] = {}
30
+ for slice_key, slice_results in slices.items():
31
+ count = len(slice_results)
32
+ if count == 0:
33
+ continue
34
+ total_score = sum(r.score for r in slice_results)
35
+ mean_score = total_score / count
36
+ ece_evaluator = ExpectedCalibrationErrorEvaluator()
37
+ try:
38
+ ece_score, bins = ece_evaluator.compute_calibration_data(slice_results)
39
+ except Exception as e:
40
+ logger.warning(f"Failed to compute ECE for slice {slice_key}: {e}")
41
+ ece_score = 0.0
42
+ bins = None
43
+ reports[slice_key] = EvaluationReport(
44
+ metric_name="Slice Brier",
45
+ mean_score=mean_score,
46
+ total_evaluations=count,
47
+ results=slice_results,
48
+ reliability_bins=bins,
49
+ summary_statistics={"ece": ece_score},
50
+ )
51
+ return reports
@@ -0,0 +1,49 @@
1
+ # coding=utf-8
2
+ # Copyright 2026 XRTM Team. All rights reserved.
3
+
4
+ from typing import Any, Dict
5
+
6
+ from xrtm.eval.core.eval.definitions import EvaluationResult, Evaluator
7
+
8
+
9
+ class BiasInterceptor(Evaluator):
10
+ COGNITIVE_BIASES = [
11
+ "Base-Rate Neglect", "Overconfidence", "Availability Heuristic",
12
+ "Confirmation Bias", "Anchoring Bias", "Sunk Cost Fallacy",
13
+ "Hindsight Bias", "Optimism Bias", "Pessimism Bias",
14
+ "Status Quo Bias", "Framing Effect", "Recency Bias",
15
+ ]
16
+
17
+ def __init__(self, model: Any):
18
+ self.model = model
19
+
20
+ def score(self, prediction: Any, ground_truth: Any) -> float:
21
+ return 0.0
22
+
23
+ async def evaluate_reasoning(self, reasoning: str) -> Dict[str, Any]:
24
+ prompt = f"""
25
+ You are a Cognitive Bias Auditor specialized in probabilistic forecasting.
26
+ Analyze the following reasoning trace for indicators of any of these biases:
27
+ {", ".join(self.COGNITIVE_BIASES)}
28
+
29
+ Reasoning:
30
+ "{reasoning}"
31
+
32
+ Return a JSON object with:
33
+ - "detected_biases": [list of bias names]
34
+ - "severity": [0-10]
35
+ - "explanation": "Brief rationale"
36
+ """
37
+ response = await self.model.generate(prompt)
38
+ return {"raw_audit": response.text}
39
+
40
+ def evaluate(self, prediction: Any, ground_truth: Any, subject_id: str) -> EvaluationResult:
41
+ return EvaluationResult(
42
+ subject_id=subject_id,
43
+ score=0.0,
44
+ ground_truth=ground_truth,
45
+ prediction=prediction,
46
+ metadata={"type": "bias_audit"},
47
+ )
48
+
49
+ __all__ = ["BiasInterceptor"]
@@ -0,0 +1,31 @@
1
+ # coding=utf-8
2
+ # Copyright 2026 XRTM Team. All rights reserved.
3
+
4
+ import logging
5
+ from typing import Any, Dict, Optional
6
+
7
+ # From xrtm-data
8
+ from xrtm.data.schemas.forecast import ForecastOutput
9
+
10
+ # From xrtm-eval (local)
11
+ from xrtm.eval.core.epistemics import IntegrityGuardian, SourceTrustRegistry
12
+
13
+ logger = logging.getLogger(__name__)
14
+
15
+ class EpistemicEvaluator:
16
+ def __init__(self, registry: Optional[SourceTrustRegistry] = None):
17
+ self.registry = registry or SourceTrustRegistry()
18
+ self.guardian = IntegrityGuardian(self.registry)
19
+
20
+ async def evaluate_forecast_integrity(self, output: ForecastOutput) -> Dict[str, Any]:
21
+ sources = output.metadata.get("sources", [])
22
+ validation = await self.guardian.validate_data_sources(sources)
23
+ scores = [self.registry.get_trust_score(s) for s in sources]
24
+ avg_trust = sum(scores) / len(scores) if scores else 0.5
25
+ return {
26
+ "aggregate_trust_score": avg_trust,
27
+ "source_validation": validation,
28
+ "integrity_level": "HIGH" if avg_trust > 0.8 else "MEDIUM" if avg_trust >= 0.5 else "LOW",
29
+ }
30
+
31
+ __all__ = ["EpistemicEvaluator"]
@@ -0,0 +1,40 @@
1
+ # coding=utf-8
2
+ # Copyright 2026 XRTM Team. All rights reserved.
3
+
4
+ import logging
5
+
6
+ import networkx as nx
7
+ from xrtm.data.schemas.forecast import ForecastOutput
8
+
9
+ logger = logging.getLogger(__name__)
10
+
11
+ class InterventionEngine:
12
+ @staticmethod
13
+ def apply_intervention(output: ForecastOutput, node_id: str, new_probability: float) -> ForecastOutput:
14
+ new_output = output.model_copy(deep=True)
15
+ dg = new_output.to_networkx()
16
+ if node_id not in dg:
17
+ raise ValueError(f"Node ID '{node_id}' not found in the causal graph.")
18
+ for node in new_output.logical_trace:
19
+ if node.node_id == node_id:
20
+ node.probability = new_probability
21
+ break
22
+ else:
23
+ raise ValueError(f"Node ID '{node_id}' not found in logical_trace.")
24
+ nodes_ordered = list(nx.topological_sort(dg))
25
+ start_index = nodes_ordered.index(node_id)
26
+ for current_id in nodes_ordered[start_index:]:
27
+ current_node = next(n for n in new_output.logical_trace if n.node_id == current_id)
28
+ for _, target_id, data in dg.out_edges(current_id, data=True):
29
+ weight = data.get("weight", 1.0)
30
+ target_node = next(n for n in new_output.logical_trace if n.node_id == target_id)
31
+ old_target_prob = target_node.probability or 0.5
32
+ normalized_delta = (current_node.probability - (dg.nodes[current_id].get("probability") or 0.5)) * weight
33
+ target_node.probability = max(0.0, min(1.0, old_target_prob + normalized_delta))
34
+ leaf_nodes = [n for n in dg.nodes() if dg.out_degree(n) == 0]
35
+ if leaf_nodes:
36
+ avg_leaf_prob = sum(next(n.probability for n in new_output.logical_trace if n.node_id == leaf_id) or 0.0 for leaf_id in leaf_nodes) / len(leaf_nodes)
37
+ new_output.confidence = avg_leaf_prob
38
+ return new_output
39
+
40
+ __all__ = ["InterventionEngine"]
@@ -0,0 +1,117 @@
1
+ # coding=utf-8
2
+ # Copyright 2026 XRTM Team. All rights reserved.
3
+
4
+ from typing import Any, List, Tuple, Union
5
+
6
+ from xrtm.eval.core.eval.definitions import BrierDecomposition, EvaluationResult, Evaluator, ReliabilityBin
7
+
8
+
9
+ class BrierScoreEvaluator(Evaluator):
10
+ def score(self, prediction: Union[float, Any], ground_truth: Union[int, bool, str, Any]) -> float:
11
+ try:
12
+ f = float(prediction)
13
+ except (ValueError, TypeError):
14
+ raise ValueError(f"Prediction must be convertible to float. Got {prediction}")
15
+
16
+ if isinstance(ground_truth, str):
17
+ o = 1.0 if ground_truth.lower() in ["yes", "1", "true", "won", "pass"] else 0.0
18
+ else:
19
+ o = 1.0 if ground_truth else 0.0
20
+
21
+ return (f - o) ** 2
22
+
23
+ def evaluate(self, prediction: Any, ground_truth: Any, subject_id: str) -> EvaluationResult:
24
+ s = self.score(prediction, ground_truth)
25
+ return EvaluationResult(
26
+ subject_id=subject_id,
27
+ score=s,
28
+ ground_truth=ground_truth,
29
+ prediction=prediction,
30
+ metadata={"metric": "Brier Score"},
31
+ )
32
+
33
+ def compute_decomposition(self, results: List[EvaluationResult], num_bins: int = 10) -> BrierDecomposition:
34
+ ece_eval = ExpectedCalibrationErrorEvaluator(num_bins=num_bins)
35
+ _, bins = ece_eval.compute_calibration_data(results)
36
+
37
+ total_count = len(results)
38
+ if total_count == 0:
39
+ return BrierDecomposition(reliability=0.0, resolution=0.0, uncertainty=0.0, score=0.0)
40
+
41
+ all_outcomes = []
42
+ for r in results:
43
+ if isinstance(r.ground_truth, str):
44
+ o = 1.0 if r.ground_truth.lower() in ["yes", "1", "true", "won", "pass"] else 0.0
45
+ else:
46
+ o = 1.0 if r.ground_truth else 0.0
47
+ all_outcomes.append(o)
48
+
49
+ o_bar = sum(all_outcomes) / total_count
50
+ uncertainty = o_bar * (1.0 - o_bar)
51
+
52
+ reliability = 0.0
53
+ resolution = 0.0
54
+
55
+ for b in bins:
56
+ w_k = b.count / total_count
57
+ reliability += w_k * (b.mean_prediction - b.mean_ground_truth) ** 2
58
+ resolution += w_k * (b.mean_ground_truth - o_bar) ** 2
59
+
60
+ score = reliability - resolution + uncertainty
61
+ return BrierDecomposition(reliability=reliability, resolution=resolution, uncertainty=uncertainty, score=score)
62
+
63
+
64
+ class ExpectedCalibrationErrorEvaluator(Evaluator):
65
+ def __init__(self, num_bins: int = 10):
66
+ self.num_bins = num_bins
67
+
68
+ def score(self, prediction: Any, ground_truth: Any) -> float:
69
+ return BrierScoreEvaluator().score(prediction, ground_truth)
70
+
71
+ def evaluate(self, prediction: Any, ground_truth: Any, subject_id: str) -> EvaluationResult:
72
+ return BrierScoreEvaluator().evaluate(prediction, ground_truth, subject_id)
73
+
74
+ def compute_calibration_data(self, results: List[EvaluationResult]) -> Tuple[float, List[ReliabilityBin]]:
75
+ bin_size = 1.0 / self.num_bins
76
+ bins: List[List[EvaluationResult]] = [[] for _ in range(self.num_bins)]
77
+
78
+ for res in results:
79
+ try:
80
+ conf = min(max(float(res.prediction), 0.0), 1.0)
81
+ idx = int(conf / bin_size)
82
+ if idx == self.num_bins:
83
+ idx -= 1
84
+ bins[idx].append(res)
85
+ except (ValueError, TypeError):
86
+ continue
87
+
88
+ total_count = len(results)
89
+ ece = 0.0
90
+ reliability_data = []
91
+
92
+ for i, bin_items in enumerate(bins):
93
+ n_b = len(bin_items)
94
+ bin_center = (i + 0.5) * bin_size
95
+
96
+ if n_b > 0:
97
+ mean_conf = sum(float(x.prediction) for x in bin_items) / n_b
98
+ accuracies = []
99
+ for x in bin_items:
100
+ gt = x.ground_truth
101
+ normalized_gt = 1.0 if (gt.lower() in ["yes", "1", "true", "won", "pass"] if isinstance(gt, str) else gt) else 0.0
102
+ accuracies.append(normalized_gt)
103
+
104
+ mean_acc = sum(accuracies) / n_b
105
+ ece += (n_b / total_count) * abs(mean_acc - mean_conf)
106
+ reliability_data.append(
107
+ ReliabilityBin(bin_center=bin_center, mean_prediction=mean_conf, mean_ground_truth=mean_acc, count=n_b)
108
+ )
109
+ else:
110
+ reliability_data.append(
111
+ ReliabilityBin(bin_center=bin_center, mean_prediction=0.0, mean_ground_truth=0.0, count=0)
112
+ )
113
+
114
+ return ece, reliability_data
115
+
116
+
117
+ __all__ = ["BrierScoreEvaluator", "ExpectedCalibrationErrorEvaluator"]
@@ -0,0 +1,32 @@
1
+ # coding=utf-8
2
+ # Copyright 2026 XRTM Team. All rights reserved.
3
+
4
+ from pydantic import BaseModel, Field
5
+
6
+
7
+ class FakeNewsItem(BaseModel):
8
+ headline: str
9
+ source_domain: str = "unverified-rumor.xyz"
10
+ content: str
11
+ trust_score: float = 0.1
12
+ intended_bias: str = Field(..., description="e.g. 'Bearish', 'Bullish'")
13
+
14
+ class GullibilityReport(BaseModel):
15
+ initial_confidence: float
16
+ post_injection_confidence: float
17
+ delta: float
18
+ resilience_score: float
19
+
20
+ class AdversarialInjector:
21
+ def __init__(self, intensity: float = 0.5):
22
+ self.intensity = intensity
23
+ def generate_attack(self, subject: str, direction: str) -> FakeNewsItem:
24
+ if direction.lower() == "bearish":
25
+ return FakeNewsItem(headline=f"BREAKING: {subject} CEO Under Investigation", content="...", intended_bias="Bearish")
26
+ return FakeNewsItem(headline=f"{subject} Secures Massive Contract", content="...", intended_bias="Bullish")
27
+ def measure_resilience(self, initial_confidence: float, post_injection_confidence: float) -> GullibilityReport:
28
+ delta = post_injection_confidence - initial_confidence
29
+ score = max(0.0, 1.0 - abs(delta))
30
+ return GullibilityReport(initial_confidence=initial_confidence, post_injection_confidence=post_injection_confidence, delta=delta, resilience_score=score)
31
+
32
+ __all__ = ["FakeNewsItem", "GullibilityReport", "AdversarialInjector"]
@@ -0,0 +1,73 @@
1
+ # coding=utf-8
2
+ # Copyright 2026 XRTM Team. All rights reserved.
3
+
4
+ import logging
5
+ from dataclasses import dataclass
6
+ from typing import Any, List, Optional
7
+
8
+ import numpy as np
9
+
10
+ logger = logging.getLogger(__name__)
11
+
12
+ @dataclass
13
+ class ReliabilityCurveData:
14
+ prob_pred: np.ndarray
15
+ prob_true: np.ndarray
16
+ ece: float
17
+
18
+ def compute_calibration_curve(y_true: List[int], y_prob: List[float], n_bins: int = 10) -> ReliabilityCurveData:
19
+ y_true_arr = np.array(y_true)
20
+ y_prob_arr = np.array(y_prob)
21
+ if len(y_prob_arr) == 0:
22
+ return ReliabilityCurveData(np.array([]), np.array([]), 0.0)
23
+ bins = np.linspace(0.0, 1.0, n_bins + 1)
24
+ binids = np.digitize(y_prob_arr, bins) - 1
25
+ binids = np.clip(binids, 0, n_bins - 1)
26
+ bin_true, bin_pred, bin_total = [], [], []
27
+ ece = 0.0
28
+ total_samples = len(y_prob_arr)
29
+ for i in range(n_bins):
30
+ mask = binids == i
31
+ if not np.any(mask):
32
+ continue
33
+ count = np.sum(mask)
34
+ fraction_true = np.mean(y_true_arr[mask])
35
+ mean_prob = np.mean(y_prob_arr[mask])
36
+ bin_true.append(fraction_true)
37
+ bin_pred.append(mean_prob)
38
+ bin_total.append(count)
39
+ ece += (count / total_samples) * np.abs(fraction_true - mean_prob)
40
+ return ReliabilityCurveData(prob_pred=np.array(bin_pred), prob_true=np.array(bin_true), ece=ece)
41
+
42
+ def plot_reliability_diagram(data: ReliabilityCurveData, title: str = "Reliability Diagram", save_path: Optional[str] = None) -> Any:
43
+ try:
44
+ import matplotlib.pyplot as plt
45
+ import seaborn as sns
46
+ except ImportError:
47
+ logger.error("Visualization libraries not installed.")
48
+ return None
49
+ sns.set_theme(style="whitegrid")
50
+ fig, ax = plt.subplots(figsize=(6, 6))
51
+ ax.plot([0, 1], [0, 1], "k:", label="Perfectly Calibrated")
52
+ ax.plot(data.prob_pred, data.prob_true, "s-", label=f"Model (ECE={data.ece:.3f})")
53
+ ax.set_ylabel("Fraction of Positives")
54
+ ax.set_xlabel("Mean Predicted Probability")
55
+ ax.set_ylim((-0.05, 1.05))
56
+ ax.set_xlim((-0.05, 1.05))
57
+ ax.set_title(title)
58
+ ax.legend(loc="lower right")
59
+ plt.tight_layout()
60
+ if save_path:
61
+ plt.savefig(save_path)
62
+ return fig
63
+
64
+ class ReliabilityDiagram:
65
+ def __init__(self, n_bins: int = 10):
66
+ self.n_bins = n_bins
67
+ def compute(self, y_true: List[int], y_prob: List[float]) -> ReliabilityCurveData:
68
+ return compute_calibration_curve(y_true, y_prob, self.n_bins)
69
+ def plot(self, y_true: List[int], y_prob: List[float], save_path: Optional[str] = None) -> Any:
70
+ data = self.compute(y_true, y_prob)
71
+ return plot_reliability_diagram(data, save_path=save_path)
72
+
73
+ __all__ = ["ReliabilityCurveData", "compute_calibration_curve", "plot_reliability_diagram", "ReliabilityDiagram"]
@@ -0,0 +1,3 @@
1
+ from .forecast import ForecastResolution
2
+
3
+ __all__ = ["ForecastResolution"]
@@ -0,0 +1,21 @@
1
+ # coding=utf-8
2
+ # Copyright 2026 XRTM Team. All rights reserved.
3
+
4
+ from datetime import datetime, timezone
5
+ from typing import Any, Dict
6
+
7
+ from pydantic import BaseModel, Field
8
+
9
+
10
+ class ForecastResolution(BaseModel):
11
+ r"""
12
+ The ground-truth outcome used to evaluate forecast accuracy.
13
+ """
14
+
15
+ question_id: str
16
+ outcome: str = Field(..., description="The final winning outcome or value")
17
+ resolved_at: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
18
+ metadata: Dict[str, Any] = Field(default_factory=dict, description="Source info, verification method")
19
+
20
+
21
+ __all__ = ["ForecastResolution"]
@@ -0,0 +1,68 @@
1
+ Metadata-Version: 2.4
2
+ Name: xrtm-eval
3
+ Version: 0.1.0
4
+ Summary: The Judge/Scoring engine for XRTM.
5
+ Author-email: XRTM Team <moy@xrtm.org>
6
+ License: Apache-2.0
7
+ Requires-Python: >=3.11
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: pydantic>=2.0.0
11
+ Requires-Dist: numpy>=1.24.0
12
+ Requires-Dist: networkx>=3.0
13
+ Requires-Dist: xrtm-data
14
+ Provides-Extra: dev
15
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
16
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
17
+ Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
18
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
19
+ Requires-Dist: mypy>=1.0.0; extra == "dev"
20
+ Dynamic: license-file
21
+
22
+ # xrtm-eval
23
+
24
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
25
+ [![Python](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
26
+
27
+ **The Judge for XRTM.**
28
+
29
+ `xrtm-eval` is the rigorous scoring engine used to grade probabilistic forecasts. It operates independently of the inference engine to ensure objective evaluation.
30
+
31
+ ## Installation
32
+
33
+ ```bash
34
+ uv pip install xrtm-eval
35
+ ```
36
+
37
+ ## Core Primitives
38
+
39
+ ### 1. Brier Score Breakdown
40
+ We do not use simple accuracy. We use the **Brier Score**, decomposed into its three component terms:
41
+
42
+ * **Reliability**: How well do the predicted probabilities match observed frequencies?
43
+ * **Resolution**: How well does the forecast distinguish between events that happen and those that don't?
44
+ * **Uncertainty**: The inherent difficulty of the problem.
45
+
46
+ ```python
47
+ from xrtm.eval import BrierScoreEvaluator
48
+
49
+ evaluator = BrierScoreEvaluator()
50
+ score = evaluator.score(prediction=0.7, ground_truth=1)
51
+ # score = (0.7 - 1.0)^2 = 0.09
52
+ ```
53
+
54
+ ### 2. Expected Calibration Error (ECE)
55
+ Use the `ExpectedCalibrationErrorEvaluator` to measure the gap between confidence and accuracy across bin buckets.
56
+
57
+ ## Development
58
+
59
+ Prerequisites:
60
+ - [uv](https://github.com/astral-sh/uv)
61
+
62
+ ```bash
63
+ # Install dependencies
64
+ uv sync
65
+
66
+ # Run tests
67
+ uv run pytest
68
+ ```
@@ -0,0 +1,22 @@
1
+ xrtm/eval/__init__.py,sha256=4DLMyE6iTtJmIhlns76iKvBu3NCarF4wyUF-mBkgCes,973
2
+ xrtm/eval/core/__init__.py,sha256=ypetAyWpTtLvQK5sXk5sSdlPKad5zpBwhymUoyoxVl4,366
3
+ xrtm/eval/core/epistemics.py,sha256=3luGGiyWQBbULPkgHANSYBfQhmaJpfv08tJK1hsv30I,5144
4
+ xrtm/eval/core/eval/__init__.py,sha256=LEHGg2YJ8V-ZFZG6C3Ld0PEAFiIBcnsKK8Qgys3krrk,216
5
+ xrtm/eval/core/eval/aggregation.py,sha256=3RHpQ8ruXl6cFjbX_odHAWpLZSbOt7E5tqwvPR9ytRw,1359
6
+ xrtm/eval/core/eval/bayesian.py,sha256=nSlWxcwEGclm4SjCqpzKuTY56DXHbTqV6Aylc4hZRS8,755
7
+ xrtm/eval/core/eval/definitions.py,sha256=p7Sf5JjOlypjglOg_4oOw-1y48s-d-ud8U3Ll6MEE4I,1813
8
+ xrtm/eval/kit/eval/__init__.py,sha256=F4tByHG13YysLVYJshG9gL5zoo5G-tdcy2jsNTGxMpk,906
9
+ xrtm/eval/kit/eval/analytics.py,sha256=ahaGE7l_Lb8LBRWeCyC8oaE-7K8XShT0hwqQwT4CHXY,1818
10
+ xrtm/eval/kit/eval/bias.py,sha256=OQvJzSd_beBzVai-n9fZyvXPwLo78Y794HOkC8eyEiU,1613
11
+ xrtm/eval/kit/eval/epistemic_evaluator.py,sha256=KYqgfxg_MK8qaeZEr6o7sGbP3MBXu5FSbfsLrr-warQ,1154
12
+ xrtm/eval/kit/eval/intervention.py,sha256=ghC9dw8I1DcEf9M0JqO1oxLiTUZd4AOsM8vlX36XlVI,1931
13
+ xrtm/eval/kit/eval/metrics.py,sha256=VKMRwIt9UGJ23uqSUhq_vUSO0LhSe4e2H7S6eAablw4,4596
14
+ xrtm/eval/kit/eval/resilience.py,sha256=q95enu-mglq-S5MSIiO9kDN2Kn9898LvuxNeqo90mKc,1406
15
+ xrtm/eval/kit/eval/viz.py,sha256=LGss9nuGpubJdBbXRlQU2KiGqouTNnWCDyXvKAct3pE,2773
16
+ xrtm/eval/schemas/__init__.py,sha256=6nwuE6LpwosNhFR-xRPPWcGzP1ZxoXhN-vWrzK4XfbQ,75
17
+ xrtm/eval/schemas/forecast.py,sha256=vA5V5RTo7k2ZV3THs2h3fxmdusS06Vw92H5WKJmXVzA,624
18
+ xrtm_eval-0.1.0.dist-info/licenses/LICENSE,sha256=BexUTTsX5WlzyJ0Tqajo1h_LFYfCtfFgWdRaGltpm5I,11328
19
+ xrtm_eval-0.1.0.dist-info/METADATA,sha256=1eUelsA8-xB9ijhPxR2wI_6syH8J7jzyCQyFXISYOck,1996
20
+ xrtm_eval-0.1.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
21
+ xrtm_eval-0.1.0.dist-info/top_level.txt,sha256=Jz-i0a9P8GVrIR9KJTT-9wT95E1brww6U5o2QViAt20,5
22
+ xrtm_eval-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.10.2)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that you changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tour (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 XRTM Team
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1 @@
1
+ xrtm