for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare (strict_types = 1);
namespace Phpml;
class Pipeline implements Estimator
{
/**
* @var array|Transformer[]
*/
private $transformers;
* @var Estimator
private $estimator;
* @param array|Transformer[] $transformers
* @param Estimator $estimator
public function __construct(array $transformers = [], Estimator $estimator)
foreach ($transformers as $transformer) {
$this->addTransformer($transformer);
}
$this->estimator = $estimator;
* @param Transformer $transformer
public function addTransformer(Transformer $transformer)
$this->transformers[] = $transformer;
public function setEstimator(Estimator $estimator)
* @return array|Transformer[]
public function getTransformers()
return $this->transformers;
* @return Estimator
public function getEstimator()
return $this->estimator;
* @param array $samples
* @param array $targets
public function train(array $samples, array $targets)
foreach ($this->transformers as $transformer) {
$transformer->transform($samples);
$this->estimator->train($samples, $targets);
*
* @return mixed
public function predict(array $samples)
return $this->estimator->predict($samples);