The preparations
You will find the code for this example here:
Loading the libraries
To run this example, you need to install the following libraries:
mldatasets
to load the datasetpandas
,numpy
, andnltk
to manipulate itsklearn
(scikit-learn) andlightgbm
to split the data and fit the modelsmatplotlib
,seaborn
,shap
, andlime
to visualize the interpretations
You should load all of them first, as follows:
import math import mldatasets import pandas as pd import numpy as np import re import nltk from nltk.probability import FreqDist from sklearn.model_selection import train_test_split from sklearn.pipeline import make_pipeline from sklearn import metrics, svm from sklearn.feature_extraction.text import TfidfVectorizer import lightgbm as lgb import matplotlib.pyplot as plt import seaborn as sns import shap import lime import...