trainer = $trainer; $this->store = $store; $this->dataLoader = $dataLoader; } /** * @param Config $config * @param TrainingDataConfig $dataConfig * @param AClassificationStrategy $strategy * * @return Model * * @throws InsufficientDataException * @throws ServiceException */ public function train(Config $config, TrainingDataConfig $dataConfig, AClassificationStrategy $strategy): Model { // Load $collectedData = $this->dataLoader->loadTrainingAndValidationData( $dataConfig, $strategy ); $data = $this->dataLoader->generateRandomShuffledData( $collectedData, $config, $strategy ); // Train $result = $this->trainer->train( $config, $data, $strategy ); // Persist $this->store->persist( $result->getClassifier(), $result->getModel() ); return $result->getModel(); } }