class RecommendationTrainer {

    public RecommendationModel<Serializable, Serializable> fit(DatasetBuilder<Object, BinaryObject> datasetBuilder,
        String objFieldName, String subjFieldName, String ratingFieldName) {
        try (Dataset<EmptyContext, RecommendationDatasetData<Serializable, Serializable>> dataset = datasetBuilder.build(
            environmentBuilder,
            new EmptyContextBuilder<>(),
            new RecommendationBinaryDatasetDataBuilder(objFieldName, subjFieldName, ratingFieldName),
            trainerEnvironment
        )) {
            return train(dataset);
        }
        catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

}