public function filterByColumn(int $index, callable $fn) : self
    {
        $samples = $labels = [];

        foreach ($this->samples as $i => $sample) {
            if ($fn($sample[$index])) {
                $samples[] = $sample;
                $labels[] = $this->labels[$i];
            }
        }

        return self::quick($samples, $labels);
    }
public function filterByColumn(int $index, callable $fn) : self
    {
        $samples = $labels = [];

        foreach ($this->samples as $i => $sample) {
            if ($fn($sample[$index])) {
                $samples[] = $sample;
                $labels[] = $this->labels[$i];
            }
        }

        return self::quick($samples, $labels);
    }
public function filterByColumn ( int $ index , callable $ fn ) : self { $ samples = $ labels = [ ] ; foreach ( $ this -> samples as $ i => $ sample ) { if ( $ fn ( $ sample [ $ index ] ) ) { $ samples [ ] = $ sample ; $ labels [ ] = $ this -> labels [ $ i ] ; } } return self :: quick ( $ samples , $ labels ) ; }
Run a filter over the dataset using the values of a given column.

@param int $index
@param callable $fn
@return self
Run a filter over the dataset using the values of a given column .