<commit_before>package eu.amidst.demos;

import COM.hugin.HAPI.ExceptionHugin;
import com.google.common.base.Stopwatch;
import eu.amidst.core.database.DataBase;
import eu.amidst.core.database.DataOnDisk;
import eu.amidst.core.database.DataOnMemory;
import eu.amidst.core.database.DataOnStream;
import eu.amidst.core.database.filereaders.StaticDataOnDiskFromFile;
import eu.amidst.core.database.filereaders.arffWekaReader.WekaDataFileReader;
import eu.amidst.core.huginlink.ParallelTAN;
import eu.amidst.core.models.BayesianNetwork;
import eu.amidst.core.models.BayesianNetworkLoader;
import eu.amidst.core.models.BayesianNetworkWriter;
import eu.amidst.core.utils.BayesianNetworkSampler;
import eu.amidst.core.utils.ReservoirSampling;

import java.io.IOException;

/**
 * Created by afa on 16/12/14.
 */
public class ParallelTANDemo {

    public static void main(String[] args) throws ExceptionHugin, IOException {

        BayesianNetwork bn = BayesianNetworkLoader.loadFromHugin("networks/Pigs.net");
        int sampleSize = 100000;
        BayesianNetworkSampler sampler = new BayesianNetworkSampler(bn);
        sampler.setParallelMode(true);
        sampler.sampleToAnARFFFile("datasets/PigsSample.arff",sampleSize);



        System.out.println("Number of variables: "+bn.getNumberOfVars());

        DataOnStream data = new StaticDataOnDiskFromFile(new WekaDataFileReader("datasets/PigsSample.arff"));

        ParallelTAN tan= new ParallelTAN();
        tan.setNumCores(4);
        tan.setNumSamplesOnMemory(10000);

        System.out.println("Learning TAN ...");
        BayesianNetwork model = tan.learn(data, "p630400490", "p48124091");
        BayesianNetworkWriter.saveToHuginFile(model,"TANFromPigSample.net");<commit_msg>New package for demos and the parallel TAN demo<commit_after>package eu.amidst.demos;

import COM.hugin.HAPI.ExceptionHugin;
import com.google.common.base.Stopwatch;
import eu.amidst.core.database.DataBase;
import eu.amidst.core.database.DataOnDisk;
import eu.amidst.core.database.DataOnMemory;
import eu.amidst.core.database.DataOnStream;
import eu.amidst.core.database.filereaders.StaticDataOnDiskFromFile;
import eu.amidst.core.database.filereaders.arffWekaReader.WekaDataFileReader;
import eu.amidst.core.huginlink.ParallelTAN;
import eu.amidst.core.models.BayesianNetwork;
import eu.amidst.core.models.BayesianNetworkLoader;
import eu.amidst.core.models.BayesianNetworkWriter;
import eu.amidst.core.utils.BayesianNetworkSampler;
import eu.amidst.core.utils.ReservoirSampling;

import java.io.IOException;

/**
 * Created by afa on 16/12/14.
 */
public class ParallelTANDemo {

    public static void main(String[] args) throws ExceptionHugin, IOException {

        BayesianNetwork bn = BayesianNetworkLoader.loadFromHugin("networks/Pigs.net");
        int sampleSize = 100000;
        BayesianNetworkSampler sampler = new BayesianNetworkSampler(bn);
        sampler.setParallelMode(true);
        sampler.sampleToAnARFFFile("datasets/PigsSample.arff",sampleSize);

        System.out.println("Number of variables: "+bn.getNumberOfVars());

        DataOnStream data = new StaticDataOnDiskFromFile(new WekaDataFileReader("datasets/PigsSample.arff"));

        ParallelTAN tan= new ParallelTAN();
        tan.setNumCores(4);
        tan.setNumSamplesOnMemory(10000);

        System.out.println("Learning TAN ...");
        BayesianNetwork model = tan.learn(data, "p630400490", "p48124091");
        BayesianNetworkWriter.saveToHuginFile(model,"TANFromPigSample.net");
{'fraction_non_alphanumeric': 0.1070615034168565, 'fraction_numerical': 0.019931662870159454, 'mean_word_length': 4.730831973898858, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4435195', 'n_tokens_mistral': 1207, 'n_tokens_neox': 1106, 'n_words': 173}