public static PositionSpecificFeature randomlyGenerate( int windowFrom, int windowTo, Random rand, ApplicationData applicationData) { int positionFrom = Feature.randomBetween(windowFrom, windowTo, rand); // here, i limit the max size of ps feature to 15 but i will allow it to increase with Mutation // and Crossover int max = positionFrom + 15; if (max > windowTo) max = windowTo; int positionTo = Feature.randomBetween(positionFrom, max, rand); String featureName = "P_" + positionFrom + "_" + positionTo; int physio2 = rand.nextInt(Physiochemical2.codingNameList.length); for (int x = positionFrom; x <= positionTo; x++) { if (applicationData.isLocationIndexMinusOne == false && x == 0) continue; featureName += "_"; // featureName += removeRepeats(PositionSpecificFeature.physiochemical2Gram(rand, physio2)); } featureName += "_" + physio2; return new PositionSpecificFeature(featureName); }
private Feature changeLocation( Random rand, int positionFrom, int positionTo, List<String> stringList, int p2, int windowMin, int windowMax) { int windowSize = (windowMax - windowMin) + 1; while (stringList.size() > windowSize) this.remove(rand, positionFrom, positionTo, stringList, p2); do positionFrom = Feature.randomBetween(windowMin, windowMax, rand); while (positionFrom + stringList.size() - 1 > windowMax); positionTo = positionFrom + stringList.size() - 1; return this.stringToPositionSpecificFeature(positionFrom, positionTo, stringList, p2); }