tra-algorithm 1.0.3__tar.gz → 1.0.4__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.
Files changed (26) hide show
  1. {tra_algorithm-1.0.3/tra_algorithm.egg-info → tra_algorithm-1.0.4}/PKG-INFO +6 -6
  2. {tra_algorithm-1.0.3 → tra_algorithm-1.0.4}/docs/CHANGELOG.md +20 -0
  3. {tra_algorithm-1.0.3 → tra_algorithm-1.0.4}/pyproject.toml +5 -5
  4. {tra_algorithm-1.0.3 → tra_algorithm-1.0.4}/setup.py +5 -5
  5. {tra_algorithm-1.0.3 → tra_algorithm-1.0.4}/tests/test_core.py +23 -26
  6. {tra_algorithm-1.0.3 → tra_algorithm-1.0.4}/tests/test_utils.py +3 -0
  7. {tra_algorithm-1.0.3 → tra_algorithm-1.0.4}/tra_algorithm/__init__.py +8 -6
  8. tra_algorithm-1.0.4/tra_algorithm/core.py +1585 -0
  9. {tra_algorithm-1.0.3 → tra_algorithm-1.0.4}/tra_algorithm/version.py +2 -1
  10. {tra_algorithm-1.0.3 → tra_algorithm-1.0.4/tra_algorithm.egg-info}/PKG-INFO +6 -6
  11. {tra_algorithm-1.0.3 → tra_algorithm-1.0.4}/tra_algorithm.egg-info/requires.txt +3 -3
  12. tra_algorithm-1.0.3/tra_algorithm/core.py +0 -1066
  13. {tra_algorithm-1.0.3 → tra_algorithm-1.0.4}/LICENSE +0 -0
  14. {tra_algorithm-1.0.3 → tra_algorithm-1.0.4}/MANIFEST.in +0 -0
  15. {tra_algorithm-1.0.3 → tra_algorithm-1.0.4}/README.md +0 -0
  16. {tra_algorithm-1.0.3 → tra_algorithm-1.0.4}/docs/README.md +0 -0
  17. {tra_algorithm-1.0.3 → tra_algorithm-1.0.4}/docs/examples/basic_usage.py +0 -0
  18. {tra_algorithm-1.0.3 → tra_algorithm-1.0.4}/requirements.txt +0 -0
  19. {tra_algorithm-1.0.3 → tra_algorithm-1.0.4}/setup.cfg +0 -0
  20. {tra_algorithm-1.0.3 → tra_algorithm-1.0.4}/tests/__init__.py +0 -0
  21. {tra_algorithm-1.0.3 → tra_algorithm-1.0.4}/tra_algorithm/examples.py +0 -0
  22. {tra_algorithm-1.0.3 → tra_algorithm-1.0.4}/tra_algorithm/utils.py +0 -0
  23. {tra_algorithm-1.0.3 → tra_algorithm-1.0.4}/tra_algorithm.egg-info/SOURCES.txt +0 -0
  24. {tra_algorithm-1.0.3 → tra_algorithm-1.0.4}/tra_algorithm.egg-info/dependency_links.txt +0 -0
  25. {tra_algorithm-1.0.3 → tra_algorithm-1.0.4}/tra_algorithm.egg-info/not-zip-safe +0 -0
  26. {tra_algorithm-1.0.3 → tra_algorithm-1.0.4}/tra_algorithm.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tra-algorithm
3
- Version: 1.0.3
3
+ Version: 1.0.4
4
4
  Summary: Track/Rail Algorithm (TRA) - A novel machine learning algorithm for dynamic model selection
5
5
  Home-page: https://github.com/eswaroy/tra_algorithm
6
6
  Author: Dasari Ranga Eswar
@@ -16,22 +16,22 @@ Classifier: Intended Audience :: Science/Research
16
16
  Classifier: License :: OSI Approved :: MIT License
17
17
  Classifier: Operating System :: OS Independent
18
18
  Classifier: Programming Language :: Python :: 3
19
- Classifier: Programming Language :: Python :: 3.7
20
19
  Classifier: Programming Language :: Python :: 3.8
21
20
  Classifier: Programming Language :: Python :: 3.9
22
21
  Classifier: Programming Language :: Python :: 3.10
23
22
  Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
24
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
25
25
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
26
- Requires-Python: >=3.7
26
+ Requires-Python: >=3.8
27
27
  Description-Content-Type: text/markdown
28
28
  License-File: LICENSE
29
- Requires-Dist: numpy>=1.19.0
30
- Requires-Dist: pandas>=1.1.0
29
+ Requires-Dist: numpy>=1.21.0
30
+ Requires-Dist: pandas>=1.3.0
31
31
  Requires-Dist: scikit-learn>=1.0.0
