@@ -0,0 +1,2008 @@
+package edu.neu.ccs.pyramid.experiment;%0A%0Aimport edu.neu.ccs.pyramid.configuration.Config;%0Aimport edu.neu.ccs.pyramid.dataset.DataSetType;%0Aimport edu.neu.ccs.pyramid.dataset.MultiLabel;%0Aimport edu.neu.ccs.pyramid.dataset.MultiLabelClfDataSet;%0Aimport edu.neu.ccs.pyramid.dataset.TRECFormat;%0Aimport edu.neu.ccs.pyramid.multilabel_classification.bmm_variant.BMMClassifier;%0Aimport edu.neu.ccs.pyramid.util.Serialization;%0A%0Aimport java.io.File;%0Aimport java.util.List;%0Aimport java.util.stream.IntStream;%0A%0A/**%0A * analyze %22reflection%22%0A * Created by chengli on 1/23/16.%0A */%0Apublic class Exp142 %7B%0A    private static final Config config = new Config(%22config/local.config%22);%0A    private static final String DATASETS = config.getString(%22input.datasets%22);%0A    private static final String TMP = config.getString(%22output.tmp%22);%0A    public static void main(String%5B%5D args) throws Exception%7B%0A        MultiLabelClfDataSet testSet = TRECFormat.loadMultiLabelClfDataSet(new File(DATASETS, %22nuswide-128/data_sets/test%22),%0A                DataSetType.ML_CLF_DENSE, true);%0A        long c= IntStream.range(0,testSet.getNumDataPoints()).filter(i-%3E testSet.getMultiLabels()%5Bi%5D.matchClass(49))%0A                .count();%0A        System.out.println(c);%0A%0A        BMMClassifier bmmClassifier = (BMMClassifier) Serialization%0A                .deserialize(%22/Users/chengli/Documents/mixture_analysis/model_mix_lr_30%22);%0A%0A        List%3CMultiLabel%3E samples = bmmClassifier.samples(testSet.getRow(74686));%0A        System.out.println(samples);%0A        System.out.println(%22marginal for lake = %22+marginal(samples,34));%0A        System.out.println(%22marginal for water = %22+marginal(samples,75));%0A        System.out.println(%22marginal for sunset = %22+marginal(samples,62));%0A        System.out.println(%22marginal for reflection = %22+marginal(samples,49));%0A    %7D%0A%0A%0A    static double marginal(List%3CMultiLabel%3E samples, int label)%7B%0A        return IntStream.range(0,samples.size()).filter(i-%3E samples.get(i).matchClass(label)).count()/((double)samples.size());%0A    %7D%0A%7D%0A

add exp142