tensor-optix 2.0.9__tar.gz → 2.1.1__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 (171) hide show
  1. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/PKG-INFO +8 -4
  2. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/README.md +7 -3
  3. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/pyproject.toml +1 -1
  4. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/__init__.py +2 -0
  5. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/core/__init__.py +1 -0
  6. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/core/async_callback.py +22 -1
  7. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/core/backoff_scheduler.py +51 -6
  8. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/core/base_optimizer.py +10 -1
  9. tensor_optix-2.1.1/tensor_optix/core/convergence.py +862 -0
  10. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/core/loop_controller.py +179 -131
  11. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/ml_core/__init__.py +53 -53
  12. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/ml_core/base_model.py +39 -6
  13. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/ml_core/metrics.py +201 -201
  14. tensor_optix-2.1.1/tensor_optix/ml_core/trainer.py +343 -0
  15. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/multi_agent/__init__.py +6 -4
  16. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/multi_agent/multi_agent_runtime.py +122 -104
  17. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/neuroevo/controller/topology_controller.py +761 -747
  18. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/optimizer.py +14 -6
  19. tensor_optix-2.1.1/tensor_optix/runtime/observer.py +121 -0
  20. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix.egg-info/PKG-INFO +8 -4
  21. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix.egg-info/SOURCES.txt +1 -0
  22. tensor_optix-2.0.9/tensor_optix/ml_core/trainer.py +0 -240
  23. tensor_optix-2.0.9/tensor_optix/runtime/observer.py +0 -98
  24. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/setup.cfg +0 -0
  25. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/adapters/__init__.py +0 -0
  26. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/adapters/jax/__init__.py +0 -0
  27. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/adapters/jax/flax_agent.py +0 -0
  28. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/adapters/jax/flax_evaluator.py +0 -0
  29. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/adapters/pytorch/__init__.py +0 -0
  30. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/adapters/pytorch/torch_agent.py +0 -0
  31. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/adapters/pytorch/torch_evaluator.py +0 -0
  32. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/adapters/tensorflow/__init__.py +0 -0
  33. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/adapters/tensorflow/tf_agent.py +0 -0
  34. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/adapters/tensorflow/tf_evaluator.py +0 -0
  35. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/algorithms/__init__.py +0 -0
  36. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/algorithms/flax_ppo.py +0 -0
  37. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/algorithms/tf_dqn.py +0 -0
  38. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/algorithms/tf_ppo.py +0 -0
  39. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/algorithms/tf_ppo_continuous.py +0 -0
  40. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/algorithms/tf_sac.py +0 -0
  41. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/algorithms/tf_td3.py +0 -0
  42. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/algorithms/torch_dqn.py +0 -0
  43. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/algorithms/torch_ppo.py +0 -0
  44. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/algorithms/torch_ppo_continuous.py +0 -0
  45. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/algorithms/torch_rainbow_dqn.py +0 -0
  46. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/algorithms/torch_recurrent_ppo.py +0 -0
  47. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/algorithms/torch_sac.py +0 -0
  48. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/algorithms/torch_td3.py +0 -0
  49. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/callbacks/__init__.py +0 -0
  50. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/callbacks/rich_dashboard.py +0 -0
  51. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/callbacks/tensorboard_callback.py +0 -0
  52. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/callbacks/wandb_callback.py +0 -0
  53. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/cli.py +0 -0
  54. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/config.py +0 -0
  55. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/core/base_agent.py +0 -0
  56. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/core/base_evaluator.py +0 -0
  57. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/core/base_pipeline.py +0 -0
  58. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/core/checkpoint_confirmation.py +0 -0
  59. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/core/checkpoint_registry.py +0 -0
  60. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/core/device.py +0 -0
  61. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/core/diagnostic_controller.py +0 -0
  62. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/core/ensemble_agent.py +0 -0
  63. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/core/her_buffer.py +0 -0
  64. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/core/meta_controller.py +0 -0
  65. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/core/noisy_linear.py +0 -0
  66. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/core/normalizers.py +0 -0
  67. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/core/obs_utils.py +0 -0
  68. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/core/policy_manager.py +0 -0
  69. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/core/regime_detector.py +0 -0
  70. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/core/replay_buffer.py +0 -0
  71. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/core/resume_state.py +0 -0
  72. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/core/reward_shape.py +0 -0
  73. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/core/trajectory_buffer.py +0 -0
  74. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/core/types.py +0 -0
  75. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/distributed/__init__.py +0 -0
  76. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/distributed/async_learner.py +0 -0
  77. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/distributed/vtrace.py +0 -0
  78. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/encoders/__init__.py +0 -0
  79. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/encoders/obs_encoder.py +0 -0
  80. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/encoders/obs_encoder_tf.py +0 -0
  81. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/exploration/__init__.py +0 -0
  82. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/exploration/rnd.py +0 -0
  83. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/factory.py +0 -0
  84. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/ledger/__init__.py +0 -0
  85. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/ledger/callback.py +0 -0
  86. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/ledger/provenance.py +0 -0
  87. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/ledger/records.py +0 -0
  88. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/ledger/schema.py +0 -0
  89. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/ledger/store.py +0 -0
  90. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/ml/__init__.py +0 -0
  91. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/ml/dataset_pipeline.py +0 -0
  92. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/ml/loss_registry.py +0 -0
  93. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/ml/ml_agent.py +0 -0
  94. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/ml_core/adapters/__init__.py +0 -0
  95. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/ml_core/adapters/flax_model.py +0 -0
  96. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/ml_core/adapters/tf_model.py +0 -0
  97. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/ml_core/adapters/torch_model.py +0 -0
  98. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/ml_core/lr_schedules.py +0 -0
  99. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/ml_core/metrics_impl/__init__.py +0 -0
  100. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/ml_core/metrics_impl/classification.py +0 -0
  101. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/ml_core/metrics_impl/regression.py +0 -0
  102. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/ml_core/transfer.py +0 -0
  103. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/multi_agent/aec_pipeline.py +0 -0
  104. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/multi_agent/multi_agent_episode.py +0 -0
  105. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/multi_agent/parallel_pipeline.py +0 -0
  106. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/multi_agent/seat_env.py +0 -0
  107. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/multi_agent/self_play.py +0 -0
  108. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/nanonets/__init__.py +0 -0
  109. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/nanonets/abstention.py +0 -0
  110. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/nanonets/features.py +0 -0
  111. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/nanonets/pooling.py +0 -0
  112. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/nanonets/selector.py +0 -0
  113. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/nanonets/smalln.py +0 -0
  114. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/neuroevo/__init__.py +0 -0
  115. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/neuroevo/agent/__init__.py +0 -0
  116. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/neuroevo/agent/graph_agent.py +0 -0
  117. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/neuroevo/brain_network.py +0 -0
  118. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/neuroevo/controller/__init__.py +0 -0
  119. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/neuroevo/controller/topology_callback.py +0 -0
  120. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/neuroevo/graph/__init__.py +0 -0
  121. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/neuroevo/graph/neuron.py +0 -0
  122. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/neuroevo/graph/neuron_graph.py +0 -0
  123. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/neuroevo/graph/topology_ops.py +0 -0
  124. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/neuroevo/hebbian.py +0 -0
  125. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/neuroevo/neuromodulator.py +0 -0
  126. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/neuroevo/optimizer/__init__.py +0 -0
  127. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/neuroevo/optimizer/topology_aware_adam.py +0 -0
  128. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/optimizers/__init__.py +0 -0
  129. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/optimizers/adaptive_optimizer.py +0 -0
  130. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/optimizers/backoff_optimizer.py +0 -0
  131. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/optimizers/momentum_optimizer.py +0 -0
  132. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/optimizers/pbt_optimizer.py +0 -0
  133. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/optimizers/spsa_optimizer.py +0 -0
  134. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/orchestrator.py +0 -0
  135. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/pipeline/__init__.py +0 -0
  136. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/pipeline/batch_pipeline.py +0 -0
  137. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/pipeline/live_pipeline.py +0 -0
  138. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/pipeline/vector_pipeline.py +0 -0
  139. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/runtime/__init__.py +0 -0
  140. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/runtime/baseline.py +0 -0
  141. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/runtime/experiment_stage.py +0 -0
  142. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/runtime/live_runtime.py +0 -0
  143. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/runtime/promote.py +0 -0
  144. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/scheduler/__init__.py +0 -0
  145. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/scheduler/_mp_common.py +0 -0
  146. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/scheduler/budget.py +0 -0
  147. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/scheduler/dedup.py +0 -0
  148. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/scheduler/isolation.py +0 -0
  149. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/scheduler/pool.py +0 -0
  150. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/scheduler/retry.py +0 -0
  151. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/scheduler/worker.py +0 -0
  152. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/selection/__init__.py +0 -0
  153. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/selection/backfill.py +0 -0
  154. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/selection/selector.py +0 -0
  155. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/selection/uncertainty.py +0 -0
  156. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/simple.py +0 -0
  157. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/strategy/__init__.py +0 -0
  158. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/strategy/candidate.py +0 -0
  159. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/strategy/comparator.py +0 -0
  160. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/strategy/grammar.py +0 -0
  161. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/strategy/promotion.py +0 -0
  162. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/strategy/runner.py +0 -0
  163. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/strategy/worker.py +0 -0
  164. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/utils/__init__.py +0 -0
  165. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/utils/console.py +0 -0
  166. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix/utils/window_size.py +0 -0
  167. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix.egg-info/dependency_links.txt +0 -0
  168. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix.egg-info/entry_points.txt +0 -0
  169. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix.egg-info/requires.txt +0 -0
  170. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tensor_optix.egg-info/top_level.txt +0 -0
  171. {tensor_optix-2.0.9 → tensor_optix-2.1.1}/tests/test_ml.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tensor-optix
