@param array $labels

@return array
488327
protected function getValidationLabelsForElements(array $labels = [])
    {
        $this->getElements()->onlyActive()->each(function ($element) use (&$labels) {
            $element = $this->getElementContainer($element);

            if ($element instanceof Validable) {
                $labels += $element->getValidationLabels();
            }
        });

        return $labels;
    }
292654
public function compileFrom($labels)
    {
        // first we will check whether we need
        // to reformat the labels from an array
        if (is_array($labels))
        {
            $labels = $this->prepareLabels($labels);
        }

        // every label must begin with a ':' so we need to check
        // and reformat if need be.
        $labels = ':' . preg_replace('/^:/', '', $labels);

        // now we add the default placeholder for this node
        $labels = $this->modelAsNode() . $labels;

        return sprintf("MATCH (%s)", $labels);
    }
1306729
private function getSamplesByLabel(string $label): array
    {
        $samples = [];
        for ($i = 0; $i < $this->sampleCount; ++$i) {
            if ($this->targets[$i] == $label) {
                $samples[] = $this->samples[$i];
            }
        }

        return $samples;
    }
1258186
public function getSingleNodeByLabel($label)
    {
        foreach ($this->nodes as $node) {
            if ($node->hasLabel($label)) {
                return $node;
            }
        }

        return;
    }
907128
public function generate(array $predictions, array $labels) : array
    {
        if (count($predictions) !== count($labels)) {
            throw new InvalidArgumentException('The number of labels'
                . ' must equal the number of predictions.');
        }

        $muHat = Stats::mean($labels);

        $errors = $l1 = $l2 = [];

        $sse = $sst = 0.;

        foreach ($predictions as $i => $prediction) {
            $label = $labels[$i];

            $errors[] = $error = $label - $prediction;

            $l1[] = abs($error);
            $l2[] = $t = $error ** 2;

            $sse += $t;
            $sst += ($label - $muHat) ** 2;
        }

        [$mean, $variance] = Stats::meanVar($errors);

        $mse = Stats::mean($l2);

        $r2 = 1. - ($sse / ($sst ?: EPSILON));

        return [
            'mean_absolute_error' => Stats::mean($l1),
            'median_absolute_error' => Stats::median($l1),
            'mean_squared_error' => $mse,
            'rms_error' => sqrt($mse),
            'mean_squared_log_error' => log($mse),
            'r_squared' => $r2,
            'error_mean' => $mean,
            'error_variance' => $variance,
            'error_skewness' => Stats::skewness($errors, $mean),
            'error_kurtosis' => Stats::kurtosis($errors, $mean),
            'error_min' => min($errors),
            'error_max' => max($errors),
            'cardinality' => count($predictions),
        ];
    }
490398
public function setLabelMany($labels, $many)
    {
        $labels->name = __($many);
        $labels->view_items = __('View ' . $many);
        $labels->search_items = __('Search ' . $many);
        $labels->not_found = __('No ' . strtolower($many) . ' Found');
        $labels->not_found_in_trash = __('No ' . strtolower($many) . ' found in Trash');
        $labels->all_items = __('All ' . $many);
        $labels->filter_items_list = __('Filter ' . $many . ' list');
        $labels->items_list_navigation = __($many . ' list navigation');
        $labels->items_list = __($many . ' list');
        $labels->menu_name = __($many);
        return $labels;
    }
671800
public function modelAsNode(array $labels = null)
    {
        $labels = ( ! is_null($labels)) ? $labels : $this->from;

        return $this->grammar->modelAsNode($labels);
    }
1090647
public static function createFromLabels(iterable $labels): self
    {
        $hostLabels = [];
        foreach ($labels as $label) {
            $label = self::filterComponent($label);
            if (null === $label) {
                throw new TypeError('a label can not be null');
            }
            $hostLabels[] = $label;
        }

        return new self(implode(self::SEPARATOR, array_reverse($hostLabels)));
    }
1185620
public function label($label)
    {
        if ($label === false) {
            $this->parts['{label}'] = '';
        } else {
            $this->parts['{label}'] = $label;
        }
        
        return $this;
    }
361976
public function listIndexes(array $labels = array(), $conn = null)
    {
        if (empty($labels)) {
            $labels = $this->getLabels($conn)->getBody();
        }
        $indexes = [];
        foreach ($labels as $label) {
            $res = $this->listIndex($label, $conn);
            $indexs = $res->getBody();
            $indexes[$label] = $indexs;
        }

        if (!isset($res)){
            if ($this->newFormatModeEnabled) {
                $res = new \GraphAware\NeoClient\Formatter\Response(new PsrResponse(200));
            } else {
                $res = new Response(new PsrResponse(200));
            }
        }

        if ($res instanceof \GraphAware\NeoClient\Formatter\Response) {
            return new \GraphAware\NeoClient\Formatter\Response(new PsrResponse(200, [], json_encode($indexes)));
        }

        $response = new Response($res->getRaw());
        $response->setBody($indexes);

        return $response;
    }
