2016-04-16 19:24:40 +00:00
|
|
|
<?php
|
2016-04-16 19:41:37 +00:00
|
|
|
|
2016-11-20 21:53:17 +00:00
|
|
|
declare(strict_types=1);
|
2016-04-16 19:24:40 +00:00
|
|
|
|
2016-05-07 21:04:58 +00:00
|
|
|
namespace Phpml\Helper;
|
2016-04-16 19:24:40 +00:00
|
|
|
|
|
|
|
trait Trainable
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var array
|
|
|
|
*/
|
2017-02-01 18:06:38 +00:00
|
|
|
private $samples = [];
|
2016-04-16 19:24:40 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @var array
|
|
|
|
*/
|
2017-02-01 18:06:38 +00:00
|
|
|
private $targets = [];
|
2016-04-16 19:24:40 +00:00
|
|
|
|
2017-11-14 20:21:23 +00:00
|
|
|
public function train(array $samples, array $targets): void
|
2016-04-16 19:24:40 +00:00
|
|
|
{
|
2017-02-01 18:06:38 +00:00
|
|
|
$this->samples = array_merge($this->samples, $samples);
|
|
|
|
$this->targets = array_merge($this->targets, $targets);
|
2016-04-16 19:24:40 +00:00
|
|
|
}
|
|
|
|
}
|