本文整理汇总了Java中de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization类的典型用法代码示例。如果您正苦于以下问题:Java Parameterization类的具体用法?Java Parameterization怎么用?Java Parameterization使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Parameterization类属于de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization包,在下文中一共展示了Parameterization类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeOptions
import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization; //导入依赖的package包/类
@Override
protected void makeOptions(Parameterization config) {
super.makeOptions(config);
DoubleParameter t1P = new DoubleParameter(T1_ID);
if(config.grab(t1P)) {
t1 = t1P.doubleValue();
}
DoubleParameter t2P = new DoubleParameter(T2_ID);
if(config.grab(t2P)) {
t2 = t2P.doubleValue();
}
// Non-formalized parameter constraint: t1 >= t2
if(t1 < t2) {
config.reportError(new WrongParameterValueException("Parameter " + t1P.getName() + " should be at least " + t2P.getName()));
}
}
示例2: makeOptions
import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization; //导入依赖的package包/类
@Override
protected void makeOptions(Parameterization config) {
super.makeOptions(config);
ObjectParameter<Uncertainifier<?>> innerP = new ObjectParameter<>(INNER_ID, Uncertainifier.class);
if(config.grab(innerP)) {
inner = innerP.instantiateClass(config);
if(inner instanceof AbstractDiscreteUncertainifier) {
LoggingUtil.warning("Using a discrete uncertainifier inside a discrete uncertainifier is likely a configuration error, and is likely to produce too many duplicate points. Did you mean to use a uniform or gaussian distribution instead?");
}
}
IntParameter pmultMax = new IntParameter(MULT_MAX_ID, DEFAULT_SAMPLE_SIZE);
if(config.grab(pmultMax)) {
maxQuant = pmultMax.intValue();
}
IntParameter pmultMin = new IntParameter(MULT_MIN_ID) //
.setOptional(true);
minQuant = config.grab(pmultMin) ? pmultMin.intValue() : maxQuant;
}
示例3: makeOptions
import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization; //导入依赖的package包/类
@Override
protected void makeOptions(Parameterization config) {
super.makeOptions(config);
DoubleParameter minP = new DoubleParameter(MIN_ID).setOptional(true);
if(config.grab(minP)) {
min = minP.getValue();
}
DoubleParameter maxP = new DoubleParameter(MAX_ID).setOptional(true);
if(config.grab(maxP)) {
max = maxP.getValue();
}
if(!minP.isDefined() && !maxP.isDefined()) {
Flag meanF = new Flag(MEAN_ID);
if(config.grab(meanF)) {
usemean = meanF.getValue();
}
}
Flag nozerosF = new Flag(NOZEROS_ID);
if(config.grab(nozerosF)) {
nozeros = nozerosF.getValue();
}
}
示例4: makeOptions
import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization; //导入依赖的package包/类
@Override
protected void makeOptions(Parameterization config) {
super.makeOptions(config);
DoubleParameter logmeanP = new DoubleParameter(LOGMEAN_ID);
if(config.grab(logmeanP)) {
logmean = logmeanP.doubleValue();
}
DoubleParameter logsigmaP = new DoubleParameter(LOGSTDDEV_ID);
logsigmaP.addConstraint(CommonConstraints.GREATER_THAN_ZERO_DOUBLE);
if(config.grab(logsigmaP)) {
logsigma = logsigmaP.doubleValue();
}
DoubleParameter shiftP = new DoubleParameter(SHIFT_ID, 0.);
if(config.grab(shiftP)) {
shift = shiftP.doubleValue();
}
}
示例5: makeOptions
import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization; //导入依赖的package包/类
@Override
protected void makeOptions(Parameterization config) {
super.makeOptions(config);
IntParameter kP = new IntParameter(K_ID) //
.addConstraint(CommonConstraints.GREATER_EQUAL_ONE_INT);
if(config.grab(kP)) {
k = kP.getValue();
}
DoubleParameter percentageP = new DoubleParameter(SAMPLING_ID, 1.) //
.addConstraint(CommonConstraints.GREATER_THAN_ZERO_DOUBLE);
if(config.grab(percentageP)) {
percentage = percentageP.getValue();
}
RandomParameter randomP = new RandomParameter(SEED_ID);
if(config.grab(randomP)) {
rnd = randomP.getValue();
}
}
示例6: makeOptions
import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization; //导入依赖的package包/类
@Override
protected void makeOptions(Parameterization config) {
super.makeOptions(config);
IntParameter kP = new IntParameter(K_ID);
kP.addConstraint(CommonConstraints.GREATER_EQUAL_ONE_INT);
if(config.grab(kP)) {
settings.kmax = kP.getValue();
}
IntParameter pP = new IntParameter(P_ID);
pP.addConstraint(CommonConstraints.GREATER_EQUAL_ONE_INT);
if(config.grab(pP)) {
settings.p = pP.getValue();
}
Flag nologF = new Flag(NOLOG_ID);
if(config.grab(nologF)) {
settings.log = !nologF.getValue();
}
}
示例7: makeOptions
import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization; //导入依赖的package包/类
@Override
protected void makeOptions(Parameterization config) {
super.makeOptions(config);
DoubleParameter locationP = new DoubleParameter(LOCATION_ID);
if(config.grab(locationP)) {
location = locationP.doubleValue();
}
DoubleParameter scaleP = new DoubleParameter(SCALE_ID);
if(config.grab(scaleP)) {
scale = scaleP.doubleValue();
}
DoubleParameter shapeP = new DoubleParameter(SHAPE_ID);
if(config.grab(shapeP)) {
shape = shapeP.doubleValue();
}
}
示例8: makeOptions
import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization; //导入依赖的package包/类
@Override
protected void makeOptions(Parameterization config) {
super.makeOptions(config);
ObjectParameter<LocalitySensitiveHashFunctionFamily<? super V>> familyP = new ObjectParameter<>(FAMILY_ID, LocalitySensitiveHashFunctionFamily.class);
if(config.grab(familyP)) {
family = familyP.instantiateClass(config);
}
IntParameter lP = new IntParameter(L_ID);
lP.addConstraint(CommonConstraints.GREATER_EQUAL_ONE_INT);
if(config.grab(lP)) {
l = lP.intValue();
}
IntParameter bucketsP = new IntParameter(BUCKETS_ID);
bucketsP.setDefaultValue(7919); // Primes work best, apparently.
bucketsP.addConstraint(CommonConstraints.GREATER_THAN_ONE_INT);
if(config.grab(bucketsP)) {
numberOfBuckets = bucketsP.intValue();
}
}
示例9: makeOptions
import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization; //导入依赖的package包/类
@Override
protected void makeOptions(Parameterization config) {
super.makeOptions(config);
ObjectListParameter<SpatialSorter> curveP = new ObjectListParameter<>(CURVES_ID, SpatialSorter.class);
if(config.grab(curveP)) {
curvegen = curveP.instantiateClasses(config);
}
DoubleParameter windowP = new DoubleParameter(WINDOW_ID, 10.0);
if(config.grab(windowP)) {
window = windowP.getValue();
}
IntParameter variantsP = new IntParameter(VARIANTS_ID, 1);
variantsP.addConstraint(CommonConstraints.GREATER_EQUAL_ONE_INT);
if(config.grab(variantsP)) {
variants = variantsP.getValue();
}
RandomParameter randomP = new RandomParameter(RANDOM_ID);
if(config.grab(randomP)) {
random = randomP.getValue();
}
}
示例10: makeOptions
import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization; //导入依赖的package包/类
@Override
protected void makeOptions(Parameterization config) {
// The super class has the distance function parameter!
super.makeOptions(config);
IntParameter kP = new IntParameter(K_ID) //
.addConstraint(CommonConstraints.GREATER_THAN_ONE_INT);
if(config.grab(kP)) {
k = kP.getValue();
}
DoubleParameter deltaP = new DoubleParameter(DELTA_ID) //
.setDefaultValue(1.1) //
.addConstraint(CommonConstraints.GREATER_THAN_ONE_DOUBLE);
if(config.grab(deltaP)) {
delta = deltaP.getValue();
}
}
示例11: makeOptions
import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization; //导入依赖的package包/类
@Override
protected void makeOptions(Parameterization config) {
super.makeOptions(config);
Flag absoluteF = new Flag(EIGENPAIR_FILTER_ABSOLUTE);
if(config.grab(absoluteF)) {
absolute = absoluteF.isTrue();
}
DoubleParameter deltaP = new DoubleParameter(EIGENPAIR_FILTER_DELTA) //
.addConstraint(CommonConstraints.GREATER_EQUAL_ZERO_DOUBLE);
// Conditional Constraint:
// delta must be >= 0 and <= 1 if it's a relative value
// also, the default value only makes sense as relative delta.
if(!absolute) {
deltaP.setDefaultValue(DEFAULT_DELTA)//
.addConstraint(CommonConstraints.LESS_EQUAL_ONE_DOUBLE);
}
if(config.grab(deltaP)) {
delta = deltaP.doubleValue();
}
}
示例12: makeOptions
import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization; //导入依赖的package包/类
@Override
protected void makeOptions(Parameterization config) {
super.makeOptions(config);
final IntParameter mP = new IntParameter(HiCS.Parameterizer.M_ID, 50);
mP.addConstraint(CommonConstraints.GREATER_THAN_ONE_INT);
if(config.grab(mP)) {
m = mP.intValue();
}
final DoubleParameter alphaP = new DoubleParameter(HiCS.Parameterizer.ALPHA_ID, 0.1);
alphaP.addConstraint(CommonConstraints.GREATER_THAN_ZERO_DOUBLE);
if(config.grab(alphaP)) {
alpha = alphaP.doubleValue();
}
final ObjectParameter<GoodnessOfFitTest> testP = new ObjectParameter<>(HiCS.Parameterizer.TEST_ID, GoodnessOfFitTest.class, KolmogorovSmirnovTest.class);
if(config.grab(testP)) {
statTest = testP.instantiateClass(config);
}
final RandomParameter rndP = new RandomParameter(HiCS.Parameterizer.SEED_ID);
if(config.grab(rndP)) {
rnd = rndP.getValue();
}
}
示例13: makeOptions
import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization; //导入依赖的package包/类
@Override
protected void makeOptions(Parameterization config) {
super.makeOptions(config);
EnumParameter<Mode> modeP = new EnumParameter<>(MODE_ID, Mode.class, Mode.VORONOI);
if(config.grab(modeP)) {
mode = modeP.getValue();
}
}
示例14: make
import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization; //导入依赖的package包/类
/**
* Method to configure a class, then instantiate when the configuration step
* was successful.
*
* <b>Don't call this directly use unless you know what you are doing. <br />
* Instead, use {@link Parameterization#tryInstantiate(Class)}!</b>
*
* Otherwise, {@code null} will be returned, and the resulting errors can be
* retrieved from the {@link Parameterization} parameter object. In general,
* you should be checking the {@link Parameterization} object for errors
* before accessing the returned value, since it may be {@code null}
* unexpectedly otherwise.
*
* @param config Parameterization
* @return Instance or {@code null}
*/
public final Object make(Parameterization config) {
if(state != STATE_FRESH) {
throw new AbortException("Parameterizers may only be used once!");
}
state = STATE_INIT;
Object owner = this.getClass().getDeclaringClass();
if(owner == null) {
owner = this;
}
config = config.descend(owner);
makeOptions(config);
if(!config.hasErrors()) {
state = STATE_COMPLETE;
Object ret = makeInstance();
if(ret == null) {
throw new AbortException("makeInstance() returned null!", new Throwable());
}
return ret;
}
else {
state = STATE_ERRORS;
return null;
}
}
示例15: makeOptions
import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization; //导入依赖的package包/类
@Override
protected void makeOptions(Parameterization config) {
super.makeOptions(config);
IntParameter dimP = new IntParameter(DIM_P)//
.setOptional(true)//
.addConstraint(CommonConstraints.GREATER_EQUAL_ONE_INT);
dim = config.grab(dimP) ? dimP.intValue() : -1;
}