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

get score from 1 and not less #1359

Open
baeckerman83 opened this issue Oct 20, 2023 · 0 comments
Open

get score from 1 and not less #1359

baeckerman83 opened this issue Oct 20, 2023 · 0 comments

Comments

@baeckerman83
Copy link

Describe the bug
I tried the example described in the documentation https://github.com/axa-group/nlp.js/#example-of-use
Instead of Score 0.698219120207268 I get Score 1.

To Reproduce
Steps to reproduce the behavior:

  1. Install nlp
  2. Create file with content described under https://github.com/axa-group/nlp.js/#example-of-use
  3. Check the output and check the score.

Expected behavior
I expected a ouput:
classifications: [ { label: 'greetings.bye', value: 0.698219120207268 },

but get

classifications: [ { intent: 'greetings.bye', score: 1 } ],

Screenshots

S C:\Users\a1213145\GIT\Test> node .\chatbot.js
Epoch 1 loss 0.4629286907733636 time 1ms
Epoch 2 loss 0.2818764774939686 time 0ms
Epoch 3 loss 0.16872372018062168 time 0ms
Epoch 4 loss 0.11241683507408215 time 0ms
Epoch 5 loss 0.07923798076215939 time 0ms
Epoch 6 loss 0.05638416761283621 time 0ms
Epoch 7 loss 0.03998057331564159 time 0ms
Epoch 8 loss 0.02825681983016534 time 1ms
Epoch 9 loss 0.019950959163979966 time 0ms
Epoch 10 loss 0.014106024680969281 time 0ms
Epoch 11 loss 0.010088216494190255 time 0ms
Epoch 12 loss 0.007212295188102869 time 0ms
Epoch 13 loss 0.005159443933542246 time 0ms
Epoch 14 loss 0.0036982799839208364 time 0ms
Epoch 15 loss 0.002660258046190502 time 0ms
Epoch 16 loss 0.0019232747541338417 time 0ms
Epoch 17 loss 0.0013995561287073988 time 0ms
Epoch 18 loss 0.001026481308841803 time 0ms
Epoch 19 loss 0.0007596689041286639 time 0ms
Epoch 20 loss 0.0005678299532577515 time 0ms
Epoch 21 loss 0.00042898561899483965 time 0ms
Epoch 22 loss 0.00032772140573957426 time 0ms
Epoch 23 loss 0.00025322533840006496 time 0ms
Epoch 24 loss 0.00019790109645147517 time 0ms
Epoch 25 loss 0.0001563949586972024 time 0ms
Epoch 26 loss 0.0001249206412263351 time 0ms
Epoch 27 loss 0.00010078756339291031 time 0ms
Epoch 28 loss 0.0000820742590642674 time 0ms
Epoch 29 loss 0.00006740078698731653 time 0ms
Epoch 30 loss 0.00005576914401345666 time 0ms
Epoch 31 loss 0.00004645272306535786 time 0ms
{
  locale: 'en',
  utterance: 'I should go now',
  settings: undefined,
  languageGuessed: false,
  localeIso2: 'en',
  language: 'English',
  nluAnswer: {
    classifications: [ { intent: 'greetings.bye', score: 1 } ],
    entities: undefined,
    explanation: undefined
  },
  classifications: [ { intent: 'greetings.bye', score: 1 } ],
  intent: 'greetings.bye',
  score: 1,
  domain: 'default',
  sourceEntities: [
    {
      start: 12,
      end: 14,
and so on

Desktop (please complete the following information):

  • OS debian and windows
  • Package version 4.27.0
  • Node version v16.14.0

Additional context
Script

const { NlpManager } = require('node-nlp');

const manager = new NlpManager({ languages: ['en'], forceNER: true });
// Adds the utterances and intents for the NLP
manager.addDocument('en', 'goodbye for now', 'greetings.bye');
manager.addDocument('en', 'bye bye take care', 'greetings.bye');
manager.addDocument('en', 'okay see you later', 'greetings.bye');
manager.addDocument('en', 'bye for now', 'greetings.bye');
manager.addDocument('en', 'i must go', 'greetings.bye');
manager.addDocument('en', 'hello', 'greetings.hello');
manager.addDocument('en', 'hi', 'greetings.hello');
manager.addDocument('en', 'howdy', 'greetings.hello');

// Train also the NLG
manager.addAnswer('en', 'greetings.bye', 'Till next time');
manager.addAnswer('en', 'greetings.bye', 'see you soon!');
manager.addAnswer('en', 'greetings.hello', 'Hey there!');
manager.addAnswer('en', 'greetings.hello', 'Greetings!');

// Train and save the model.
(async() => {
    await manager.train();
    manager.save();
    const response = await manager.process('en', 'I should go now');
    //console.log(response);
    console.dir(response, { depth: null });
})();
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

1 participant