oa/data/type.gen.rs
1// @generated by tool/gen/fn/generate.py; DO NOT EDIT.
2// schema=data_types.json schema_version=1 generator_version=64
3// schema_sha256=c517613ec4b60e2e8234555780ae52416fba23b4542efdb8f76731ab4585269d
4use crate::Matrix;
5/// Configuration for [`DataLoader`](crate::data::DataLoader).
6#[derive(Clone, Copy, Debug)]
7pub struct DataLoaderConfig {
8 /// Number of samples per batch.
9 pub batch_size: i32,
10 /// Whether to shuffle indices before each epoch.
11 pub shuffle: bool,
12 /// Seed for shuffling. `0` derives a seed from the system clock, as in the donor.
13 pub seed: u64,
14 /// Drop the last incomplete batch when `true`.
15 pub drop_last: bool,
16}
17
18impl Default for DataLoaderConfig {
19 fn default() -> Self {
20 Self {
21 batch_size: 32,
22 shuffle: true,
23 seed: 0,
24 drop_last: false,
25 }
26 }
27}
28
29/// Result of a train / validation / test split.
30pub struct SplitResult {
31 /// Training indices.
32 pub train: Vec<i64>,
33 /// Validation indices.
34 pub val: Vec<i64>,
35 /// Test indices.
36 pub test: Vec<i64>,
37}
38
39/// Window shape; targets are the immediately following future close prices.
40#[derive(Clone, Copy, Debug)]
41pub struct OhlcvWindowConfig {
42 /// Number of history candles per input.
43 pub lookback: usize,
44 /// Number of future closes per label.
45 pub horizon: usize,
46 /// Advance between consecutive window starts.
47 pub stride: usize,
48}
49
50/// Batched output: `x` [B, …] and optional `y` [B, …]. Corresponds to `oa::DataLoader::Batch`.
51pub struct Batch {
52 /// Batched input matrix with a leading batch dimension.
53 pub x: Matrix,
54 /// Batched label matrix with a leading batch dimension, or `None`.
55 pub y: Option<Matrix>,
56}