php-ml/src/Phpml/Helper/Trainable.php

29 lines
474 B
PHP
Raw Normal View History

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
*/
private $samples = [];
2016-04-16 19:24:40 +00:00
/**
* @var array
*/
private $targets = [];
2016-04-16 19:24:40 +00:00
/**
* @param array $samples
2016-06-16 07:58:12 +00:00
* @param array $targets
2016-04-16 19:24:40 +00:00
*/
2016-06-16 07:58:12 +00:00
public function train(array $samples, array $targets)
2016-04-16 19:24:40 +00:00
{
$this->samples = array_merge($this->samples, $samples);
$this->targets = array_merge($this->targets, $targets);
2016-04-16 19:24:40 +00:00
}
}