diff --git a/models/__pycache__/consciousness_model.cpython-310.pyc b/models/__pycache__/consciousness_model.cpython-310.pyc index 9bb4def..add1d41 100644 Binary files a/models/__pycache__/consciousness_model.cpython-310.pyc and b/models/__pycache__/consciousness_model.cpython-310.pyc differ diff --git a/models/consciousness_model.py b/models/consciousness_model.py index ff5fb32..13bec35 100644 --- a/models/consciousness_model.py +++ b/models/consciousness_model.py @@ -244,6 +244,8 @@ def calculate_cognition_progress(self, metrics): 'breakdown': scores }) + self.logger.debug(f"Cognition Progress: {cognition_percentage}%") + end_time = time.time() # End profiling self.logger.debug(f"calculate_cognition_progress took {end_time - start_time:.6f} seconds") @@ -267,16 +269,23 @@ def report_cognition_progress(self): f"- Adaptability: {latest['breakdown']['adaptability']*100:.2f}%", f"- Memory Retention: {latest['breakdown']['memory_retention']*100:.2f}%", f"- Emotional Coherence: {latest['breakdown']['emotional_coherence']*100:.2f}%", - f"- Decision Making Efficiency: {latest['breakdown']['decision_making_efficiency']*100:.2f}%\n", - "Areas Needing Improvement:" + f"- Decision Making Efficiency: {latest['breakdown']['decision_making_efficiency']*100:.2f}%\n" + ] + + # Identify areas below target threshold + threshold = self.target_cognition_percentage / 100 # Convert to fraction + areas_needing_improvement = [ + metric.replace('_', ' ').title() + for metric, value in latest['breakdown'].items() + if value < threshold ] - # Identify areas below target threshold (e.g., 70%) - threshold = 70.0 - for metric, value in latest['breakdown'].items(): - if value * 100 < threshold: - readable_metric = metric.replace('_', ' ').title() - report.append(f"- {readable_metric}: {value*100:.2f}%") + if areas_needing_improvement: + report.append("Areas Needing Improvement:") + for area in areas_needing_improvement: + report.append(f"- {area}") + else: + report.append("No areas need improvement.") return "\n".join(report) diff --git a/tests/unit/__pycache__/test_cognition_progress.cpython-310-pytest-8.3.4.pyc b/tests/unit/__pycache__/test_cognition_progress.cpython-310-pytest-8.3.4.pyc index af1a513..f478471 100644 Binary files a/tests/unit/__pycache__/test_cognition_progress.cpython-310-pytest-8.3.4.pyc and b/tests/unit/__pycache__/test_cognition_progress.cpython-310-pytest-8.3.4.pyc differ diff --git a/tests/unit/test_cognition_progress.py b/tests/unit/test_cognition_progress.py index 7f109a7..cc4e155 100644 --- a/tests/unit/test_cognition_progress.py +++ b/tests/unit/test_cognition_progress.py @@ -172,6 +172,24 @@ def test_report_cognition_progress_no_improvement_needed(self, model): report = model.report_cognition_progress() assert "Current Cognition Progress: 81.00%" in report assert "Target Cognition Progress: 70.00%" in report - assert "Areas Needing Improvement:" in report + assert "No areas need improvement." in report # No areas should be listed as needing improvement - assert not any(metric in report for metric in []), "No metrics should need improvement" \ No newline at end of file + assert "Areas Needing Improvement:" not in report + + def test_achieve_90_percent_cognition(self, model): + model.target_cognition_percentage = 90.0 + metrics = { + 'phi': 0.9, + 'coherence': 0.9, + 'stability': 0.9, + 'adaptability': 0.9, + 'memory_retention': 0.9, + 'emotional_coherence': 0.9, + 'decision_making_efficiency': 0.9 + } + progress = model.calculate_cognition_progress(metrics) + report = model.report_cognition_progress() + assert "Current Cognition Progress: 90.00%" in report + assert "Target Cognition Progress: 90.00%" in report + assert "Areas Needing Improvement:" not in report + assert progress == pytest.approx(90.0) \ No newline at end of file