uk.ac.cam.juliet.twitter.analysis
Class BayesLearner

java.lang.Object
  extended by uk.ac.cam.juliet.twitter.analysis.BayesLearner

public class BayesLearner
extends java.lang.Object

This class is responsible for generating the hypothesis, that will be used by the BayesClassifier to classify tweets into positive or negative, in other words, this will be the part of the algorithm that learns from training data provided by users.

To use this class:
Simply call the method addTrainingTweet(Status, Classification) and pass a tweet as argument alongside its classification (+ve or -ve) and the method will use that information to update the hypothesis in the database
What is a hyporegthesis?
A hypothesis is simply a function P(feature | positive or negative) that returns the conditional probability of this feature of the tweet given the tweet is positive or given the tweet is negative
Enough information will be stored in the database in order to calculate this probability efficiently based on any training set provided

Author:
Unknown

Field Summary
(package private)  IDatabase db
          the database that should be used to store the hypothesis and other information
(package private)  BayesUtil util
          the BayesUtil object that provides the text processing and other utilities needed by the BayesClassifier class
 
Constructor Summary
BayesLearner(IDatabase db)
          class constructor
 
Method Summary
 void addTrainingTweet(Tweet tweet, Classification c)
          the method used to train the algorithm, simply pass the tweet, and whether it is positive or negative, and the hypothesis will be improved based on that
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

db

IDatabase db
the database that should be used to store the hypothesis and other information


util

BayesUtil util
the BayesUtil object that provides the text processing and other utilities needed by the BayesClassifier class

Constructor Detail

BayesLearner

public BayesLearner(IDatabase db)
class constructor

Parameters:
db - the database that should be used to store the hypothesis and other information
Method Detail

addTrainingTweet

public void addTrainingTweet(Tweet tweet,
                             Classification c)
the method used to train the algorithm, simply pass the tweet, and whether it is positive or negative, and the hypothesis will be improved based on that