1# Validator 2Validators take an instance of a [Learner](../learner.md), a [Labeled](../datasets/labeled.md) dataset object, and a validation [Metric](metrics/api.md) and return a validation score that measures the generalization performance of the model using one of various cross validation techniques. 3 4!!! note 5 There is no need to train the learner beforehand. The validator will automatically train the learner on subsets of the dataset created by the testing algorithm. 6 7### Test a Learner 8To train and test a Learner on a dataset and return the validation score: 9```php 10public test(Learner $estimator, Labeled $dataset, Metric $metric) : float 11``` 12 13```php 14use Rubix\ML\CrossValidation\KFold; 15use Rubix\ML\CrossValidation\Metrics\Accuracy; 16 17$validator = new KFold(10); 18 19$score = $validator->test($estimator, $dataset, new Accuracy()); 20 21var_dump($score); 22``` 23 24```sh 25float(0.869) 26```