09.10.2023 Views

Advanced Data Analytics Using Python_ With Machine Learning, Deep Learning and NLP Examples ( 2023)

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 3

Supervised Learning Using Python

g, p, dof, expected = chi2_contingency(c_xy, lambda_="loglikelihood")

mi = 0.5 * g / c_xy.sum()

return mi

Classifications with Python

Classification is a well-accepted example of machine learning. It has a

set of a target classes and training data. Each training data is labeled by

a particular target class. The classification model is trained by training

data and predicts the target class of test data. One common application of

classification is in fraud identification in the credit card or loan approval

process. It classifies the applicant as fraud or nonfraud based on data.

Classification is also widely used in image recognition. From a set of

images, if you recognize the image of a computer, it is classifying the image

of a computer and not of a computer class.

Sentiment analysis is a popular application of text classification.

Suppose an airline company wants to analyze its customer textual

feedback. Then each feedback is classified according to sentiment

(positive/negative/neutral) and also according to context (about staff/

timing/food/price). Once this is done, the airline can easily find out

what the strength of that airline’s staff is or its level of punctuality or cost

effectiveness or even its weakness. Broadly, there are three approaches in

classification.

• Rule-based approach: I will discuss the decision tree

and random forest algorithm.

• Probabilistic approach: I will discuss the Naive Bayes

algorithm.

• Distance-based approach: I will discuss the support

vector machine.

57

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!