public static Map<String, List<String>> test( String test_data_file, Classifier model, int task, Map<String, Double> idfs) throws Exception { System.err.println("## Testing with feature_file=" + test_data_file + " ... \n"); Map<String, List<String>> ranked_queries = new HashMap<String, List<String>>(); Learner learner = null; if (task == 1) { learner = new PointwiseLearner(); } else if (task == 2) { double C = 1.0; double gamma = 0.25; boolean isLinearKernel = false; learner = new PairwiseLearner(C, gamma, isLinearKernel); } else if (task == 3) { double C = 1.0; double gamma = 0.25; boolean isLinearKernel = false; learner = new PairwiseAddedFeatures(C, gamma, isLinearKernel); } else if (task == 4) { /* * @TODO: Your code here, extra credit * */ System.err.println("Extra credit"); } /* Step (1): construct your test feature matrix here */ TestFeatures tf = learner.extract_test_features(test_data_file, idfs); /* Step (2): implement your prediction and ranking code here */ ranked_queries = learner.testing(tf, model); return ranked_queries; }