Changes

Jump to navigation Jump to search
3,302 bytes added ,  13:47, 21 September 2020
no edit summary
{{Project
|Has project output=Tool
|Has sponsor=McNair Center
|Has title=Deep Text Classifier
|Has owner=Yang Zhang,
|Has start date=September 2017
|Has keywords=Tool
|Has project status=Active
|Does subsume=Industry Classifier,
}}
=Deep Text Classifier=
 
E:\McNair\Projects\Deep Text Classifier
==Problem Description==
==About the Deep Models==
There are basically two big categories of deep neural networks - the convolutional neural networks [http://cs231n.github.io/convolutional-networks/ CNN] and the recurrent neural networks [https://en.wikipedia.org/wiki/Recurrent_neural_network RNN]. The first one, CNN, is more suitable for dealing with the image based classification tasks. The second one, RNN, is in general for sequential information (i.e. language, video ...) based classification tasks. I have tired both kinds of models and , as expected , the RNN is more robust in facing different text classification tasks
==Major Package Dependences==
==Data Preprocessing==
 
For data preprocessing, we adopt the same standard as in the [http://ai.stanford.edu/~amaas/data/sentiment/ IMDB] dataset.
 
'''To general users:'''
 
Your input file (usually a single ".txt" file contains many examples each as a row) will be split into a training set (80% by default) and a testing set (20% by default). The labels you want to predict will be the folder names. The content (usually a block of text) of the examples will go into separate ".txt" files. To run the script, you basically need to specify the following:
 
1. "File Name" : without the ".txt" extension,
2. "Expected Columns" : total number of columns in the input file
3. "Content Index" : the column index of the content
4. "Label Index" : the column index of the label
 
The script will generate a pickle file with an ".pkl" extension and the name will be the same as your input. Please change the name properly to indicate the label information as have been discussed above. And place this pickle file under the same directory with your classification code, i.e. "classification_MMM_LLL.py"
 
'''To advanced users:'''
 
1. One important step in data preprocessing is to encode words (strings) into integers. The solution is to build a dictionary mapping words to their corresponding indices. For example, let's say "hello" is the 17th words in our dictionary and thus "hello" is encoded to 17. Our advanced dictionary is ordered by the words' frequency. Higher the frequency smaller the index. That is you should expect to see "the" and "a" these words with very small indices. Please also notice that 0 and 1 these two indices are not assigned to any words intentionally. The advantage here is that you can easily ignore those very common and meaningless words, like "the", by simply saying I only want to consider words with the indices > 20 for example. Notice that it's possible to encounter words that are not in our dictionary and we will alway assign them to index 1. These words are safe to ignore given that our dictionary is big enough.
 
2. Saving a pickle file is an very efficient way to retrieve the data so that you don't need to do data preprocessing every time when you want to run your classifier.
==Model Training/Prediction==
==General Guidelines We write in [https://www.tensorflow.org/ Tensorflow] for Tuning all the classifiers. [https://keras.io/ Keras] is a good wrapper over the HyperTensorflow framework to allow you quickly build up a neural network and train it. ( if you are new to Deep Learning and Tensorflow, please do stay with Keras. ) * '''Embedding''' [https://keras.io/layers/embeddings/ Keras Official Documentation] [https://www.tensorflow.org/tutorials/word2vec Tensorflow : Vector Representations of Words] [https://en.wikipedia.org/wiki/Word2vec Wiki : Word2vec] * '''LSTM''' [http://colah.github.io/posts/2015-Parameters08-Understanding-LSTMs/ A Nice Blog about LSTM] [https://www.tensorflow.org/tutorials/recurrent Tensorflow : Recurrent Neural Networks] [https://keras.io/layers/recurrent/ Keras Official Documentation] ==Summer 2018 Work==Code, data, and attempts to run are located in: E:

Navigation menu