def buildRecommender(data_model)
      begin
        case @similarity_name
          when "PearsonCorrelationSimilarity"
            similarity = (@is_weighted) ? PearsonCorrelationSimilarity.new(data_model, Weighting::WEIGHTED) : PearsonCorrelationSimilarity.new(data_model)
          when "EuclideanDistanceSimilarity"
            similarity = (@is_weighted) ? EuclideanDistanceSimilarity.new(data_model, Weighting::WEIGHTED) : EuclideanDistanceSimilarity.new(data_model)
          when "SpearmanCorrelationSimilarity"
            similarity = SpearmanCorrelationSimilarity.new(data_model)
          when "LogLikelihoodSimilarity"
            similarity = LogLikelihoodSimilarity.new(data_model)
          when "TanimotoCoefficientSimilarity"
            similarity = TanimotoCoefficientSimilarity.new(data_model)
          when "GenericItemSimilarity"
            similarity = PearsonCorrelationSimilarity.new(data_model, Weighting::WEIGHTED)
          else
            similarity = nil
        end

        unless @neighborhood_size.nil?
          if @neighborhood_size > 1
            neighborhood = NearestNUserNeighborhood.new(Integer(@neighborhood_size), similarity, data_model)
          elsif @neighborhood_size >= -1 and @neighborhood_size <= 1
            neighborhood = ThresholdUserNeighborhood.new(Float(@neighborhood_size), similarity, data_model)
          end
        end

        case @recommender_name
          when "GenericUserBasedRecommender"
            recommender = GenericUserBasedRecommender.new(data_model, neighborhood, similarity)
          when "GenericItemBasedRecommender"
            recommender = (@item_based_allowed) ? GenericItemBasedRecommender.new(data_model, similarity) : nil
          when "SlopeOneRecommender"
            recommender = SlopeOneRecommender.new(data_model)
          else
            recommender = nil
        end

        recommender
      rescue Exception => e
        return e
      end
    end
def buildRecommender(data_model)
      begin
        case @similarity_name
          when "PearsonCorrelationSimilarity"
            similarity = (@is_weighted) ? PearsonCorrelationSimilarity.new(data_model, Weighting::WEIGHTED) : PearsonCorrelationSimilarity.new(data_model)
          when "EuclideanDistanceSimilarity"
            similarity = (@is_weighted) ? EuclideanDistanceSimilarity.new(data_model, Weighting::WEIGHTED) : EuclideanDistanceSimilarity.new(data_model)
          when "SpearmanCorrelationSimilarity"
            similarity = SpearmanCorrelationSimilarity.new(data_model)
          when "LogLikelihoodSimilarity"
            similarity = LogLikelihoodSimilarity.new(data_model)
          when "TanimotoCoefficientSimilarity"
            similarity = TanimotoCoefficientSimilarity.new(data_model)
          when "GenericItemSimilarity"
            similarity = PearsonCorrelationSimilarity.new(data_model, Weighting::WEIGHTED)
          else
            similarity = nil
        end

        unless @neighborhood_size.nil?
          if @neighborhood_size > 1
            neighborhood = NearestNUserNeighborhood.new(Integer(@neighborhood_size), similarity, data_model)
          elsif @neighborhood_size >= -1 and @neighborhood_size <= 1
            neighborhood = ThresholdUserNeighborhood.new(Float(@neighborhood_size), similarity, data_model)
          end
        end

        case @recommender_name
          when "GenericUserBasedRecommender"
            recommender = GenericUserBasedRecommender.new(data_model, neighborhood, similarity)
          when "GenericItemBasedRecommender"
            recommender = (@item_based_allowed) ? GenericItemBasedRecommender.new(data_model, similarity) : nil
          when "SlopeOneRecommender"
            recommender = SlopeOneRecommender.new(data_model)
          else
            recommender = nil
        end

        recommender
      rescue Exception => e
        return e
      end
    end
public interface RecommenderBuilder
 Implementations of this inner interface are simple helper classes which create a Recommender to be evaluated based on the given DataModel.
 buildRecommender(DataModel dataModel)
 Builds a Recommender implementation to be evaluated, using the given DataModel.