Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

114
Visualizações
how to generate classification report using javascript

I'm using ml5 for a classification problem and I'm applying KNN classifier. How do I get the accuracy and the classification report of the model?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Notice the documentation mentions this about classify()'s output:

Object: It returns an object with a top classIndex and label, confidences mapping all class indices to their confidence, and confidencesByLabel mapping all classes' confidence by label.

Bellow there are examples as well, such as the ml5/p5/KNNClassification_Video example.

If you print the result in gotResults() you'll see something like this:

{
    "classIndex": 2,
    "label": "Scissor",
    "confidences": {
        "0": 0.3333333333333333,
        "1": 0,
        "2": 0.6666666666666666
    },
    "confidencesByLabel": {
        "Rock": 0.3333333333333333,
        "Paper": 0,
        "Scissor": 0.6666666666666666
    }
}
  • classIndex will be the index of the top class
  • label is the string associated with that class
  • confidences returns object where the key is the class index and the value is the confidence (as a normalised value (e.g. 0.0 = 0%, 0.5 = 50%, 1.0 = 100%, etc.)
  • confidencesByLabel provides the same confidence values as above, but instead of the class indices the keys are the class labels.

In short, once you call classify(), in the result handler, you're after result.confidences or result.confidencesByLabel depending on your application.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda