c = new Clustering<>("Outlier threshold clustering", "threshold-clustering");
for(int i = 0; i <= threshold.length; i++) {
String name = (i == 0) ? "Inlier" : "Outlier_" + threshold[i - 1];
c.addToplevelCluster(new Cluster<>(name, idlists.get(i), (i > 0)));
}
return c;
}
/**
* Parameterization helper
*
* @author Erich Schubert
*
* @apiviz.exclude
*/
public static class Parameterizer extends AbstractParameterizer {
/**
* Parameter to specify a scaling function to use.
*
* Key: {@code -thresholdclust.scaling}
*
*/
public static final OptionID SCALING_ID = new OptionID("thresholdclust.scaling", "Class to use as scaling function.");
/**
* Parameter to specify the threshold
*
* Key: {@code -thresholdclust.threshold}
*
*/
public static final OptionID THRESHOLD_ID = new OptionID("thresholdclust.threshold", "Threshold(s) to apply.");
/**
* Scaling function to use
*/
ScalingFunction scaling = null;
/**
* Threshold to use
*/
double[] threshold;
@Override
protected void makeOptions(Parameterization config) {
super.makeOptions(config);
ObjectParameter scalingP = new ObjectParameter<>(SCALING_ID, ScalingFunction.class, IdentityScaling.class);
if(config.grab(scalingP)) {
scaling = scalingP.instantiateClass(config);
}
DoubleListParameter thresholdP = new DoubleListParameter(THRESHOLD_ID);
if(config.grab(thresholdP)) {
threshold = ArrayLikeUtil.toPrimitiveDoubleArray(thresholdP.getValue());
}
}
@Override
protected OutlierThresholdClustering makeInstance() {
return new OutlierThresholdClustering(scaling, threshold);
}
}
}