All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.expleague.ml.methods.greedyMergeOptimization.RegularizedLossComparator Maven / Gradle / Ivy

There is a newer version: 1.4.9
Show newest version
package com.expleague.ml.methods.greedyMergeOptimization;

import java.util.Comparator;

/**
 * Created by noxoomo on 30/11/14.
 */
public class RegularizedLossComparator> implements ModelComparators {
  Loss loss;

  public RegularizedLossComparator(final Loss loss) {
    this.loss = loss;
  }

  @Override
  public Comparator regularizationComparator() {
    return new Comparator() {
      @Override
      public int compare(final Model left, final Model right) {
        return Double.compare(loss.regularization(left), loss.regularization(right));
      }
    };
  }

  @Override
  public Comparator targetComparator() {
    return new Comparator() {
      @Override
      public int compare(final Model left, final Model right) {
        return Double.compare(loss.target(left), loss.target(right));
      }
    };
  }

  @Override
  public Comparator scoreComparator() {
    return new Comparator() {
      @Override
      public int compare(final Model left, final Model right) {
        return Double.compare(loss.score(left), loss.score(right));
      }
    };
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy