Skip to content

Latest commit

 

History

History
23 lines (13 loc) · 928 Bytes

File metadata and controls

23 lines (13 loc) · 928 Bytes

Reference:Text: Sentiment Analysis

source

sample code with main js here

  • default model used is movieReview, trained on IMDB reviews truncated to 200 words and only 20K most common words used (not good results for negative at least for my test input)

  • prediction score would range from 0 to 1, ranging from extreme hint of negative to positive

  • initializing using const sentiment = ml5.sentiment(modelName, ?callback)

  • modelName: required, defaults to movieReview; can also use path to manifest.json file

callback: optional, called when model has loaded; returns a promise resolved when model loaded

  • attributes on sentiment object are .ready and .model

  • methods on sentiment object is .predict(text_to_predict) returns score with 0 as negative and 1 as positive