<commit_before>package eu.amidst.standardmodels;

import eu.amidst.core.datastream.DataInstance;
import eu.amidst.core.datastream.DataOnMemory;
import eu.amidst.core.datastream.DataStream;
import eu.amidst.core.distribution.Multinomial;
import eu.amidst.core.utils.DataSetGenerator;
import eu.amidst.core.utils.Utils;
import eu.amidst.core.variables.Variable;
import eu.amidst.standardmodels.classifiers.LatentClassificationModel;
import eu.amidst.standardmodels.classifiers.NaiveBayesClassifier;
import eu.amidst.standardmodels.eu.amidst.standardmodels.exceptions.WrongConfigurationException;
import junit.framework.TestCase;

import java.util.List;
import java.util.stream.Collectors;

/**
 * Created by rcabanas on 10/03/16.
 */
public class LatentClassificationModelTest extends TestCase {

    protected LatentClassificationModel lcm;
    DataStream<DataInstance> data;

    protected void setUp() throws WrongConfigurationException {
        data = DataSetGenerator.generate(1234,500, 1, 5);

        System.out.println(data.getAttributes().toString());

        String classVarName = "DiscreteVar0";

        lcm = new LatentClassificationModel(data.getAttributes());
        lcm.setClassName(classVarName);

        if(lcm.isValidConfiguration()) {
            lcm.learnModel(data);
            for (DataOnMemory<DataInstance> batch : data.iterableOverBatches(100)) {

                lcm.updateModel(batch);
            }
            System.out.println(lcm.getModel());
            System.out.println(lcm.getDAG());
        }


    }


    //////// test methods<commit_msg>LCM paper reference in javadoc<commit_after>package eu.amidst.standardmodels;

import eu.amidst.core.datastream.DataInstance;
import eu.amidst.core.datastream.DataOnMemory;
import eu.amidst.core.datastream.DataStream;
import eu.amidst.core.distribution.Multinomial;
import eu.amidst.core.utils.DataSetGenerator;
import eu.amidst.core.utils.Utils;
import eu.amidst.core.variables.Variable;
import eu.amidst.standardmodels.classifiers.LatentClassificationModel;
import eu.amidst.standardmodels.classifiers.NaiveBayesClassifier;
import eu.amidst.standardmodels.eu.amidst.standardmodels.exceptions.WrongConfigurationException;
import junit.framework.TestCase;

import java.util.List;
import java.util.stream.Collectors;

/**
 * This class implements the latent classification models. For more details, see
 * <NAME>., & <NAME>. (2005). Latent classification models. Machine Learning, 59(3), 237-265.
 * Created by rcabanas on 10/03/16.
 *
 */
public class LatentClassificationModelTest extends TestCase {

    protected LatentClassificationModel lcm;
    DataStream<DataInstance> data;

    protected void setUp() throws WrongConfigurationException {
        data = DataSetGenerator.generate(1234,500, 1, 5);

        System.out.println(data.getAttributes().toString());

        String classVarName = "DiscreteVar0";

        lcm = new LatentClassificationModel(data.getAttributes());
        lcm.setClassName(classVarName);

        if(lcm.isValidConfiguration()) {
            lcm.learnModel(data);
            for (DataOnMemory<DataInstance> batch : data.iterableOverBatches(100)) {

                lcm.updateModel(batch);
            }
            System.out.println(lcm.getModel());
            System.out.println(lcm.getDAG());
        }


    }


    //////// test methods
{'fraction_non_alphanumeric': 0.10806787734444775, 'fraction_numerical': 0.01518309020541828, 'mean_word_length': 3.732394366197183, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1378130', 'n_tokens_mistral': 1060, 'n_tokens_neox': 964, 'n_words': 166}