com.arosbio.ml.metrics.plots.PlotMetric Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of confai Show documentation
Show all versions of confai Show documentation
Conformal AI package, including all data IO, transformations, machine learning models and predictor classes. Without inclusion of chemistry-dependent code.
/*
* Copyright (C) Aros Bio AB.
*
* CPSign is an Open Source Software that is dual licensed to allow you to choose a license that best suits your requirements:
*
* 1) GPLv3 (GNU General Public License Version 3) with Additional Terms, including an attribution clause as well as a limitation to use the software for commercial purposes.
*
* 2) CPSign Proprietary License that allows you to use CPSign for commercial activities, such as in a revenue-generating operation or environment, or integrate CPSign in your proprietary software without worrying about disclosing the source code of your proprietary software, which is required if you choose to use the software under GPLv3 license. See arosbio.com/cpsign/commercial-license for details.
*/
package com.arosbio.ml.metrics.plots;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import com.arosbio.ml.metrics.Metric;
import com.google.common.collect.ImmutableList;
public interface PlotMetric extends Metric {
public static final List DEFAULT_EVALUATION_POINTS = ImmutableList.of(0.,.1,.2,.3,.4,.5,.6,.7,.8,.9,1.);
public Plot2D buildPlot();
public PlotMetric clone();
public void setEvaluationPoints(List points);
public List getEvaluationPoints();
static String toString(PlotMetric m){
String n = m.getName();
if (n.toLowerCase().contains("plot"))
return String.format("%s builder", n);
return String.format("%s plot builder",n);
}
public static List sortAndValidateList(List points){
if (points==null || points.isEmpty())
throw new IllegalArgumentException("Evaluation points cannot be empty");
List sortedlist = new ArrayList<>(points);
Collections.sort(sortedlist);
if (sortedlist.get(0) < 0 || sortedlist.get(sortedlist.size()-1)>1)
throw new IllegalArgumentException("Evaluation points must be in the range [0..1]");
return sortedlist;
}
}