@Override
	public GLM build(Instances trainSet, Family family) {
		if (groups == null) {
			throw new IllegalArgumentException("Groups are not set.");
		}
		GLM glm = null;
		if (maxNumIters < 0) {
			maxNumIters = 20;
		}
		switch (family) {
			case GAUSSIAN:
				glm = buildGaussianRegressor(trainSet, groups, maxNumIters, lambda);
				break;
			case BINOMIAL:
				glm = buildClassifier(trainSet, groups, maxNumIters, lambda);
				break;
			default:
				throw new IllegalArgumentException("Unsupported family: " + family);
		}
		return glm;
	}