public class Experiment3a {
public static void main(String[] args) {
Logger.getRootLogger().setLevel(Level.OFF);
IDataConn dataConn = new CsvConn("c:/data/data.csv");
try {
CrossValidator cv = new CrossValidator();
List<Feature<Review>> features = new ArrayList<Feature<Review>>();
SupervisedTrainer trainer = new MaxEntLBFGSTrainer();
List<Review> data = dataConn.getReviewsNo(20000);
System.out.println("Datasize " + data.size());
print("lemma + pos");
features.add(new LemmaFeature(0));
features.add(new POSTagFeature(0, 4));
cv.multiValidate(features, trainer, 10, data, null, 0);
print("lemma + pos + statementcount");
features.clear();
features.add(new LemmaFeature(0));
features.add(new POSTagFeature(0, 4));
features.add(new StatementCountFeature());
cv.multiValidate(features, trainer, 10, data, null, 0);
print("words + statementcount");
features.clear();
features.add(new ThresholdFeature(0));
features.add(new StatementCountFeature());
cv.multiValidate(features, trainer, 10, data, null, 0);
print("words + pos");
features.clear();
features.add(new ThresholdFeature(0));
features.add(new POSTagFeature(0, 4));
cv.multiValidate(features, trainer, 10, data, null, 0);
print("words + pos + statementcount");
features.clear();
features.add(new ThresholdFeature(0));
features.add(new POSTagFeature(0, 4));
features.add(new StatementCountFeature());
cv.multiValidate(features, trainer, 10, data, null, 0);
print("words + bigrams");
features.clear();
features.add(new ThresholdFeature(0));
features.add(new BigramFeature(0));
cv.multiValidate(features, trainer, 10, data, null, 0);
print("words + bigrams + statementcount");
features.clear();
features.add(new ThresholdFeature(0));
features.add(new BigramFeature(0));
features.add(new StatementCountFeature());
cv.multiValidate(features, trainer, 10, data, null, 0);
print("words + pairs");
features.clear();
features.add(new ThresholdFeature(0));
features.add(new WordPairFeature(10));
cv.multiValidate(features, trainer, 10, data, null, 0);
print("Adjective + verb");
features.clear();
features.add(new AdjectiveFeature(0));
features.add(new VerbFeature(0));
cv.multiValidate(features, trainer, 10, data, null, 0);
print("Adjective + verb + statementcount");
features.clear();
features.add(new AdjectiveFeature(0));
features.add(new VerbFeature(0));
features.add(new StatementCountFeature());
cv.multiValidate(features, trainer, 10, data, null, 0);
print("SpecificBigram + verb + adjectice + statementcount");
features.clear();
features.add(new SpecificBigramFeature(0));
features.add(new VerbFeature(0));
features.add(new AdjectiveFeature(0));
features.add(new StatementCountFeature());
cv.multiValidate(features, trainer, 10, data, null, 0);
} catch (SQLException e) {
e.printStackTrace();
} catch (InvalidAttributeValueException e) {
e.printStackTrace();
} finally {
dataConn.close();
}
}