stanfordnlp/CoreNLP · error · RuntimeException

convexComboFrac has to lie between 0 and 1 (both inclusive).

Error message

convexComboFrac has to lie between 0 and 1 (both inclusive).

What it means

Constructor validation in SemiSupervisedLogConditionalObjectiveFunction: the convexComboFrac used to blend the main and biased objective must be within [0,1]; values outside make the convex combination a non-convex extrapolation.

Solutions

  1. Pass a fraction between 0.0 and 1.0 inclusive
  2. Clamp the value before constructing the function
  3. Review code that computes the fraction dynamically
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/edu/stanford/nlp/classify/SemiSupervisedLogConditionalObjectiveFunction.java:57 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10). Data as JSON: /api/errors/2f2d1dc0630028a1. Report an issue: GitHub.

Appendix: source

Thrown at src/edu/stanford/nlp/classify/SemiSupervisedLogConditionalObjectiveFunction.java:57

    //value = objFunc.valueAt(x) + biasedObjFunc.valueAt(x);
    double[] d1 = objFunc.derivativeAt(x);
    double[] d2 = biasedObjFunc.derivativeAt(x);

    for (int i = 0; i < domainDimension(); i++) {
      derivative[i] = convexComboFrac*d1[i] + (1.0-convexComboFrac)*d2[i];
      //derivative[i] = d1[i] + d2[i];
    }
    if(prior != null)
      value += prior.compute(x, derivative);
  }

  public SemiSupervisedLogConditionalObjectiveFunction(AbstractCachingDiffFunction objFunc, AbstractCachingDiffFunction biasedObjFunc, LogPrior prior, double convexComboFrac) {
    this.objFunc = objFunc;
    this.biasedObjFunc = biasedObjFunc;
    this.prior = prior;
    this.convexComboFrac = convexComboFrac;    
    if(convexComboFrac < 0 || convexComboFrac > 1.0)
      throw new RuntimeException ("convexComboFrac has to lie between 0 and 1 (both inclusive).");
  }

  public SemiSupervisedLogConditionalObjectiveFunction(AbstractCachingDiffFunction objFunc, AbstractCachingDiffFunction biasedObjFunc, LogPrior prior) {
    //this.objFunc = objFunc;
    //this.biasedObjFunc = biasedObjFunc;
    //this.prior = prior;
    this(objFunc,biasedObjFunc,prior,0.5);
  }

}

View on GitHub (pinned to 1b7edd19c4)