2016-06-13 60 views
0

NLC分類當我嘗試創建NLC的一個新的分類,在此基礎上文檔: http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/natural-language-classifier/api/v1/?node#create_classifier創建於bluemix

我不能創建一個新的分類。這是錯誤:

{ code: 400, error: undefined }

我不應該收到那種錯誤。

CSV文件非常小,僅供測試。

也許我做錯了什麼。但是,錯誤:「未定義」不說什麼......


這是代碼(同爲文檔)

var params = { 
      language: 'es', 
      name: "Train_NODE", 
      training_data: fs.createReadStream('./public/uploads/'+req.files.file.name) 
     }; 
     natural_language_classifier.create(params, function(err, response) { 
      if (err){ 
       console.log(err); 
       res.status(500).render('./APIs/NLC/', { 
        title: err.description 
       }); 
      }else{ 
       console.log(JSON.stringify(response, null, 2)); 
       res.status(200).render('./APIs/NLC/', { 
        title: 'Natural Language Classifer' 
       }); 
      } 
     }); 

有人知道該怎麼辦?

+0

從文檔中,400的原因是:「缺失或格式不正確的數據或數據集太小,可能是由於缺少培訓數據或格式錯誤的CSV導致的。你能發佈你的訓練數據嗎? –

回答

0

問題在於使用的是文件路徑。它返回了一個不存在的文件。一旦training.csv的文件路徑被硬編碼,一切正常。

所以我們在使用'./public/uploads/'+req.files.file.name時得到了400錯誤,但是當我們使用'./public/uploads/MyTrainingFile.csv'時它就起作用了。

雖然我們會預料到一些更具描述性的錯誤信息。