Conditions | 1 |
Paths | 1 |
Total Lines | 23 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
19 | public function train($data) |
||
20 | { |
||
21 | |||
22 | $hypothesis = new Linear(); |
||
23 | $normalization = new MeanScaleNormalization(); |
||
24 | $algorithm = new GradientDescendent($hypothesis); |
||
25 | $dataset = new Dataset($data, $hypothesis); |
||
26 | |||
27 | $normalizationCoefficient = $normalization->calculateCoefficient($dataset); |
||
28 | $dataset = $normalization->normalizeDataset($dataset, $normalizationCoefficient); |
||
29 | |||
30 | $algorithmCoefficient = $algorithm->train($dataset); |
||
31 | |||
32 | return new Training( |
||
33 | $data, |
||
34 | $algorithm, |
||
35 | $algorithmCoefficient, |
||
36 | $normalization, |
||
37 | $normalizationCoefficient, |
||
38 | $hypothesis |
||
39 | ); |
||
40 | |||
41 | } |
||
42 | } |