27986
public function generate(array $predictions, array $labels) : array
    {
        $n = count($predictions);

        if ($n !== count($labels)) {
            throw new InvalidArgumentException('The number of labels'
                . ' must equal the number of predictions.');
        }

        $classes = array_unique(array_merge($predictions, $labels));

        $k = count($classes);

        $truePos = $trueNeg = $falsePos = $falseNeg = array_fill_keys($classes, 0);

        foreach ($predictions as $i => $prediction) {
            $label = $labels[$i];

            if ($prediction === $label) {
                $truePos[$prediction]++;
                
                foreach ($classes as $class) {
                    if ($class !== $prediction) {
                        $trueNeg[$class]++;
                    }
                }
            } else {
                $falsePos[$prediction]++;
                $falseNeg[$label]++;
            }
        }

        $averages = array_fill_keys([
            'accuracy', 'precision', 'recall', 'specificity', 'negative_predictive_value',
            'false_discovery_rate', 'miss_rate', 'fall_out', 'false_omission_rate',
            'f1_score', 'mcc', 'informedness', 'markedness',
        ], 0.);

        $counts = array_fill_keys([
            'true_positives', 'true_negatives', 'false_positives', 'false_negatives',
        ], 0);

        $overall = array_replace($averages, $counts);

        $table = [];

        foreach ($truePos as $label => $tp) {
            $tn = $trueNeg[$label];
            $fp = $falsePos[$label];
            $fn = $falseNeg[$label];

            $accuracy = ($tp + $tn) / ($tp + $tn + $fp + $fn);
            $precision = $tp / (($tp + $fp) ?: EPSILON);
            $recall = $tp / (($tp + $fn) ?: EPSILON);
            $specificity = $tn / (($tn + $fp) ?: EPSILON);
            $npv = $tn / (($tn + $fn) ?: EPSILON);
            $cardinality = $tp + $fn;

            $f1score = 2. * (($precision * $recall))
                / (($precision + $recall) ?: EPSILON);

            $mcc = ($tp * $tn - $fp * $fn)
                / sqrt((($tp + $fp) * ($tp + $fn)
                * ($tn + $fp) * ($tn + $fn)) ?: EPSILON);

            $metrics = [];

            $metrics['accuracy'] = $accuracy;
            $metrics['precision'] = $precision;
            $metrics['recall'] = $recall;
            $metrics['specificity'] = $specificity;
            $metrics['negative_predictive_value'] = $npv;
            $metrics['false_discovery_rate'] = 1. - $precision;
            $metrics['miss_rate'] = 1. - $recall;
            $metrics['fall_out'] = 1. - $specificity;
            $metrics['false_omission_rate'] = 1. - $npv;
            $metrics['f1_score'] = $f1score;
            $metrics['mcc'] = $mcc;
            $metrics['informedness'] = $recall + $specificity - 1.;
            $metrics['markedness'] = $precision + $npv - 1.;
            $metrics['true_positives'] = $tp;
            $metrics['true_negatives'] = $tn;
            $metrics['false_positives'] = $fp;
            $metrics['false_negatives'] = $fn;
            $metrics['cardinality'] = $cardinality;
            $metrics['density'] = $cardinality / $n;

            $table[$label] = $metrics;

            $overall['accuracy'] += $accuracy;
            $overall['precision'] += $precision;
            $overall['recall'] += $recall;
            $overall['specificity'] += $specificity;
            $overall['negative_predictive_value'] += $npv;
            $overall['false_discovery_rate'] += 1. - $precision;
            $overall['miss_rate'] += 1. - $recall;
            $overall['fall_out'] += 1. - $specificity;
            $overall['false_omission_rate'] += 1. - $npv;
            $overall['f1_score'] += $f1score;
            $overall['mcc'] += $mcc;
            $overall['informedness'] += $recall + $specificity - 1.;
            $overall['markedness'] += $precision + $npv - 1.;
            $overall['true_positives'] += $tp;
            $overall['true_negatives'] += $tn;
            $overall['false_positives'] += $fp;
            $overall['false_negatives'] += $fn;
        }

        foreach (array_keys($averages) as $metric) {
            $overall[$metric] /= $k;
        }

        $overall['cardinality'] = $n;

        return [
            'overall' => $overall,
            'label' => $table,
        ];
    }
16006
public function set_labels( $labels ) {
		$this->merge( $this->labels, $labels );
		$this->update_arg( 'labels', $this->labels );
	}
611038
public function getOptionIds(Attribute $attribute, $labels)
    {
        $optionIds = [];

        if (!is_array($labels)) {
            $labels = [$labels];
        }

        $options = $attribute->getSource()->getAllOptions();

        foreach ($labels as $label) {
            foreach ($options as $option) {
                if ($option['label'] == $label) {
                    $optionIds[] = (int) $option['value'];
                }
            }
        }

        return $optionIds;
    }