32
32
  Requires-Dist: matplotlib>=3.3.0
33
33
  Requires-Dist: joblib>=1.0.0
34
- Requires-Dist: networkx>=2.5
34
+ Requires-Dist: networkx>=2.6.0
35
35
  Provides-Extra: dev
36
36
  Requires-Dist: pytest>=6.0; extra == "dev"
37
37
  Requires-Dist: pytest-cov>=2.10; extra == "dev"
@@ -6,6 +6,26 @@ All notable changes to the TRA Algorithm package will be documented in this file
6
6
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
7
7
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
8
8
 
9
+ ## [1.0.4] - 2026-03-07
10
+
11
+ ### Added
12
+ - Stronger Router implementations (XGBoost, CatBoost, MLP, LightGBM)
13
+ - Heterogeneous Expert Tracks with specialized models
14
+ - Increased Number of Tracks (5-8+) for better specialization
15
+ - Load Balancing Loss for fair expert utilization
16
+ - Top-K Routing for selective expert usage
17
+ - Expert Capacity Control for improved memory efficiency
18
+ - Router Meta-Features for enhanced routing decisions
19
+ - Temperature-Scaled Soft Routing for better convergence
20
+ - Dynamic Track Creation capabilities
21
+ - Track Specialization via K-Means Clustering
22
+
23
+ ### Improved
24
+ - Algorithm performance significantly enhanced with mixture-of-experts approach
25
+ - Switch Transformer-inspired routing mechanism
26
+ - Signal-Guided Routing with structural signal extraction
27
+ - Memory optimization and computational efficiency
28
+
9
29
  ## [1.0.0] - 2024-12-XX
10
30
 
11
31
  ### Added
