import java.io.FileReader; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.concurrent.TimeUnit; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import weka.classifiers.Evaluation; import weka.classifiers.bayes.NaiveBayes; import weka.classifiers.functions.LinearRegression; import weka.classifiers.functions.MultilayerPerceptron; import weka.classifiers.functions.SMO; import weka.classifiers.functions.SMOreg; import weka.core.Instances; import weka.core.converters.ConverterUtils.DataSource; public class WekaModelCreator { private static final String[] targets = {"edge","cloud_rsu","cloud_gsm"}; public static void main(String[] args) throws Exception { String dataPath = ""; String classifier = ""; String regressor = ""; JSONParser parser = new JSONParser(); try { Object object = parser.parse(new FileReader(args[0])); //convert Object to JSONObject JSONObject jsonObject = (JSONObject)object; //Reading the String dataPath = (String) jsonObject.get("sim_result_folder"); classifier = (String) jsonObject.get("classifier"); regressor = (String) jsonObject.get("regressor"); } catch(Exception e) { e.printStackTrace(); System.exit(1); } System.out.println("######### TRAINING FOR " + dataPath + " #########"); for(int i=0; i0) result += diffInDays + ((diffInDays>1 == true) ? " Days " : " Day "); if(diffInHours>0) result += diffInHours % 24 + ((diffInHours>1 == true) ? " Hours " : " Hour "); if(diffInMinutes>0) result += diffInMinutes % 60 + ((diffInMinutes>1 == true) ? " Minutes " : " Minute "); if(diffInSeconds>0) result += diffInSeconds % 60 + ((diffInSeconds>1 == true) ? " Seconds" : " Second"); if(diffInMilli>0 && result.isEmpty()) result += diffInMilli + ((diffInMilli>1 == true) ? " Milli Seconds" : " Milli Second"); return result; } }