3
- Version: 2.0.9
3
+ Version: 2.1.1
4
4
  Summary: Autonomous training loop for any sequential learning model — PPO, DQN, SAC, TD3, Rainbow DQN, Recurrent PPO for TensorFlow, PyTorch, and JAX/Flax; distributed async actor-learner (IMPALA + V-trace)
5
5
  Author: sup3rus3r
6
6
  License-Expression: MIT
@@ -80,11 +80,11 @@ It has two parallel cores:
80
80
  - **RL core**. An episode-driven loop (`LoopController`/`RLOptimizer`) built around `BaseAgent`'s `act()`/`learn()` contract. Statistical convergence control, SPSA-based online hyperparameter tuning, and an optional neuroevolution subsystem for dynamic topology.
81
81
  - **ML core** (`tensor_optix.ml_core`). An epoch/batch-driven loop (`Trainer`, wrapped by `BaseMLModel.fit()`) built around a sklearn-style `fit()`/`predict()`/`evaluate()` contract. Real classification metrics (accuracy, precision/recall/F1, confusion matrix) and regression metrics (MAE, RMSE, R²), validation-based early stopping, and checkpointing on the best metric.
82
82
 
83
- Both cores reuse the same lower-level, algorithm-agnostic machinery: `CheckpointRegistry`, `BackoffScheduler`'s convergence/plateau detection, `SPSAOptimizer`. Each core has its own contract on top because an RL episode and a training epoch aren't the same shape. See [Concepts](https://sup3rus3r.github.io/tensor-optix/getting-started/concepts/).
83
+ Both cores reuse the same lower-level, algorithm-agnostic machinery: `CheckpointRegistry`, the `ConvergenceMonitor` convergence detector, `SPSAOptimizer`. Each core has its own contract on top because an RL episode and a training epoch aren't the same shape. See [Concepts](https://sup3rus3r.github.io/tensor-optix/getting-started/concepts/).
84
84
 
85
85
  ## RL core
86
86
 
87
- The RL loop runs your agent against a pipeline, maintains a separate validation signal, and manages four states: ACTIVE, COOLING, DORMANT, and watchdog shutdown. Convergence is detected via a linear trend fit over the recent score window compared against an adaptive, noise-scaled floor, not a fixed patience counter (see [Concepts](https://sup3rus3r.github.io/tensor-optix/getting-started/concepts/) for the exact math; `BackoffScheduler` is the implementation). Hyperparameters are updated every episode via SPSA gradient estimates, with automatic routing to momentum-based or sign-only updates depending on the autocorrelation structure of the score landscape (`AdaptiveOptimizer`). Checkpointing and rollback are driven by the validation signal only, never training score. On DORMANT, a MetaController evaluates the generalization gap and its slope to decide between spawning a policy variant, pruning the ensemble, or stopping.
87
+ The RL loop runs your agent against a pipeline, maintains a separate validation signal, and manages four states: ACTIVE, COOLING, DORMANT, and watchdog shutdown. Convergence is detected by a `ConvergenceMonitor` that reads short, medium and long score trends together against the run's own peak, with noise and autocorrelation estimated from the curve itself. Climbing back after a dip is reported as a regression, not as improvement, and a slow learner is never declared converged while its long-scale trend is still rising (see [Concepts](https://sup3rus3r.github.io/tensor-optix/getting-started/concepts/)). Hyperparameters are updated every episode via SPSA gradient estimates, with automatic routing to momentum-based or sign-only updates depending on the autocorrelation structure of the score landscape (`AdaptiveOptimizer`). Checkpointing and rollback are driven by the validation signal only, never training score. On DORMANT, a MetaController evaluates the generalization gap and its slope to decide between spawning a policy variant, pruning the ensemble, or stopping.
88
88
 
89
89
  The neuroevo subsystem (`pip install tensor-optix[neuroevo]`) represents the policy as a `NeuronGraph`: a mutable directed graph of heterogeneous scalar neurons (point, GRU, LSTM, trainable-GRU, trainable-LSTM) with variable-delay edges. Weights for excitatory and inhibitory neurons follow softplus Dale's Law: raw parameter θ maps to `softplus(θ)` (excitatory) or `-softplus(θ)` (inhibitory), eliminating gradient dead zones at weight boundaries. `TopologyController` runs as a loop callback and evaluates three independent signals per episode: improvement slope significance, residual autocorrelation structure, and gradient utilization across hidden neurons. All three must cross their thresholds before a grow operation fires. Pruning is by importance score (incident edge weight magnitude times mean absolute activation). Merging is by Pearson correlation of per-episode activation histories. After every structural mutation the controller calls `graph.invalidate_compile()` to reset for the new topology. `TopologyAwareAdam` resets momentum state for parameters affected by any structural change. `BrainNetwork` composes multiple named `NeuronGraph` regions with sparse learnable inter-region edges. When a neuron is pruned from a region, all inter-region edges referencing it are automatically cleaned up. `HebbianHook` accumulates co-activation products across each episode and applies an Oja-style weight update after the PPO gradient step. `NeuromodulatorSignal` maps a `RegimeDetector` output (trending / ranging / volatile) to simultaneous changes in Hebbian learning rate, entropy coefficient, and topology grow/prune thresholds.
90
90
 
@@ -130,6 +130,10 @@ history = model.fit(
130
130
  epochs=50, early_stopping_patience=5, checkpoint_dir="./checkpoints",
131
131
  )
132
132
  print(history.val_metrics[-1].metrics) # {'accuracy': 0.94, 'f1_macro': 0.93, ...}
133
+
134
+ # or give no epochs and let tensor-optix decide when to stop:
135
+ history = model.fit((X_train, y_train), (X_val, y_val))
136
+ print(history.stop_reason) # "converged"
133
137
  ```
134
138
 
135
139
  Metrics are auto-detected from the target dtype. Integer/class-index targets get classification metrics (accuracy, per-class and macro precision/recall/F1, confusion matrix). Float targets get regression metrics (MAE, RMSE, R²). Pass `metrics="classification"`, `metrics="regression"`, or a list of custom `(y_true, y_pred) -> float` callables to override. `TorchMLModel`, `TFMLModel`, and `FlaxMLModel` are provided. The Torch and TF adapters accept a raw `(X, y)` array pair or a native `Dataset`/`DataLoader`/`tf.data.Dataset`; the Flax adapter accepts a raw `(X, y)` array pair only. `fit()` also takes `lr_schedule=` (see `tensor_optix.ml_core.lr_schedules`), `augment=` for per-batch data augmentation, and there are `freeze_layers()`/`unfreeze_layers()`/`load_pretrained_backbone()` helpers for transfer learning. See [Train an ML model](https://sup3rus3r.github.io/tensor-optix/guides/ml-core/) for the full guide.
@@ -327,7 +331,7 @@ opt = RLOptimizer(
327
331
  checkpoint_score_fn=lambda a: evaluate(a, held_out_env),
328
332
 
329
333
  # Convergence parameters
330
- dormant_threshold=10, # consecutive episodes without improvement -> DORMANT
334
+ dormant_threshold=100, # episodes without new ground -> DORMANT (default 160)
331
335
  min_episodes_before_dormant=50, # statistical warmup before convergence detection activates
332
336
  )
333
337
 
@@ -9,11 +9,11 @@ It has two parallel cores:
9
9
  - **RL core**. An episode-driven loop (`LoopController`/`RLOptimizer`) built around `BaseAgent`'s `act()`/`learn()` contract. Statistical convergence control, SPSA-based online hyperparameter tuning, and an optional neuroevolution subsystem for dynamic topology.
10
10
  - **ML core** (`tensor_optix.ml_core`). An epoch/batch-driven loop (`Trainer`, wrapped by `BaseMLModel.fit()`) built around a sklearn-style `fit()`/`predict()`/`evaluate()` contract. Real classification metrics (accuracy, precision/recall/F1, confusion matrix) and regression metrics (MAE, RMSE, R²), validation-based early stopping, and checkpointing on the best metric.
11
11
 
12
- Both cores reuse the same lower-level, algorithm-agnostic machinery: `CheckpointRegistry`, `BackoffScheduler`'s convergence/plateau detection, `SPSAOptimizer`. Each core has its own contract on top because an RL episode and a training epoch aren't the same shape. See [Concepts](https://sup3rus3r.github.io/tensor-optix/getting-started/concepts/).
12
+ Both cores reuse the same lower-level, algorithm-agnostic machinery: `CheckpointRegistry`, the `ConvergenceMonitor` convergence detector, `SPSAOptimizer`. Each core has its own contract on top because an RL episode and a training epoch aren't the same shape. See [Concepts](https://sup3rus3r.github.io/tensor-optix/getting-started/concepts/).
13
13
 
14
14
  ## RL core
15
15
 
16
- The RL loop runs your agent against a pipeline, maintains a separate validation signal, and manages four states: ACTIVE, COOLING, DORMANT, and watchdog shutdown. Convergence is detected via a linear trend fit over the recent score window compared against an adaptive, noise-scaled floor, not a fixed patience counter (see [Concepts](https://sup3rus3r.github.io/tensor-optix/getting-started/concepts/) for the exact math; `BackoffScheduler` is the implementation). Hyperparameters are updated every episode via SPSA gradient estimates, with automatic routing to momentum-based or sign-only updates depending on the autocorrelation structure of the score landscape (`AdaptiveOptimizer`). Checkpointing and rollback are driven by the validation signal only, never training score. On DORMANT, a MetaController evaluates the generalization gap and its slope to decide between spawning a policy variant, pruning the ensemble, or stopping.
16
+ The RL loop runs your agent against a pipeline, maintains a separate validation signal, and manages four states: ACTIVE, COOLING, DORMANT, and watchdog shutdown. Convergence is detected by a `ConvergenceMonitor` that reads short, medium and long score trends together against the run's own peak, with noise and autocorrelation estimated from the curve itself. Climbing back after a dip is reported as a regression, not as improvement, and a slow learner is never declared converged while its long-scale trend is still rising (see [Concepts](https://sup3rus3r.github.io/tensor-optix/getting-started/concepts/)). Hyperparameters are updated every episode via SPSA gradient estimates, with automatic routing to momentum-based or sign-only updates depending on the autocorrelation structure of the score landscape (`AdaptiveOptimizer`). Checkpointing and rollback are driven by the validation signal only, never training score. On DORMANT, a MetaController evaluates the generalization gap and its slope to decide between spawning a policy variant, pruning the ensemble, or stopping.
17
17
 
18
18
  The neuroevo subsystem (`pip install tensor-optix[neuroevo]`) represents the policy as a `NeuronGraph`: a mutable directed graph of heterogeneous scalar neurons (point, GRU, LSTM, trainable-GRU, trainable-LSTM) with variable-delay edges. Weights for excitatory and inhibitory neurons follow softplus Dale's Law: raw parameter θ maps to `softplus(θ)` (excitatory) or `-softplus(θ)` (inhibitory), eliminating gradient dead zones at weight boundaries. `TopologyController` runs as a loop callback and evaluates three independent signals per episode: improvement slope significance, residual autocorrelation structure, and gradient utilization across hidden neurons. All three must cross their thresholds before a grow operation fires. Pruning is by importance score (incident edge weight magnitude times mean absolute activation). Merging is by Pearson correlation of per-episode activation histories. After every structural mutation the controller calls `graph.invalidate_compile()` to reset for the new topology. `TopologyAwareAdam` resets momentum state for parameters affected by any structural change. `BrainNetwork` composes multiple named `NeuronGraph` regions with sparse learnable inter-region edges. When a neuron is pruned from a region, all inter-region edges referencing it are automatically cleaned up. `HebbianHook` accumulates co-activation products across each episode and applies an Oja-style weight update after the PPO gradient step. `NeuromodulatorSignal` maps a `RegimeDetector` output (trending / ranging / volatile) to simultaneous changes in Hebbian learning rate, entropy coefficient, and topology grow/prune thresholds.
19
19
 
@@ -59,6 +59,10 @@ history = model.fit(
59
59
  epochs=50, early_stopping_patience=5, checkpoint_dir="./checkpoints",
60
60
  )
61
61
  print(history.val_metrics[-1].metrics) # {'accuracy': 0.94, 'f1_macro': 0.93, ...}
62
+
63
+ # or give no epochs and let tensor-optix decide when to stop:
64
+ history = model.fit((X_train, y_train), (X_val, y_val))
65
+ print(history.stop_reason) # "converged"
62
66
  ```
63
67
 
64
68
  Metrics are auto-detected from the target dtype. Integer/class-index targets get classification metrics (accuracy, per-class and macro precision/recall/F1, confusion matrix). Float targets get regression metrics (MAE, RMSE, R²). Pass `metrics="classification"`, `metrics="regression"`, or a list of custom `(y_true, y_pred) -> float` callables to override. `TorchMLModel`, `TFMLModel`, and `FlaxMLModel` are provided. The Torch and TF adapters accept a raw `(X, y)` array pair or a native `Dataset`/`DataLoader`/`tf.data.Dataset`; the Flax adapter accepts a raw `(X, y)` array pair only. `fit()` also takes `lr_schedule=` (see `tensor_optix.ml_core.lr_schedules`), `augment=` for per-batch data augmentation, and there are `freeze_layers()`/`unfreeze_layers()`/`load_pretrained_backbone()` helpers for transfer learning. See [Train an ML model](https://sup3rus3r.github.io/tensor-optix/guides/ml-core/) for the full guide.
@@ -256,7 +260,7 @@ opt = RLOptimizer(
256
260
  checkpoint_score_fn=lambda a: evaluate(a, held_out_env),
257
261
 
258
262
  # Convergence parameters
259
- dormant_threshold=10, # consecutive episodes without improvement -> DORMANT
263
+ dormant_threshold=100, # episodes without new ground -> DORMANT (default 160)
260
264
  min_episodes_before_dormant=50, # statistical warmup before convergence detection activates
261
265
  )
262
266
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "tensor-optix"
7
- version = "2.0.9"
7
+ version = "2.1.1"
8
8
  description = "Autonomous training loop for any sequential learning model — PPO, DQN, SAC, TD3, Rainbow DQN, Recurrent PPO for TensorFlow, PyTorch, and JAX/Flax; distributed async actor-learner (IMPALA + V-trace)"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -11,6 +11,7 @@ from .core.base_evaluator import BaseEvaluator
11
11
  from .core.base_optimizer import BaseOptimizer
12
12
  from .core.base_pipeline import BasePipeline
13
13
  from .core.loop_controller import LoopCallback
14
+ from .core.convergence import ConvergenceMonitor, ConvergenceRegime, ConvergenceReport
14
15
  from .core.policy_manager import PolicyManager, PolicyManagerCallback
15
16
  from .core.ensemble_agent import EnsembleAgent
16
17
  from .core.regime_detector import RegimeDetector
@@ -28,6 +29,7 @@ __all__ = [
28
29
  "EpisodeData", "EvalMetrics", "HyperparamSet", "PolicySnapshot", "LoopState",
29
30
  "BaseAgent", "BaseEvaluator", "BaseOptimizer", "BasePipeline",
30
31
  "LoopCallback",
32
+ "ConvergenceMonitor", "ConvergenceRegime", "ConvergenceReport",
31
33
  "PolicyManager", "PolicyManagerCallback", "EnsembleAgent",
32
34
  "RegimeDetector", "MetaController", "MetaAction",
33
35
  "BatchPipeline", "LivePipeline",
@@ -6,6 +6,7 @@ from .base_pipeline import BasePipeline
6
6
  from .loop_controller import LoopController, LoopCallback
7
7
  from .checkpoint_registry import CheckpointRegistry
8
8
  from .backoff_scheduler import BackoffScheduler
9
+ from .convergence import ConvergenceMonitor, ConvergenceRegime, ConvergenceReport, ScaleReading
9
10
  from .policy_manager import PolicyManager, PolicyManagerCallback
10
11
  from .ensemble_agent import EnsembleAgent
11
12
  from .regime_detector import RegimeDetector
@@ -61,12 +61,16 @@ class AsyncCallbackAdapter(LoopCallback):
61
61
  except queue.Empty:
62
62
  continue
63
63
  try:
64
- getattr(self._inner, event)(*args)
64
+ fn = getattr(self._inner, event, None)
65
+ if fn is not None:
66
+ fn(*args)
65
67
  except Exception as e:
66
68
  logger.warning(
67
69
  "AsyncCallbackAdapter: inner callback %s raised during %s: %s",
68
70
  self._inner, event, e,
69
71
  )
72
+ finally:
73
+ self._queue.task_done()
70
74
 
71
75
  def _enqueue(self, event: str, *args) -> None:
72
76
  try:
@@ -77,6 +81,7 @@ class AsyncCallbackAdapter(LoopCallback):
77
81
  # Drop the oldest pending event to make room for this one.
78
82
  try:
79
83
  self._queue.get_nowait()
84
+ self._queue.task_done()
80
85
  with self._lock:
81
86
  self._dropped_count += 1
82
87
  except queue.Empty:
@@ -108,6 +113,22 @@ class AsyncCallbackAdapter(LoopCallback):
108
113
  def on_degradation(self, episode_id, eval_metrics) -> None:
109
114
  self._enqueue("on_degradation", episode_id, eval_metrics)
110
115
 
116
+ def on_convergence(self, episode_id, report) -> None:
117
+ self._enqueue("on_convergence", episode_id, report)
118
+
119
+ def consume_dormant_resume(self) -> bool:
120
+ """
121
+ Synchronous pass-through: the loop needs the answer immediately after
122
+ on_dormant, so a wrapped PolicyManagerCallback can still resume it.
123
+ on_dormant is delivered first so the inner callback has decided.
124
+ """
125
+ fn = getattr(self._inner, "consume_dormant_resume", None)
126
+ if not callable(fn):
127
+ return False
128
+ if not self._stop.is_set():
129
+ self._queue.join() # wait until on_dormant has run on the worker
130
+ return bool(fn())
131
+
111
132
  def on_hyperparam_update(self, old_params, new_params) -> None:
112
133
  self._enqueue("on_hyperparam_update", old_params, new_params)
113
134
 
@@ -1,11 +1,25 @@
1
1
  from collections import deque
2
+ from typing import Optional
2
3
  import numpy as np
3
4
  from .types import LoopState
4
5
 
5
6
 
6
7
  class BackoffScheduler:
7
8
  """
8
- Controls adaptation interval and state transitions.
9
+ Controls the evaluation / adaptation interval.
10
+
11
+ Since the convergence redesign, ``LoopController`` uses this class only
12
+ for its *cadence* (``should_adapt`` / ``advance_interval``): when the
13
+ costly steps (validation pipeline, ``optimizer.suggest``) run. Convergence
14
+ detection and the ACTIVE / COOLING / DORMANT state live in
15
+ ``tensor_optix.core.convergence.ConvergenceMonitor``.
16
+
17
+ The trend / state-machine methods below are kept for standalone use and
18
+ backward compatibility. ``plateau_threshold`` and ``dormant_threshold``,
19
+ when given explicitly, become the monitor's cooling / dormant patience
20
+ (in episodes) for the loop that owns this scheduler.
21
+
22
+ Legacy behaviour of the standalone state machine:
9
23
 
10
24
  Improvement and degradation are detected via **linear trend** over the
11
25
  recent score window, not point-to-point comparison.
@@ -37,8 +51,8 @@ class BackoffScheduler:
37
51
  base_interval: int = 1,
38
52
  backoff_factor: float = 2.0,
39
53
  max_interval_episodes: int = 100,
40
- plateau_threshold: int = 5,
41
- dormant_threshold: int = 20,
54
+ plateau_threshold: Optional[int] = None,
55
+ dormant_threshold: Optional[int] = None,
42
56
  degradation_threshold: float = 0.95,
43
57
  min_degradation_drop: float = 1e-4,
44
58
  min_episodes_before_dormant: int = 0,
@@ -63,8 +77,14 @@ class BackoffScheduler:
63
77
  self._base_interval = base_interval
64
78
  self._backoff_factor = backoff_factor
65
79
  self._max_interval = max_interval_episodes
66
- self._plateau_threshold = plateau_threshold
67
- self._dormant_threshold = dormant_threshold
80
+ # None = "not set by the caller": the standalone state machine uses the
81
+ # historical 5 / 20, and an owning LoopController uses the monitor's
82
+ # own defaults instead of these.
83
+ self.explicit_plateau_threshold = plateau_threshold
84
+ self.explicit_dormant_threshold = dormant_threshold
85
+ self._plateau_threshold = 5 if plateau_threshold is None else int(plateau_threshold)
86
+ self._dormant_threshold = 20 if dormant_threshold is None else int(dormant_threshold)
87
+ self._monitor = None
68
88
  self._degradation_threshold = degradation_threshold
69
89
  self._min_degradation_drop = min_degradation_drop
70
90
  self._min_episodes_before_dormant = min_episodes_before_dormant
@@ -247,12 +267,33 @@ class BackoffScheduler:
247
267
  self._current_interval = self._base_interval
248
268
  self._state = LoopState.ACTIVE
249
269
 
270
+ def attach_monitor(self, monitor) -> None:
271
+ """
272
+ Link the ConvergenceMonitor that a LoopController built from this
273
+ scheduler, so code that still resets the scheduler directly (e.g.
274
+ TopologyController after a topology change) also restarts the
275
+ monitor that actually drives convergence.
276
+ """
277
+ self._monitor = monitor
278
+
279
+ def advance_interval(self, improved: bool) -> None:
280
+ """Cadence only: reset to base on progress, back off otherwise."""
281
+ if improved:
282
+ self._current_interval = self._base_interval
283
+ else:
284
+ self._current_interval = min(
285
+ max(1, int(self._current_interval * self._backoff_factor)),
286
+ self._max_interval,
287
+ )
288
+
250
289
  def record_restart(self) -> None:
251
290
  """
252
291
  Called after DORMANT fires and PolicyManager has acted.
253
292
  Gives the new policy variant a clean slate.
254
293
  Does NOT reset best_score — the new variant must beat the existing best.
255
294
  """
295
+ if self._monitor is not None:
296
+ self._monitor.restart()
256
297
  self._consecutive_non_improvements = 0
257
298
  self._current_interval = self._base_interval
258
299
  self._state = LoopState.ACTIVE
@@ -265,6 +306,9 @@ class BackoffScheduler:
265
306
 
266
307
  def is_converged(self, cv_threshold: float = 0.05, gap_threshold: float = 0.20) -> bool:
267
308
  """
309
+ Deprecated: no loop calls this. Use ConvergenceMonitor's report
310
+ (``regime == PLATEAU`` with ``state == DORMANT``) instead.
311
+
268
312
  True when the policy has genuinely converged:
269
313
  flat trend AND low CV AND performing near its personal best.
270
314
 
@@ -302,7 +346,8 @@ class BackoffScheduler:
302
346
 
303
347
  def check_degradation(self, score: float) -> bool:
304
348
  """
305
- Threshold-based degradation check called by loop_controller.
349
+ Threshold-based degradation check (standalone use; loops use
350
+ ConvergenceMonitor's collapse detection).
306
351
 
307
352
  Returns True when `score` has dropped significantly below the best
308
353
  known score (by more than (1 - degradation_threshold) × |best|).
@@ -42,7 +42,16 @@ class BaseOptimizer(ABC):
42
42
  """Called when a new best score is achieved. Override to react."""
43
43
 
44
44
  def on_plateau(self, metrics_history: List[EvalMetrics]) -> None:
45
- """Called when a plateau is detected. Override to react."""
45
+ """Called when the run goes DORMANT (converged or stuck). Override to react."""
46
+
47
+ def on_cooling(self, metrics_history: List[EvalMetrics]) -> None:
48
+ """
49
+ Called once when the run enters COOLING: no new ground for the cooling
50
+ patience, but not yet given up on. This is the moment to change
51
+ something -- by default, the same reaction as a plateau (widen the
52
+ search), early enough that the wider search actually gets to run.
53
+ """
54
+ self.on_plateau(metrics_history)
46
55
 
47
56
  @property
48
57
  def is_probing(self) -> bool: