The Estimator interface is implemented by all learners in Rubix ML. It provides basic inference functionality through the predict() method which returns a set of predictions from a dataset. Additionally, it provides methods for returning estimator type and data type compatibility declarations.

Make Predictions#

Return the predictions from a dataset in an array:

public predict(Dataset $dataset) : array


$predictions = $estimator->predict($dataset);

array(3) {
  string(7) "married"
  string(8) "divorced"
  string(7) "married"

Note: The return value of predict() is an array containing the predictions in the same order that they were indexed in the dataset.

Estimator Type#

Return the integer-encoded estimator type:

public type() : int


use Rubix\ML\Estimator;

$type = $estimator->type();

var_dump($type); // Dump integer-encoded type

var_dump(Estimator::TYPE_STRINGS[$type]); // Dump human readable type

string(10) "classifier"

Data Type Compatibility#

Return the data types that this estimator is compatible with:

public compatibility() : array


$compatibility = $estimator->compatibility();