Skip to content

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

Open

Description

@carbontwelve

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.

Activity

  1. nimasdj commented on Aug 29, 2016

    @nimasdj

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions