public void leavePercentageOutSplit(String filename, int percentage, boolean random) {
		List<UserData> trainLines = new ArrayList<UserData>();
		List<UserData> testLines = new ArrayList<UserData>();
		Set<Integer> indices = new HashSet<Integer>();
		int currentUser = -1, userIndex = -1, userSize = -1;
		for (int i = 0; i < this.reader.getUserLines().size(); i++) {
			UserData data = this.reader.getUserLines().get(i);
			if (currentUser != data.getUserID())  { // new user
				currentUser = data.getUserID();
				userSize = this.reader.getUserCounts().get(currentUser);
				userIndex = 1;
				indices.clear();
				int limit = (userSize - 1 < percentage ? userSize - 1 : percentage);
				if (random) {
					while (indices.size() < limit) {
						indices.add(1 + (int)(Math.random() * ((userSize - 1) + 1)));
					}
				} else {
					for (int index : getBestIndices(this.reader.getUserLines().subList(i, i + userSize), false)) {
						if (indices.size() < limit) {
							indices.add(index);
						} else {
							break;
						}
					}
				}
			}
			if (indices.contains(userIndex++)) {
				testLines.add(data);
			} else {
				trainLines.add(data);
			}
		}
		
		writeWikiSample(this.reader, trainLines, filename + "_train", null);
		writeWikiSample(this.reader, testLines, filename + "_test", null);
		trainLines.addAll(testLines);
		writeWikiSample(this.reader, trainLines, filename, null);
	}