@@ -0,0 +1,1641 @@
+import org.shogun.*;%0Aimport org.jblas.*;%0Aimport static org.shogun.EAlphabet.DNA;%0Aimport java.util.ArrayList;%0Aimport java.util.Arrays;%0Aimport java.util.List;%0Apublic class distribution_histogram_modular %7B%0A%09static %7B%0A%09%09System.loadLibrary(%22Features%22);%0A%09%09System.loadLibrary(%22Distribution%22);%0A%09%7D%0A%0A%09public ArrayList parameter_list = new ArrayList(2);%0A%09public distribution_histogram_modular() %7B%0A%0A%09%09parameter_list.add(Arrays.asList(new Integer(3), new Integer(0)));%0A%09%09parameter_list.add(Arrays.asList(new Integer(4), new Integer(0)));%0A%09%7D%0A%09static ArrayList run(List para) %7B%0A%09%09boolean reverse = false;%0A%09%09Features.init_shogun_with_defaults();%0A%09%09int order = ((Integer)para.get(0)).intValue();%0A%09%09int gap = ((Integer)para.get(1)).intValue();%0A%0A%09%09String%5B%5D fm_train_dna = Load.load_dna(%22../data/fm_train_dna.dat%22);%0A%0A%09%09StringCharFeatures charfeat = new StringCharFeatures(fm_train_dna, DNA);%0A%09%09StringWordFeatures feats = new StringWordFeatures(charfeat.get_alphabet());%0A%09%09feats.obtain_from_char(charfeat, order-1, order, gap, reverse);%0A%0A%09%09Histogram histo = new Histogram(feats);%0A%09%09histo.train();%0A%0A%09%09histo.get_histogram();%0A%0A%09%09int  num_examples = feats.get_num_vectors();%0A%09%09int num_param = histo.get_num_model_parameters();%0A%0A%09%09DoubleMatrix out_likelihood = histo.get_log_likelihood();%0A%09%09double out_sample = histo.get_log_likelihood_sample();%0A%0A%09%09ArrayList result = new ArrayList();%0A%09%09result.add(histo);%0A%09%09result.add(out_sample);%0A%09%09result.add(out_likelihood);%0A%09%09Features.exit_shogun();%0A%09%09return result;%0A%09%7D%0A%09public static void main(String argv%5B%5D) %7B%0A%09%09distribution_histogram_modular x = new distribution_histogram_modular();%0A%09%09run((List)x.parameter_list.get(0));%0A%09%7D%0A%7D%0A

add distribution_histogram_modular java example