Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unrecognized options "0, 1, 2" under "datasource.ok" #26

Open
carbontwelve opened this issue Aug 15, 2016 · 1 comment
Open

Unrecognized options "0, 1, 2" under "datasource.ok" #26

carbontwelve opened this issue Aug 15, 2016 · 1 comment

Comments

@carbontwelve
Copy link

carbontwelve commented Aug 15, 2016

I get the error Unrecognized options "0, 1, 2" under "datasource.ok" when trying to initiate a new DataArray with the result of getData() being passed to its constructor.

$dataArr = new DataArray();
    $classifier = new ComplementNaiveBayes($dataArr);
    $items = [
        "hi my name is alex, what about you?" => 'ok',
        "are you hungy? what about some fries?" => 'ok',
        "how are you?" => 'ok',
        "buy viagra or dope" => 'spam',
        "viagra spam drugs sex" => 'spam',
        "buy drugs and have fun" => 'spam'
    ];

    foreach ($items as $text => $classification) {
        $dataArr->addDocument($classification, $text);
    }

    $classifier->setDataSource($dataArr);

    var_dump($classifier->classify('hi guy, how are you?')); //ok
    var_dump($classifier->classify('buy viagra?')); //spam
    var_dump($classifier->classify('bannana for scale')); //false

    $export = $dataArr->getData();
    var_dump($export); // error will happen here

I believe I am using this in the way it is intended, so I think this behavior is a bug.

@nimasdj
Copy link

nimasdj commented Aug 29, 2016

Shouldn't

$classifier = new ComplementNaiveBayes($dataArr);

be after foreach?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants