java - Classifying data with naive bayes using LingPipe -


I want to classify some data into different categories based on my content. I used this naive Baiyas classifier and I get an output as the best category for which it is related. But now I want to classify other news stories other than those people in the training set in "Other" class. I can not manually add training data to each / other data except for a certain class because it has many other categories. So is there any way to classify other data ?.

  Private static file TRAINING_DIR = New file ("4news-train"); Private static file TESTING_DIR = new file ("4news-test"); Private static string [] CATEGORIES = {"c1", "c2", "c3", "other"}; Private static difference NGRAM_SIZE = 6; Public static zero major (string [] args) classless diffusion, IOException {DynamicLMClassifier & lt; NGramProcessLM & gt; Classifierfile = dynamiclmcciifier.creategraph process (categories, ngmm_scieg); For (Int i = 0; I & lt; CATEGORIES.length; ++ i) {File ClassDire = New file (TRAINING_DIR, CATEGORIES [i]); If (! ClassDir.isDirectory ()) {string msg = "training directory could not be found" = class + director \ "\ ndirectory directory not found"; Println (message); // If the exception is made in case, establish new illegal invalid exception (msg); } String [] trainingFiles = classDir.list (); For (int j = 0; j and lieutenant; training files; long; ++ j) {file file = new file (classdear, trainingfile [j]); String text = files .readFromFile (file, "ISO-885 9-1"); System.out.println ("Training" + Categories [I] + "/" + Trainingfile [J]); Classification Classification = New Classification (Categories [i]); Classified & LT; CharSequence & gt; Classifieds = new classified & lt; Chaussenen & gt; (Text, classification); Classifier.handle (classified); }}}}  

You can serialize objects ... it means intermediate The object will be a file and it will be your model ...

Then you do not need to pass the data in the model to train each time to test ... it will be easy for you < / P>


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -