Sentiment analysis classifies the attitude expressed in text, commonly as positive, negative, or neutral. A Hugging Face pipeline makes binary classification practical without training a model from scratch. section 3.2.3 section 1.1
Classify a review with a pipeline
from transformers import pipeline classifier = pipeline( "text-classification", model="distilbert-base-uncased-finetuned-sst-2-english", revision="af0f99b" ) classifier("I loved the movie; it was fantastic!") The pipeline returns a sentiment label and confidence score. The demonstrated model supports positive and negative IMDb-style classification. section 1.1
For lower-level control, load the tokenizer and sequence-classification model, tokenize text into PyTorch tensors, pass the inputs to the model, and select the largest logit. The example maps class 0 to negative and class 1 to positive. section 3.2.3
Domain adaptation uses labeled reviews such as Yelp Polarity, whose binary labels support fine-tuning a pretrained model for restaurant, hotel, and service opinions. section 6.1.1











