public static void train() 
	{
		Log.getLogger().log(Level.FINE, "Starting SVM train.");
		Log.getLogger().log(Level.FINE, "Building categories...");
		CategorizerFactory.buildCategories();
		
		List<Measurement> setupdata = HomeFactory.getMeasurementHome().getAll();
		if (setupdata == null || setupdata.size() == 0) return;
		
		Log.getLogger().log(Level.FINE, "Transforming data to the format of an SVM package...");
		transformToSVMFormat(setupdata, TRAIN, false);
		
		Log.getLogger().log(Level.FINE, "Creating the model...");
		int nextModel = Math.abs(ACTIVE_MODEL - 1);
		if (!runScript(TRAIN_SCRIPT, new String[] {nextModel+""})) {
			String[] scaleargs = {"-l","-1","-u","1","-s",RANGE,TRAIN};
			String[] args={"-t","0","-c","512","-q",TRAIN_SCALE+nextModel,TRAIN_SCALE+nextModel+MODEL_EXT};
			svm_train t = new svm_train();
			svm_scale s = new svm_scale();
			try {        	     	
				s.run(scaleargs, TRAIN_SCALE+nextModel);
				t.run(args);
			} catch (IOException e) {
				Log.getLogger().log(Level.SEVERE, "Failed to create SVM model: " + e.getMessage());
			} 
		}
		synchronized(SVMSupport.class) {
			ACTIVE_MODEL = nextModel;
		}
		Log.getLogger().log(Level.FINE, "SVM train finished..");
		trained = true;
	}