ABSTRACT

Acronyms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 13.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 13.2 Applying This Technique in Other Domains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 13.3 Installing the Text Processing Extension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 13.4 Getting the Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201 13.5 Loading the Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201

13.5.1 Data Import Wizard Step 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201 13.5.2 Data Import Wizard Step 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202 13.5.3 Data Import Wizard Step 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202 13.5.4 Data Import Wizard Step 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202 13.5.5 Step 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202

13.6 Examining the Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 13.6.1 Tokenizing the Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 13.6.2 Creating the Word List and Word Vector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 13.6.3 Examining the Word Vector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204

13.7 Processing the Text for Classification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 13.7.1 Text Processing Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206

13.8 The Na¨ıve Bayes Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 13.8.1 How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207

13.9 Classifying the Data as Spam or Ham . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 13.10 Validating the Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 13.11 Applying the Model to New Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209

13.11.1 Running the Model on New Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 13.12 Improvements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 13.13 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211

CSV - Comma-separated values SMS - Short Message Service UTF - Universal Character Set Transformation Format

Applications

This chapter is about text classification. Text classification is an important topic in data mining, as most communications are stored in text format. We will build a RapidMiner process that learns the difference between spam messages, and messages that you actually want to read. We will then apply the learned model to new messages to decide whether or not they are spam. Spam is a topic familiar to many, so it is a natural medium to work in. The same techniques used to classify spam messages can be used in many other text mining domains.