Rasa_NLU_Chi icon indicating copy to clipboard operation
Rasa_NLU_Chi copied to clipboard

NLU训练完,意图识别不对

Open HCIS2020 opened this issue 7 years ago • 5 comments

Rasa NLU version (e.g. 0.7.3): '0.10.5'

Used backend / pipeline (mitie, spacy_sklearn, ...): { "name": "rasa_nlu_test", "pipeline": ["nlp_mitie", "tokenizer_jieba", "ner_mitie", "ner_synonyms", "intent_entity_featurizer_regex", "intent_featurizer_mitie", "intent_classifier_sklearn"], "language": "zh", "mitie_file": "../data/total_word_feature_extractor_zh.dat", "path" : "../models", "data" : "../data/nlu.md" }

Operating system (windows, osx, ...): WINDOWS 10 x64 + Python 3.6 Issue:

Building prefix dict from the default dictionary ... Loading model from cache C:\Users\Benny\AppData\Local\Temp\jieba.cache Loading model cost 1.053 seconds. Prefix dict has been built succesfully. Fitting 2 folds for each of 6 candidates, totalling 12 fits C:\Users\Benny\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\metrics\classification.py:1135: UndefinedMetricWarning: F-score is ill-defined and being set to 0.0 in labels with no predicted samples. 'precision', 'predicted', average, warn_for) C:\Users\Benny\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\metrics\classification.py:1135: UndefinedMetricWarning: F-score is ill-defined and being set to 0.0 in labels with no predicted samples. 'precision', 'predicted', average, warn_for) C:\Users\Benny\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\metrics\classification.py:1135: UndefinedMetricWarning: F-score is ill-defined and being set to 0.0 in labels with no predicted samples. 'precision', 'predicted', average, warn_for) C:\Users\Benny\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\metrics\classification.py:1135: UndefinedMetricWarning: F-score is ill-defined and being set to 0.0 in labels with no predicted samples. 'precision', 'predicted', average, warn_for) C:\Users\Benny\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\metrics\classification.py:1135: UndefinedMetricWarning: F-score is ill-defined and being set to 0.0 in labels with no predicted samples. 'precision', 'predicted', average, warn_for) C:\Users\Benny\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\metrics\classification.py:1135: UndefinedMetricWarning: F-score is ill-defined and being set to 0.0 in labels with no predicted samples. 'precision', 'predicted', average, warn_for) C:\Users\Benny\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\metrics\classification.py:1135: UndefinedMetricWarning: F-score is ill-defined and being set to 0.0 in labels with no predicted samples. 'precision', 'predicted', average, warn_for) C:\Users\Benny\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\metrics\classification.py:1135: UndefinedMetricWarning: F-score is ill-defined and being set to 0.0 in labels with no predicted samples. 'precision', 'predicted', average, warn_for) C:\Users\Benny\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\metrics\classification.py:1135: UndefinedMetricWarning: F-score is ill-defined and being set to 0.0 in labels with no predicted samples. 'precision', 'predicted', average, warn_for) C:\Users\Benny\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\metrics\classification.py:1135: UndefinedMetricWarning: F-score is ill-defined and being set to 0.0 in labels with no predicted samples. 'precision', 'predicted', average, warn_for) C:\Users\Benny\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\metrics\classification.py:1135: UndefinedMetricWarning: F-score is ill-defined and being set to 0.0 in labels with no predicted samples. 'precision', 'predicted', average, warn_for) C:\Users\Benny\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\metrics\classification.py:1135: UndefinedMetricWarning: F-score is ill-defined and being set to 0.0 in labels with no predicted samples. 'precision', 'predicted', average, warn_for) [Parallel(n_jobs=1)]: Done 12 out of 12 | elapsed: 0.0s finished

Content of configuration file (if used & relevant):

intent:greet

  • hey
  • hello
  • hi
  • 在吗?
  • 早上好
  • 晚上好

intent:goodbye

  • bye
  • 再见
  • 一天好心情
  • 再会
  • 拜拜

intent:mood_affirm

  • yes
  • 是的
  • 当然
  • 听起来不错
  • 正确

intent:mood_deny

  • no
  • 不好
  • 我不觉得
  • 不喜欢那样
  • 没办法

intent:mood_great

  • 棒极了
  • 我感觉很好
  • 非常好
  • 太好了

intent:mood_unhappy

  • 很糟糕
  • 很伤心
  • 心情不好
  • 我很失望

意图识别情况:

interpreter = Interpreter.load(model_dir, config) intent_entities = interpreter.parse('没办法')

Building prefix dict from the default dictionary ... Loading model from cache C:\Users\Benny\AppData\Local\Temp\jieba.cache Loading model cost 0.873 seconds. Prefix dict has been built succesfully. {'intent': {'name': 'mood_affirm', 'confidence': 0.22176080230671813}, 'entities': [], 'intent_ranking': [{'name': 'mood_affirm', 'confidence': 0.22176080230671813}, {'name': 'greet', 'confidence': 0.21021923238681889}, {'name': 'goodbye', 'confidence': 0.1875789668700675}, {'name': 'mood_unhappy', 'confidence': 0.13687120608411668}, {'name': 'mood_deny', 'confidence': 0.13181582565934799}, {'name': 'mood_great', 'confidence': 0.11175396669293076}], 'text': '没办法'}

应该识别出的意图为:mood_deny

但是识别出来的为: mood_affirm

问题可能出在哪里?

HCIS2020 avatar Jan 03 '18 05:01 HCIS2020

每种类别的训练数据太少了。

crownpku avatar Jan 03 '18 06:01 crownpku

谢谢,确实是训练数据太少。每个类别增加到12个样本,就正常了。

还有关于Storied.md的设计,是否有可视化的对话流程工具来生成。 使用RASA官网的mood的例子,storied.md比较简单,很容易就进入Action_listen的状态,会话就无法进行下去了。

HCIS2020 avatar Jan 03 '18 07:01 HCIS2020

@HCIS2020 请问怎么把configuration file (.md)文件生成demo-rasa_zh.json的呢?谢谢~~

floating-cloud avatar Feb 06 '18 03:02 floating-cloud

@floating-cloud \rasa_nlu\utils\md_to_json.py 这个工具是来进行MD和JSON转换的, 实际调用是在Agent的Training_data里面,

HCIS2020 avatar Feb 06 '18 06:02 HCIS2020

@HCIS2020 太感谢了~~

floating-cloud avatar Feb 06 '18 07:02 floating-cloud