__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
declare(strict_types=1);
namespace Phpml;
use Phpml\Exception\InvalidOperationException;
class Pipeline implements Estimator, Transformer
{
/**
* @var Transformer[]
*/
private $transformers = [];
/**
* @var Estimator|null
*/
private $estimator;
/**
* @param Transformer[] $transformers
*/
public function __construct(array $transformers, ?Estimator $estimator = null)
{
$this->transformers = array_map(static function (Transformer $transformer): Transformer {
return $transformer;
}, $transformers);
$this->estimator = $estimator;
}
/**
* @return Transformer[]
*/
public function getTransformers(): array
{
return $this->transformers;
}
public function getEstimator(): ?Estimator
{
return $this->estimator;
}
public function train(array $samples, array $targets): void
{
if ($this->estimator === null) {
throw new InvalidOperationException('Pipeline without estimator can\'t use train method');
}
foreach ($this->transformers as $transformer) {
$transformer->fit($samples, $targets);
$transformer->transform($samples, $targets);
}
$this->estimator->train($samples, $targets);
}
/**
* @return mixed
*/
public function predict(array $samples)
{
$this->transform($samples);
if ($this->estimator === null) {
throw new InvalidOperationException('Pipeline without estimator can\'t use predict method');
}
return $this->estimator->predict($samples);
}
public function fit(array $samples, ?array $targets = null): void
{
foreach ($this->transformers as $transformer) {
$transformer->fit($samples, $targets);
$transformer->transform($samples, $targets);
}
}
public function transform(array &$samples, ?array &$targets = null): void
{
foreach ($this->transformers as $transformer) {
$transformer->transform($samples, $targets);
}
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| Association | Folder | 0777 |
|
|
| Classification | Folder | 0777 |
|
|
| Clustering | Folder | 0777 |
|
|
| CrossValidation | Folder | 0777 |
|
|
| Dataset | Folder | 0777 |
|
|
| DimensionReduction | Folder | 0777 |
|
|
| Exception | Folder | 0777 |
|
|
| FeatureExtraction | Folder | 0777 |
|
|
| FeatureSelection | Folder | 0777 |
|
|
| Helper | Folder | 0777 |
|
|
| Math | Folder | 0777 |
|
|
| Metric | Folder | 0777 |
|
|
| NeuralNetwork | Folder | 0777 |
|
|
| Preprocessing | Folder | 0777 |
|
|
| Regression | Folder | 0777 |
|
|
| SupportVectorMachine | Folder | 0777 |
|
|
| Tokenization | Folder | 0777 |
|
|
| Estimator.php | File | 223 B | 0777 |
|
| FeatureUnion.php | File | 2 KB | 0777 |
|
| IncrementalEstimator.php | File | 178 B | 0777 |
|
| ModelManager.php | File | 1.3 KB | 0777 |
|
| Pipeline.php | File | 2.1 KB | 0777 |
|
| Transformer.php | File | 356 B | 0777 |
|