Building a K Nearest Neighbor Classifier for Text Categorization

Text categorization is a process of assigning various input texts (or documents) to one or more target categories based on its contents. This paper introduces an email classification application of text categorization, using k Nearest Neighbor (k NN) classification[1] In this work text categorization involves two processes: training process and classification process. First, The training processes use a previously categorized set of documents to train the system to understand what each category looks like[1].Second,the classifier uses the training 'model' to classify new incoming documents.The kNearest Neighbor classification method makes use of training documents, which have known categories, and finds the closest neighbors of the new sample document among all[2] These neighbors enable to find the new document's category. The Euclideandistance has been used as a similarity function for measuring the difference or similarity between two instances[3] Key words Text categorization, machine learning, k NN algorithm, similarity function I: Text categorization is the process of grouping text documents into one or more predefined categories based on their content. A number of statistical classification and machine learning techniques have been applied to the text categorization [4] Among all methods, k Nearest Neighbor is considered to be the best method for text categorization. The k NN classification requires some initial files that are generally called as training documents  These documents' categories are known before method is applied[1] A new document with no category yet, is compared with all these training documents with respect to the terms they share. Finally, the documents, that the new document is closest to, are determined, and the category is assigned accordingly. Text categorization will give better results if machine learning is included in the approach, in such a way that newly categorized documents, could be added to the training documents set, together with their previously determined categories. II:RELATED WORKS 2.1Classification Classification is a data mining technique that maps data into predefined groups or classes. It is a supervised learning method which requires labeled training data to generate rules for classifying test data into predetermined groups or classes. It is a two phase process. The first phase is the learning phase, where the training data is analyzed and classification rules are generated. The next phase is the classification, where test data is classified into classes according to the generated rules. Since classification algorithms require that classes be defined based on data attribute values[5].Text classification (TC) is a Natural Language processing (NLP) problem; it can be defined as the assignment of unclassified document to one or more predefined categories based on their content[6] Automatic TC is very useful in terms of time and expense that it saves, many methods and algorithms have been applied to the problem of text categorization; these methods vary in their accuracy and computation efficiency. Automatic document classification tasks can be divided into three sorts: superviseddocument classification where some external mechanism (such as human feedback) provides information on the correct classification for documents, unsupervised document classification (also known as document clustering) where the classification must be done entirely without reference to external information, and semi supervised document classification, where parts of the documents are labeled by the external mechanism[4]  Architecture of Document Classification In the above figure the arrow with dashed line represents the data flow in the training process and the arrow with solid line represents the data flow in the classification process[1] Document categorization goes through a number of stages; figure 2.1 shows a general overview for the framework of a typical categorization system. The document classification is divided into two processes training and classification[2] The training process comprises three key components: data pre processing, feature engineering and model generation, where as first two phases are common for both training and classification processes and the classification process makes use of the model generated by the training process for new document classification[7] A.Kousar Nikhath et al, (IJCSIT) International Journal of Computer Science and Information Technologies,  2016, 254 256