PHP ML可以有多个标签值吗?

问题描述 投票:0回答:1

根据这里给出的例子。

https:/php-ml.readthedocs.ioenlatestmachinelearningdatasetsarray-dataset。

一个数据集可以有一个标签。我是一个全新的ML新手,正试图对每篇文章有多个类别的文章进行分类,那么是否可以做如下的事情?实际上是教给模型,文章可以有多个标签,或者这样会不会违背对象。

use Phpml\Dataset\ArrayDataset;

$dataset = new ArrayDataset([[1, 1], [2, 1], [3, 2], [4, 1]], [['a','b'],['a','c'],['b','d'],['b','e']]);

看来我不是唯一一个遇到这种情况的人--。https:/github.comphp-aiphp-mlissues423。

php machine-learning php-ml
1个回答
0
投票

通过项目代码,我看到了一个标签的使用。

$this->labels = array_map('strval', array_flip(array_flip($this->targets)));
    foreach ($this->labels as $label) {
        $samples = $this->getSamplesByLabel($label);
        $this->p[$label] = count($samples) / $this->sampleCount;
        $this->calculateStatistics($label, $samples);

还有其他函数,虽然我没有看到任何一个函数会采取和数组而不是字符串。

Github。https:/github.comphp-aiphp-ml

祝贺

© www.soinside.com 2019 - 2024. All rights reserved.