1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//! An interoceptive trading agent: a Q-network whose market encoder is steered
//! by a small model of the account's own "body" rather than fed it as input.
//!
//! The usual trading agent concatenates account state onto the market features
//! and lets the network sort it out. This one keeps two circuits apart:
//!
//! - an exteroceptive [`MarketTrunk`] that only ever sees prices and volume,
//! - an interoceptive [`InteroceptiveCore`] that tracks four physiological
//! signals ([`AccountBody`]) and acts on the trunk from outside: it gates the
//! trunk's hidden units, biases the action values toward de-risking, and cools
//! the exploration temperature as drawdown accelerates.
//!
//! The reward is drive reduction ([`homeostatic_reward`]): moving the body back
//! toward its setpoints pays, a little PnL pays, and liquidation costs a
//! terminal penalty.
//!
//! [`Trainer`] ties it together: a pool of [`MarketEnvironment`]s stepped in
//! parallel with rayon, a flat [`ReplayBuffer`], and DQN updates on
//! [`InteroceptiveAgent::train_step`].
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use Shock;
pub use ;
pub use ;
pub use MarketTrunk;
/// The spec's name for a batch of rows. Every tensor here is a row-major
/// [`Matrix`](crate::matrix::Matrix): one row per sample.
pub type Tensor = crateMatrix;