319896
public function updateFieldLabels(&$labels)
    {
        $labels['Style'] = _t(__CLASS__ . '.STYLE', 'Style');
        $labels['Options'] = _t(__CLASS__ . '.OPTIONS', 'Options');
        $labels['Enabled'] = _t(__CLASS__ . '.ENABLED', 'Enabled');
        $labels['Disabled'] = _t(__CLASS__ . '.DISABLED', 'Disabled');
        $labels['ListView'] = _t(__CLASS__ . '.LISTVIEW', 'List View');
        $labels['ListImages'] = _t(__CLASS__ . '.LISTIMAGES', 'List Images');
        $labels['ListTitle'] = _t(__CLASS__ . '.TITLE', 'List title');
        $labels['ShowImage'] = _t(__CLASS__ . '.SHOWIMAGE', 'Show image');
        $labels['ShowHeader'] = _t(__CLASS__ . '.SHOWHEADER', 'Show header');
        $labels['ShowDetails'] = _t(__CLASS__ . '.SHOWDETAILS', 'Show details');
        $labels['ShowSummary'] = _t(__CLASS__ . '.SHOWSUMMARY', 'Show summary');
        $labels['ShowContent'] = _t(__CLASS__ . '.SHOWCONTENT', 'Show content');
        $labels['ShowFooter'] = _t(__CLASS__ . '.SHOWFOOTER', 'Show footer');
        $labels['LinkTitles'] = _t(__CLASS__ . '.LINKTITLES', 'Link titles');
        $labels['LinkImages'] = _t(__CLASS__ . '.LINKIMAGES', 'Link images');
        $labels['ButtonIcon'] = _t(__CLASS__ . '.BUTTONLABEL', 'Button icon');
        $labels['ButtonLabel'] = _t(__CLASS__ . '.BUTTONLABEL', 'Button label');
        $labels['HeadingLevel'] = _t(__CLASS__ . '.HEADINGLEVEL', 'Heading level');
        $labels['ItemsPerPage'] = _t(__CLASS__ . '.ITEMSPERPAGE', 'Items per page');
        $labels['PaginateItems'] = _t(__CLASS__ . '.PAGINATEITEMS', 'Paginate items');
        $labels['ImageLinksTo'] = _t(__CLASS__ . '.IMAGELINKSTO', 'Image links to');
        $labels['ImageResize'] = _t(__CLASS__ . '.IMAGEDIMENSIONS', 'Image dimensions');
        $labels['ImageResizeMethod'] = _t(__CLASS__ . '.IMAGERESIZEMETHOD', 'Image resize method');
        $labels['ImageAlignment'] = _t(__CLASS__ . '.IMAGEALIGNMENT', 'Image alignment');
        $labels['TextAlignment'] = _t(__CLASS__ . '.TEXTALIGNMENT', 'Text alignment');
        $labels['OverlayImages'] = _t(__CLASS__ . '.OVERLAYIMAGES', 'Overlay images');
        $labels['OverlayTitle'] = _t(__CLASS__ . '.SHOWTITLEINOVERLAY', 'Show title in overlay');
        $labels['OverlayIcon'] = _t(__CLASS__ . '.OVERLAYICON', 'Overlay icon');
        $labels['OverlayIconColor'] = _t(__CLASS__ . '.OVERLAYICONCOLOR', 'Overlay icon color');
        $labels['OverlayBackground'] = _t(__CLASS__ . '.OVERLAYBACKGROUNDCOLOR', 'Overlay background color');
        $labels['OverlayForeground'] = _t(__CLASS__ . '.OVERLAYFOREGROUNDCOLOR', 'Overlay foreground color');
        $labels['NumberOfItems'] = _t(__CLASS__ . '.NUMBEROFITEMS', 'Number of items');
        $labels['ReverseItems'] = _t(__CLASS__ . '.REVERSEITEMS', 'Reverse items');
        $labels['ImageItems'] = _t(__CLASS__ . '.IMAGEITEMS', 'Show only items with images');
        $labels['ListClass'] = _t(__CLASS__ . '.LISTCLASS', 'List class');
        $labels['ListInherit'] = _t(__CLASS__ . '.INHERITFROMPARENT', 'Inherit from parent');
        $labels['ListInheritance'] = _t(__CLASS__ . '.LISTINHERITANCE', 'List Inheritance');
        $labels['HideNoDataMessage'] = _t(__CLASS__ . '.HIDENODATAMESSAGE', 'Hide "no data" message');
        $labels['HideListTitle'] = _t(__CLASS__ . '.HIDETITLE', 'Hide list title');
    }
410279
public function setLabels(array $labels): PostTypeInterface
    {
        if (isset($this->args['labels'])) {
            $this->args['labels'] = array_merge($this->args['labels'], $labels);
        } else {
            $this->args['labels'] = $labels;
        }

        return $this;
    }
536666
private function packValues(array $entities): array
    {
        $result = [];
        foreach ($entities as $entity) {
            $result[] = $entity->packValue();
        }

        return $result;
    }
865168
public function reset($data = [], $labels = [])
    {
        $this->_attributes = $data;
        $this->_labels = $labels;
        $this->_errors = [];
        $this->_validations = [];
        return $this;
    }