public static void learnAndSaveAllModels(){
        // Seleccionamos el directorio en el que se van a recoger todos los
        String input_path = "data/automatic_learn/";
        File[] inputFiles = new File(input_path).listFiles(x -> x.getName().endsWith(".arff"));
        String output_path = "results/automatic_learn/LCM/";
        for (File inputFile : inputFiles) {
            try {
                if (inputFile.isFile()) {
                    //Create the DiscreteDataSet
                    DiscreteDataSet data = new DiscreteDataSet(DataFileLoader.loadData(input_path + inputFile.getName(), DiscreteVariable.class));
                    System.out.println("------------------------------------------------------------------------------");
                    System.out.println("------------------------------------------------------------------------------");
                    System.out.println("------------------------------------------------------------------------------");
                    System.out.println("############## "+ data.getName() + " ############## \n");
                    // Learn the LTM
                    LTM ltm = learnBestLCMVaryingCardinality(data);
                    // Save it in BIF format
                    newBifWriter writer = new newBifWriter(new FileOutputStream(output_path + "LCM_" + FilenameUtils.removeExtension(inputFile.getName()) + ".bif"), false);
                    writer.write(ltm);
                }
            }catch(Exception e){
                System.out.println("Error with " + inputFile.getName());
                e.printStackTrace();
            }
        }
    }
public static void learnAndSaveAllModels(){
       
        String input_path = "data/automatic_learn/";
        File[] inputFiles = new File(input_path).listFiles(x -> x.getName().endsWith(".arff"));
        String output_path = "results/automatic_learn/LCM/";
        for (File inputFile : inputFiles) {
            try {
                if (inputFile.isFile()) {
                   
                    DiscreteDataSet data = new DiscreteDataSet(DataFileLoader.loadData(input_path + inputFile.getName(), DiscreteVariable.class));
                    System.out.println("------------------------------------------------------------------------------");
                    System.out.println("------------------------------------------------------------------------------");
                    System.out.println("------------------------------------------------------------------------------");
                    System.out.println("############## "+ data.getName() + " ############## \n");
                   
                    LTM ltm = learnBestLCMVaryingCardinality(data);
                   
                    newBifWriter writer = new newBifWriter(new FileOutputStream(output_path + "LCM_" + FilenameUtils.removeExtension(inputFile.getName()) + ".bif"), false);
                    writer.write(ltm);
                }
            }catch(Exception e){
                System.out.println("Error with " + inputFile.getName());
                e.printStackTrace();
            }
        }
    }
public static void learnandsaveallmodels(){ string input_path = "data/automatic_learn/"; file[] inputfiles = new file(input_path).listfiles(x -> x.getname().endswith(".arff")); string output_path = "results/automatic_learn/lcm/"; for (file inputfile : inputfiles) { try { if (inputfile.isfile()) { discretedataset data = new discretedataset(datafileloader.loaddata(input_path + inputfile.getname(), discretevariable.class)); system.out.println("------------------------------------------------------------------------------"); system.out.println("------------------------------------------------------------------------------"); system.out.println("------------------------------------------------------------------------------"); system.out.println("############## "+ data.getname() + " ############## \n"); ltm ltm = learnbestlcmvaryingcardinality(data); newbifwriter writer = new newbifwriter(new fileoutputstream(output_path + "lcm_" + filenameutils.removeextension(inputfile.getname()) + ".bif"), false); writer.write(ltm); } }catch(exception e){ system.out.println("error with " + inputfile.getname()); e.printstacktrace(); } } }