44
55use App \Application \Analytics \PowerCorrelationAnalyzer ;
66use App \Application \ML \PowerStationDatasetSplitter ;
7+ use App \Application \ML \PowerStationReport ;
8+ use App \Application \ML \PowerStationTester ;
9+ use App \Application \ML \PowerStationTrainer ;
710use App \Domain \PowerStation ;
811use App \Infrastructure \Reader \PowerStationDatasetReader ;
912use App \Infrastructure \Writer \PowerStationValidDataWriter ;
@@ -26,6 +29,9 @@ public function __construct(
2629 private readonly ValidatorInterface $ validator ,
2730 private readonly PowerStationValidDataWriter $ powerStationValidDataWriter ,
2831 private readonly PowerStationDatasetSplitter $ powerStationDatasetSplitter ,
32+ private readonly PowerStationTrainer $ powerStationTrainer ,
33+ private readonly PowerStationTester $ powerStationTester ,
34+ private readonly PowerStationReport $ powerStationReport ,
2935 ) {
3036 parent ::__construct ();
3137 }
@@ -85,6 +91,16 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8591 $ io ->info ('Splitting the data into training and test sets... ' );
8692 $ this ->powerStationDatasetSplitter ->split ();
8793
94+ $ io ->info ('Training the model... ' );
95+ $ this ->powerStationTrainer ->train ();
96+
97+ $ io ->info ('Testing the model... ' );
98+ $ score = $ this ->powerStationTester ->test ();
99+ $ io ->success (sprintf ('MeanSquaredError: %f ' , abs ($ score )));
100+
101+ $ io ->info ('Generating model report... ' );
102+ dump ($ this ->powerStationReport ->generateReport ());
103+
88104 $ io ->success ('OK ' );
89105
90106 return Command::SUCCESS ;
0 commit comments