ENSPIRING.ai: Text Classification - AI Techniques and Real-World Applications

ENSPIRING.ai: Text Classification - AI Techniques and Real-World Applications

The video explores the concept and practical applications of text classification, which is a machine learning technique that organizes raw textual data into distinct categories. It varies from binary classification, where data is divided into two groups, to multiclass and multilabel classifications, involving multiple categories and overlapping classifications, respectively. text classification is increasingly vital in our information-rich world, especially for organizing large volumes of data efficiently without human intervention.

Additionally, four key techniques in text classification are discussed. These include preprocessing text, extracting features, selecting suitable models, and working iteratively through labeled outputs to refine the process. These steps help create a framework that guides the automation in classifying text, such as detecting spam emails or categorizing movies. Practical applications cover areas like spam detection, sentiment analysis, topic categorization, and customer feedback, demonstrating text classification's versatility across different data environments.

Main takeaways from the video:

💡
text classification can reduce the human workload by automatically sorting information into categories.
💡
Key challenges include handling imbalanced datasets, ambiguous texts, and ensuring diverse classification examples.
💡
Techniques such as proper labeling, validation, and monitoring can enhance text classification model accuracy.
Please remember to turn on the CC button to view the subtitles.

Key Vocabularies and Common Phrases:

1. text classification [tɛkst ˌklæsɪfɪˈkeɪʃən] - (noun) - A machine learning technique involving the categorization of text into organized groups. - Synonyms: (text categorization, document classification, text sorting)

text classification takes raw text like these documents, and funnels them into a computational engine that then outputs different classifications.

2. binary classification [ˈbaɪnɛri ˌklæsɪfɪˈkeɪʃən] - (noun) - The simplest form of categorizing data into two distinct categories. - Synonyms: (binary sorting, binary categorization, dichotomous classification)

Types of text classification there's three major types, starting with the least complex binary classification that can be expressed as either a one or a zero.

3. multiclass classification [ˈmʌltiklæs ˌklæsɪfɪˈkeɪʃən] - (noun) - A method of sorting data into one of more than two categories. - Synonyms: (multicategory classification, multiple class sorting, polytomous classification)

The second is multiclass classification. About that. And that's either a one, or rather a two 10, or if using the email example, a business related email, a customer related email, or an order email.

4. multilabel classification [ˈmʌltɪˌleɪbəl ˌklæsɪfɪˈkeɪʃən] - (noun) - A method where each data sample can belong to multiple categories simultaneously. - Synonyms: (multitag classification, concurrent classification, joint labeling)

The third and the most complex is what's called multilabel classification.

5. feature extraction [ˈfiːtʃər ɪkˈstrækʃən] - (noun) - The process of converting raw text into a numerical format suitable for a computational model. - Synonyms: (attribute extraction, characteristic extraction, data feature selection)

The next step, which is called feature extraction.

6. word embeddings [wɜrd ɛmˈbɛdɪŋz] - (noun) - A type of word representation that allows words to be represented as vectors in a continuous vector space. - Synonyms: (word vectors, lexical embeddings, dense representations)

So this is where you take the text and you send it into what's called word embeddings.

7. sentiment analysis [ˈsɛn.tə.mənt əˈnæl.ə.sɪs] - (noun) - A process of determining the emotional tone conveyed by a piece of text. - Synonyms: (opinion mining, sentiment mining, emotion detection)

The next one is what's called sentiment analysis.

8. imbalanced datasets [ɪmˈbælənst ˈdeɪtəˌsɛts] - (noun) - Datasets where some categories have significantly more examples than others. - Synonyms: (skewed datasets, uneven datasets, disproportionate datasets)

So challenges and best practices when it comes to classifying text. The first one is what's termed as imbalanced datasets.

9. ambiguous text [æmˈbɪɡjuəs tɛkst] - (noun) - Text that can be interpreted in more than one way, causing confusion in classification. - Synonyms: (unclear text, vague text, equivocal text)

The second is what's called ambiguous text, and this one's a little bit gray and it's relative to each use case.

10. iterative steps [ˈɪtəˌreɪtɪv stɛps] - (noun) - Repeated processes or cycles of improvement and refinement in a workflow. - Synonyms: (recursive steps, cyclical steps, repeated processes)

iterative steps are required in order to take the raw text, turn it into features, pass it through the model, and then get our labeled output.

Text Classification - AI Techniques and Real-World Applications

So let's jump in with a quick question. How many of you have come across spam, or in your email, or while on Netflix, the different categories of a movie? Well, that's text classification. text classification takes raw text like these documents, and funnels them into a computational engine that then outputs different classifications. So it could be, in the two examples mentioned, a spam email, or simply a not spam, or in the Netflix examples, a comedy, drama, etcetera. So, in today's world, we're constantly bombarded with tons of information, and what text classification can provide us is a means in order to simplify and automate the classification of different types of text without human input.

Types of text classification there's three major types, starting with the least complex binary classification that can be expressed as either a one or a zero. Or in the email example, a spam versus not spam. The second is multiclass classification. About that. And that's either a one, or rather a two 10, or if using the email example, a business related email, a customer related email, or an order email. The third and the most complex is what's called multilabel classification. And this kind is the most complex because you can assign a specific email or a specific type of text, multiple classifications. So, switching over to the Netflix example, a movie can be classified as an action adventure, and it has those two classifications as just that one entity. So depending on the business use case and text complexity, you'll go through and determine if you need to use one of these three major types.

