pub fn train_test_split<D: Dimension + RemoveAxis, D2: Dimension + RemoveAxis, Feature: Clone, Label: Clone>(
arr: &Array<Feature, D>,
y: &Array<Label, D2>,
test_size: f64,
) -> TrainTestSplitResult<Feature, Label, D, D2>Expand description
Split data and features into training and testing set. test_size must be between 0 and 1.
ยงPanics
Panics if test_size is outside range 0..=1.
Example:
use rs_ml::{train_test_split, TrainTestSplitResult};
use ndarray::{arr1, arr2};
let features = arr2(&[
[1., 0.],
[0., 1.],
[0., 0.],
[1., 1.]]);
let labels = arr1(&[1, 1, 0, 0]);
let TrainTestSplitResult(train_features, test_features, train_labels, test_labels) = train_test_split(&features,
&labels, 0.25);