Back to directory

Rubix ML - Text Sentiment Analyzer

A worked tutorial that trains a multilayer perceptron neural network in PHP to classify movie review sentiment, using the Rubix ML library and 25,000 labeled IMDB reviews.

Rubix ML - Text Sentiment Analyzer

This example project walks through building a text sentiment classifier with Rubix ML, a PHP machine learning library, training a multilayer feed-forward neural network on 25,000 IMDB movie reviews labeled positive or negative and testing it on a further 25,000 held-out reviews. It demonstrates turning raw text files into feature vectors as well as the deep learning classifier itself, and is rated as a hard-difficulty, hours-long tutorial.

Installation is through Composer, and training benefits from Rubix ML's optional Tensor extension for faster numeric computation. The walkthrough covers reading labeled text files from folders into arrays before feature extraction and training, with the full code available in the project's train.php file.

It requires PHP 7.4 or newer and at least 16GB of memory.

More in Tutorials

See all 478
  • BootLife

    github.com

    Conway's Game of Life implemented to run directly from a 512-byte x86 boot sector in assembly, using VGA memory itself as the simulation grid.

  • A technical blog post deriving the Y combinator as a composition of combinator birds in an array language, and examining how eager evaluation changes fixed-point recursion compared with the usual lazy telling.

  • System Design Atlas

    atlas-sysdes.vercel.app

    A free reference of worked system design problems with interactive architecture diagrams, covering ranked designs such as a feed, a chat app, a URL shortener, and a rate limiter, plus pages on the technologies behind them.