public static function split(Labeled $dataset) : self
    {
        $columns = $dataset->columns();

        $variances = array_map([Stats::class, 'variance'], $columns);

        $column = argmax($variances);

        $value = Stats::median($columns[$column]);

        $groups = $dataset->partition($column, $value);

        $min = $max = [];

        foreach ($columns as $values) {
            $min[] = min($values);
            $max[] = max($values);
        }

        return new self($column, $value, $groups, $min, $max);
    }
public static function split(Labeled $dataset) : self
    {
        $columns = $dataset->columns();

        $variances = array_map([Stats::class, 'variance'], $columns);

        $column = argmax($variances);

        $value = Stats::median($columns[$column]);

        $groups = $dataset->partition($column, $value);

        $min = $max = [];

        foreach ($columns as $values) {
            $min[] = min($values);
            $max[] = max($values);
        }

        return new self($column, $value, $groups, $min, $max);
    }
public static function split ( Labeled $ dataset ) : self { $ columns = $ dataset -> columns ( ) ; $ variances = array_map ( [ Stats :: class , 'variance' ] , $ columns ) ; $ column = argmax ( $ variances ) ; $ value = Stats :: median ( $ columns [ $ column ] ) ; $ groups = $ dataset -> partition ( $ column , $ value ) ; $ min = $ max = [ ] ; foreach ( $ columns as $ values ) { $ min [ ] = min ( $ values ) ; $ max [ ] = max ( $ values ) ; } return new self ( $ column , $ value , $ groups , $ min , $ max ) ; }
Factory method to build a coordinate node from a labeled dataset
using the column with the highest variance as the column for the
split.

@param \Rubix\ML\Datasets\Labeled $dataset
@return self
Factory method to build a coordinate node from a labeled dataset using the column with the highest variance as the column for the split .