@@ -10,7 +10,7 @@ authors = [
10
10
  description = "Track/Rail Algorithm (TRA) - A novel machine learning algorithm for dynamic model selection"
11
11
  readme = "README.md"
12
12
  license = {text = "MIT"}
13
- requires-python = ">=3.7"
13
+ requires-python = ">=3.8"
14
14
  classifiers = [
15
15
  "Development Status :: 4 - Beta",
16
16
  "Intended Audience :: Developers",
@@ -18,21 +18,21 @@ classifiers = [
18
18
  "License :: OSI Approved :: MIT License",
19
19
  "Operating System :: OS Independent",
20
20
  "Programming Language :: Python :: 3",
21
- "Programming Language :: Python :: 3.7",
22
21
  "Programming Language :: Python :: 3.8",
23
22
  "Programming Language :: Python :: 3.9",
24
23
  "Programming Language :: Python :: 3.10",
25
24
  "Programming Language :: Python :: 3.11",
25
+ "Programming Language :: Python :: 3.12",
26
26
  "Topic :: Scientific/Engineering :: Artificial Intelligence",
27
27
  "Topic :: Software Development :: Libraries :: Python Modules",
28
28
  ]
29
29
  dependencies = [
30
- "numpy>=1.19.0",
31
- "pandas>=1.1.0",
30
+ "numpy>=1.21.0",
31
+ "pandas>=1.3.0",
32
32
  "scikit-learn>=1.0.0",
33
33
  "matplotlib>=3.3.0",
34
34
  "joblib>=1.0.0",
35
- "networkx>=2.5",
35
+ "networkx>=2.6.0",
36
36
  ]
37
37
  dynamic = ["version"]
38
38
 
@@ -28,22 +28,22 @@ setup(
28
28
  "License :: OSI Approved :: MIT License",
29
29
  "Operating System :: OS Independent",
30
30
  "Programming Language :: Python :: 3",
31
- "Programming Language :: Python :: 3.7",
32
31
  "Programming Language :: Python :: 3.8",
33
32
  "Programming Language :: Python :: 3.9",
34
33
  "Programming Language :: Python :: 3.10",
35
34
  "Programming Language :: Python :: 3.11",
35
+ "Programming Language :: Python :: 3.12",
36
36
  "Topic :: Scientific/Engineering :: Artificial Intelligence",
37
37
  "Topic :: Software Development :: Libraries :: Python Modules",
38
38
  ],
39
- python_requires=">=3.7",
39
+ python_requires=">=3.8",
40
40
  install_requires=[
41
- "numpy>=1.19.0",
42
- "pandas>=1.1.0",
41
+ "numpy>=1.21.0",
42
+ "pandas>=1.3.0",
43
43
  "scikit-learn>=1.0.0",
44
44
  "matplotlib>=3.3.0",
45
45
  "joblib>=1.0.0",
46
- "networkx>=2.5",
46
+ "networkx>=2.6.0",
47
47
  ],
48
48
  extras_require={
49
49
  "dev": [
@@ -5,6 +5,9 @@ import unittest
5
5
  import numpy as np
6
6
  from sklearn.datasets import make_classification, make_regression
7
7
  from sklearn.model_selection import train_test_split
8
+ import sys
9
+ import os
10
+ sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
8
11
 
9
12
  from tra_algorithm.core import OptimizedTRA
10
13
 
@@ -91,33 +94,27 @@ class TestOptimizedTRA(unittest.TestCase):
91
94
  # Test predictions work with feature selection
92
95
  y_pred = tra.predict(self.X_test_clf)
93
96
  self.assertEqual(len(y_pred), len(self.y_test_clf))
94
-
95
- def test_statistics_generation(self):
96
- """Test statistics generation."""
97
- tra = OptimizedTRA(task_type="classification", random_state=42)
98
- tra.fit(self.X_train_clf, self.y_train_clf)
99
- tra.predict(self.X_test_clf[:10]) # Make some predictions
100
-
101
- stats = tra.get_track_statistics()
102
-
103
- # Check required keys
104
- required_keys = ['n_tracks', 'n_signals', 'total_predictions', 'track_details']
105
- for key in required_keys:
106
- self.assertIn(key, stats)
107
97
 
108
- # Check track details
109
- self.assertGreater(stats['n_tracks'], 0)
110
- self.assertGreaterEqual(stats['total_predictions'], 0)
111
-
112
- def test_performance_report(self):
113
- """Test performance report generation."""
114
- tra = OptimizedTRA(task_type="classification", random_state=42)
115
- tra.fit(self.X_train_clf, self.y_train_clf)
116
-
117
- report = tra.get_performance_report()
118
- self.assertIsInstance(report, str)
119
- self.assertIn("PERFORMANCE REPORT", report)
120
- self.assertIn("TRACK PERFORMANCE DETAILS", report)
98
+ def test_routing_modes_classification(self):
99
+ """Test hard and soft routing modes for classification."""
100
+ for mode in ["hard", "soft"]:
101
+ tra = OptimizedTRA(task_type="classification", n_tracks=3, routing_mode=mode, random_state=42)
102
+ tra.fit(self.X_train_clf, self.y_train_clf)
103
+
104
+ y_pred = tra.predict(self.X_test_clf)
105
+ self.assertEqual(len(y_pred), len(self.y_test_clf))
106
+
107
+ y_proba = tra.predict_proba(self.X_test_clf)
108
+ self.assertEqual(y_proba.shape[0], len(self.y_test_clf))
109
+
110
+ def test_routing_modes_regression(self):
111
+ """Test hard and soft routing modes for regression."""
112
+ for mode in ["hard", "soft"]:
113
+ tra = OptimizedTRA(task_type="regression", n_tracks=3, routing_mode=mode, random_state=42)
114
+ tra.fit(self.X_train_reg, self.y_train_reg)
115
+
116
+ y_pred = tra.predict(self.X_test_reg)
117
+ self.assertEqual(len(y_pred), len(self.y_test_reg))
121
118
 
122
119
 
123
120
  class TestUtils(unittest.TestCase):
@@ -5,6 +5,9 @@ import unittest
5
5
  import numpy as np
6
6
  import tempfile
7
7
  import os
8
+ import sys
9
+
10
+ sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
8
11
 
9
12
  from tra_algorithm.core import OptimizedTRA
10
13
  from tra_algorithm.utils import validate_input, format_performance_metrics
@@ -52,10 +52,14 @@ from .version import __version__
52
52
  from .core import (
53
53
  OptimizedTRA,
54
54
  Track,
55
- Signal,
56
- Record,
57
- EnhancedSignalCondition
55
+ EnhancedTRA
58
56
  )
57
+
58
+ try:
59
+ from .core_enhanced import EnhancedTRA as EnhancedTRANew
60
+ except ImportError:
61
+ EnhancedTRANew = EnhancedTRA
62
+
59
63
  from .utils import (
60
64
  create_example_dataset,
61
65
  evaluate_model_performance,
@@ -71,10 +75,8 @@ from .examples import (
71
75
  __all__ = [
72
76
  # Main classes
73
77
  'OptimizedTRA',
78
+ 'EnhancedTRA', # Enhanced version with MoE improvements
74
79
  'Track',
75
- 'Signal',
76
- 'Record',
77
- 'EnhancedSignalCondition',
78
80
 
79
81
  # Utilities
80
82
  'create_example_dataset',