analyzing sentiment causation we built both supervised and unsupervised models to predict the sentiment of movie reviews based on the review text content while feature engineering and modeling is definitely the need of the houryou also need to know how to analyze and interpret the root cause behind how model predictions work in this sectionwe analyze sentiment causation the idea is to determine the root cause or key factors causing positive or negative sentiment the first area of focus will be model interpretationwhere we will try to understandinterpretand explain the mechanics behind predictions made by our classification models the second area of focus is to apply topic modeling and extract key topics from positive and negative sentiment reviews interpreting predictive models one of the challenges with machine learning models is the transition from pilot or proof-of-concept phase to the production phase business and key stakeholders often perceive machine learning models as complex black boxes and poses the questionwhy should trust your modelexplaining to them complex mathematical or theoretical concepts doesn' serve the purpose is there some way in which we can explain these models in an easy-to-interpret mannerthis topic in fact has gained extensive attention very recently in refer to the original research paper by ribeiros singh guestrin titled "why should trust you?explaining the predictions of any classifierfrom pdf to understand more about model interpretation and the lime framework check out more on model interpretation in where we cover the skater framework in detail which performs excellent interpretations of various models there are various ways to interpret the predictions made by our predictive sentiment classification models we want to understand more into why positive review was correctly predicted as having positive sentiment or negative review having negative sentiment besides thisno model is accurate alwaysso we would also want to understand the reason for mis-classifications or wrong predictions the code used in this section is available in the file named sentiment_causal_model_interpretation py or you can also refer to the jupyter notebook named sentiment causal analysis model interpretation ipynb for an interactive experience let' first build basic text classification pipeline for the model that worked best for us so far this is the logistic regression model based on the bag of words feature model we will leverage the pipeline module from scikit-learn to build this machine learning pipeline using the following code from sklearn feature_extraction text import countvectorizer from sklearn linear_model import logisticregression from sklearn pipeline import make_pipeline build bow features on train reviews cv countvectorizer(binary=falsemin_df= max_df= ngram_range=( , )cv_train_features cv fit_transform(norm_train_reviewsbuild logistic regression model lr logisticregression(lr fit(cv_train_featurestrain_sentimentsbuild text classification pipeline lr_pipeline make_pipeline(cvlrsave the list of prediction classes (positivenegativeclasses list(lr_pipeline classes_