Type[] handler_type_parms = ((ParameterizedType)(clz.getGenericSuperclass())).getActualTypeArguments();
// [0] is the Model type; [1] is the Model.Parameters type; [2] is the Model.Output type.
Class<? extends Model.Parameters> pclz = (Class<? extends Model.Parameters>)handler_type_parms[1];
ModelBuilder modelbuilder = clz.getDeclaredConstructor(new Class[] { (Class)handler_type_parms[1] }).newInstance(pclz.newInstance());
m.model_builders.put(algo, modelbuilder);
}
catch (Exception e) {
throw H2O.fail("Exception when trying to instantiate ModelBuilder for: " + entry.getKey() + ": " + e);
}