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
47
48
49
50
51
52
//! `matten-mlprep` — small, transparent, deterministic preprocessing helpers for
//! [`matten::Tensor`].
//!
//! This companion crate (RFC-024, RFC-028) prepares numeric tensors for use with
//! external tools. It is **not** an ML framework: there is no model training, no
//! autograd, no optimizer, and no hidden randomness. Every function is a pure,
//! deterministic transform you can reason about. It depends only on core
//! `matten` (no default features) — no `ndarray`, no `candle`, no `rand`.
//!
//! # Convention
//!
//! All functions operate on **rank-2** tensors with `rows = samples` and
//! `columns = features`. A non-2D tensor is rejected; there is no silent
//! transposition.
//!
//! # Functions
//!
//! - [`standardize_columns`] — per-column z-score (population std).
//! - [`minmax_scale_columns`] — per-column scaling to `[0, 1]`.
//! - [`add_bias_column`] — prepend a constant `1.0` intercept column.
//! - [`train_test_split`] — ordered, deterministic row split.
//!
//! ```
//! use matten::Tensor;
//! use matten_mlprep::{add_bias_column, standardize_columns, train_test_split};
//!
//! let x = Tensor::new(vec![1.0, 3.0, 5.0, 7.0], &[4, 1]);
//! let z = standardize_columns(&x).unwrap(); // zero mean, unit std
//! let z = add_bias_column(&z).unwrap(); // [4, 2], column 0 = 1.0
//! let (train, test) = train_test_split(&z, 0.75).unwrap();
//! assert_eq!(train.shape(), &[3, 2]);
//! assert_eq!(test.shape(), &[1, 2]);
//! ```
//!
//! # Status
//!
//! **Experimental (0.1.x).** The API may change. Constant (zero-variance)
//! columns are rejected explicitly by the scalers rather than silently producing
//! a zero column — see [`MattenMlprepError::ZeroVariance`].
pub use crateadd_bias_column;
pub use crateMattenMlprepError;
pub use crate;
pub use cratetrain_test_split;