// Path: src/main/java/RFLogger.java
// public class RFLogger {
// 
//     private String fileName = "./classes/log.properties";
//     private static java.util.logging.Logger logger = null;
//     
//     private static ConsoleHandler consoleHandler;
//     
//     private static SimpleFormatter simpleFormatter;
// 
//     private RFLogger() {
// 
//         // Create the logger.
//         logger = java.util.logging.Logger.getLogger(RFLogger.class.getName());
// 
//         try {
//             java.util.logging.LogManager.getLogManager().readConfiguration(new FileInputStream(fileName));
// 
//         }
//         catch (IOException e) {
//             System.out.println("Unable to configure logging for " + fileName);
// 
//             e.printStackTrace();
// 
//             System.out.println("Resorting to console handler.");
// 
//         
//             //Create consoleHandler.
//             consoleHandler = new ConsoleHandler();
//         
//             //Assigning handler to logger object.
//             logger.addHandler(consoleHandler);
//         
//             //Setting levels to handler and logger.
//             consoleHandler.setLevel(Level.INFO);
//             logger.setLevel(Level.ALL);
//         
//             // Creating SimpleFormatter for human readable format.
//             simpleFormatter = new SimpleFormatter();
// 
//             // Setting formatter to all handlers.
//             consoleHandler.setFormatter(simpleFormatter);
// 
//             // Remove parent handlers in order to respect our formatting only.
//             // logger.setUseParentHandlers(false);
//         }
//     }
//     
//     private static java.util.logging.Logger getLogger() {
//         if(logger == null){
//             new RFLogger();
//         }
//         return logger;
//     }
//     
//     public static void log(Level level, String msg, Throwable thrown){
//         getLogger().log(level, msg, thrown);
//     }
//     
//     public static void log(Level level, String msg){
//         getLogger().log(level, msg);
//     }
// 
// }


import org.apache.spark.sql.Dataset;
import java.util.ArrayList;
import java.util.Arrays;
import com.kogalur.randomforest.RFLogger;
import java.util.logging.Level;
import java.util.Random;

        set_xMarginal();

        set_xImportance();

        set_partial();
        
    }


    /**
     * Sets the y-variable(s) to be targeted when multivariate
     * families are in force.  Predictions over this set of targets
     * will be included in the ensembles.
     * @param yTarget Array of y-variables to be targeted when
     * multivariate families are in force.  The default action is to
     * use all y-variables.
     */
    public void set_yTarget(String[] yTarget) {
        this.yTarget = yTarget;
        int size = yTarget.length;
        ArrayList <String> allVariableList = new ArrayList <String> (Arrays.asList(modelArg.getYvar()));

        yTargetIndex = new int[size];
        
        for (int i = 0; i < size; i++) {

            // Note the offset for the native code.
            yTargetIndex[i] = allVariableList.indexOf(yTarget[i]) + 1;
            if (yTargetIndex[i] <= 0) {
// Path: src/main/java/RFLogger.java
// public class RFLogger {
// 
//     private String fileName = "./classes/log.properties";
//     private static java.util.logging.Logger logger = null;
//     
//     private static ConsoleHandler consoleHandler;
//     
//     private static SimpleFormatter simpleFormatter;
// 
//     private RFLogger() {
// 
//         // Create the logger.
//         logger = java.util.logging.Logger.getLogger(RFLogger.class.getName());
// 
//         try {
//             java.util.logging.LogManager.getLogManager().readConfiguration(new FileInputStream(fileName));
// 
//         }
//         catch (IOException e) {
//             System.out.println("Unable to configure logging for " + fileName);
// 
//             e.printStackTrace();
// 
//             System.out.println("Resorting to console handler.");
// 
//         
//             //Create consoleHandler.
//             consoleHandler = new ConsoleHandler();
//         
//             //Assigning handler to logger object.
//             logger.addHandler(consoleHandler);
//         
//             //Setting levels to handler and logger.
//             consoleHandler.setLevel(Level.INFO);
//             logger.setLevel(Level.ALL);
//         
//             // Creating SimpleFormatter for human readable format.
//             simpleFormatter = new SimpleFormatter();
// 
//             // Setting formatter to all handlers.
//             consoleHandler.setFormatter(simpleFormatter);
// 
//             // Remove parent handlers in order to respect our formatting only.
//             // logger.setUseParentHandlers(false);
//         }
//     }
//     
//     private static java.util.logging.Logger getLogger() {
//         if(logger == null){
//             new RFLogger();
//         }
//         return logger;
//     }
//     
//     public static void log(Level level, String msg, Throwable thrown){
//         getLogger().log(level, msg, thrown);
//     }
//     
//     public static void log(Level level, String msg){
//         getLogger().log(level, msg);
//     }
// 
// }


// Path: src/main/java/TestModelArg.java
import org.apache.spark.sql.Dataset;
import java.util.ArrayList;
import java.util.Arrays;
import com.kogalur.randomforest.RFLogger;
import java.util.logging.Level;
import java.util.Random;


        set_xMarginal();

        set_xImportance();

        set_partial();
        
    }


    /**
     * Sets the y-variable(s) to be targeted when multivariate
     * families are in force.  Predictions over this set of targets
     * will be included in the ensembles.
     * @param yTarget Array of y-variables to be targeted when
     * multivariate families are in force.  The default action is to
     * use all y-variables.
     */
    public void set_yTarget(String[] yTarget) {
        this.yTarget = yTarget;
        int size = yTarget.length;
        ArrayList <String> allVariableList = new ArrayList <String> (Arrays.asList(modelArg.getYvar()));

        yTargetIndex = new int[size];
        
        for (int i = 0; i < size; i++) {

            // Note the offset for the native code.
            yTargetIndex[i] = allVariableList.indexOf(yTarget[i]) + 1;
            if (yTargetIndex[i] <= 0) {
                RFLogger.log(Level.SEVERE, "Target y-variable not found in model:  " + yTarget[i]);