Key techniques of text classification there's four key techniques. So the first one is how do you handle the raw text? Most of your time is spent preparing and pre processing the text, and you usually do that in script languages such as python. So you take the raw text, you extract it from the document. Depending on your use case, you remove periods, hyphens, postrophe, s'that, sort of thing. It all depends on the use case. But again, this is where most of your time is spent working through and preprocessing that text before the next step, which is called feature extraction. And I'll just put Fe for short. So this is where you take the text and you send it into what's called word embeddings. So this a bit of a black box, and the details of it are outside of the scope of today's discussion, but you're essentially taking the raw text and then converting it into a long list of numbers.

The third is the model. So when I say model, I mean a large language model like chat GPT or granite model or Bert model. And depending on what you're trying to classify, different types of models have different pre trained with their own levels of text with their own pre trained types of text. So in other words, there could be a model that's built on just classifying spam versus non spam emails, or classifying different types of movies or different types of news documents. This is where you would select that type of model that's specific for your use case. And then the fourth type, or the fourth step is the labeled output. So I'll just write output. And this part you need to work through iteratively. So this is just the types of classifications that you're receiving from each of these steps. Depending on your output, you might have to go all the way back to your text and work it. You might have to go back to your feature extraction and adjust it. Or as mentioned, you might have the wrong model selected. So you might have to go back to that model and select a different one.

So through these four key techniques, it gives you just an idea of what steps are required. iterative steps are required in order to take the raw text, turn it into features, pass it through the model, and then get our labeled output. So what are real world applications of text classification? I'm going to go through just a couple here, but the first one is, as mentioned previously, spam detection. So you get a bunch of emails, you're not sure if they're relevant to you or is it someone sending you something inappropriate? Well, you can add an AIH text classification model onto your inbox and classify those emails as spam or not spam.

The next one is what's called sentiment analysis. So positive. The classic examples are positive, negative or neutral. So if a string of text is happy or sad or neutral, and you can use that in the business world as to determine customers and how they feel about something, how they feel about a product, let it be how they post about it on Twitter or X or how they post about it on Instagram. You can determine how they're feeling about something like that through sentiment analysis.

The next one, and this is a more business specific, an internal specific type of application, but it's what's called topic categorization. So let's say, for example, a business is receiving emails from customers and instead of having an administrator go through and manually classify those emails for, let's say, for an order or a technical requests or a customer service request, you can have an AI model go through and classify each of those automatically into those categories the fourth is what's called customer feedback. So this ties into, as mentioned, the others, such as with sentiment. But if you're trying to determine how a customer is feeling about something, let's say, for example, they email you and they say, this product is terrible, I want to return it, never buy something again. Well, from a business standpoint, you want to make sure that you speak to that customer immediately to try to rectify the situation. Whereas in on the flip side of that, if a customer is happy with the product and just wants to send out a thank you, you don't need to prioritize that as immediately as you would with something a little more negative.

So these are the four, I feel, real world, major categories of text classification. Obviously, there's a lot out there that you can do with this, and the applications are almost limitless. So challenges and best practices when it comes to classifying text. The first one is what's termed as imbalanced datasets. So you need to make sure that you have the right number of examples for each type of thing that you're trying to classify. If you have too many of one type or too little of another, your output in your model won't be as balanced as you want it to be. So you need to make sure that you have the right number relative to the output that you're expecting.

The second is what's called ambiguous text, and this one's a little bit gray and it's relative to each use case. But the example I like to give is the word bank. The word bank can have a couple applications, like the physical location where you store money or the side of a river. The model might not necessarily know what you want it to mean. So leading into it and leading into the text that you're using, you need to make sure that you have that specified. The third one is diverse. Diverse meaning you have a wide spread of different types of examples. So using sentiment analysis as an example here, positive, negative and neutral, you need to make sure that the types of training examples you have within each spread both the extremes of extremely positive to kind of positive, and then into the negative, extremely negative, kind of negative, and then everything else in the middle neutral.

So it's important that you have the spread within each, because if you don't, you might only be receiving classifications on extremely positive or extremely negative, while you're going to want to capture within that spread of each subcategorization those sentiments. So what can we do to fix this, each of these components? So one of the things that we can do to fix this is through what's called, well, proper labeling. And this can be really time intensive. But what I mean by that is you go through each of your training examples and manually read and discern is this using the sentiment example, is this positive, is this negative? And then manually label that yourself. Don't rely on somebody else that might not be versed in the task that you're trying to perform. Do it yourself, do it by hand.

And then the last one within this is validation. So what I mean by validation is making sure once you train that first model, that the data that you're then receiving or sending it out in the real world still are being classified in the way that you want. So there's this thing called drift, where if a world event comes along and changes what the sentiment of a particular idea or topic would be, the model would perform differently. So you need to be constantly going back and reviewing it to make sure that the model is classifying what you want it to classify. So to wrap things up, let's revisit why text classification is so powerful. Businesses are getting flooded by tons of information daily, thousands of emails, phone calls, etcetera. So these text classification models are able to classify these things without human intervention, quickly and efficiently and repeatedly.

Artificial Intelligence, Business, Technology, Text Classification, Machine Learning, Data Processing, Ibm Technology