{"record":{"id":"2f2d1dc0630028a1","repo":"stanfordnlp/CoreNLP","slug":"convexcombofrac-has-to-lie-between-0-and-1-both-i","errorCode":null,"errorMessage":"convexComboFrac has to lie between 0 and 1 (both inclusive).","messagePattern":"convexComboFrac has to lie between 0 and 1 \\(both inclusive\\)\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/classify/SemiSupervisedLogConditionalObjectiveFunction.java","lineNumber":57,"sourceCode":"    //value = objFunc.valueAt(x) + biasedObjFunc.valueAt(x);\n    double[] d1 = objFunc.derivativeAt(x);\n    double[] d2 = biasedObjFunc.derivativeAt(x);\n\n    for (int i = 0; i < domainDimension(); i++) {\n      derivative[i] = convexComboFrac*d1[i] + (1.0-convexComboFrac)*d2[i];\n      //derivative[i] = d1[i] + d2[i];\n    }\n    if(prior != null)\n      value += prior.compute(x, derivative);\n  }\n\n  public SemiSupervisedLogConditionalObjectiveFunction(AbstractCachingDiffFunction objFunc, AbstractCachingDiffFunction biasedObjFunc, LogPrior prior, double convexComboFrac) {\n    this.objFunc = objFunc;\n    this.biasedObjFunc = biasedObjFunc;\n    this.prior = prior;\n    this.convexComboFrac = convexComboFrac;    \n    if(convexComboFrac < 0 || convexComboFrac > 1.0)\n      throw new RuntimeException (\"convexComboFrac has to lie between 0 and 1 (both inclusive).\");\n  }\n\n  public SemiSupervisedLogConditionalObjectiveFunction(AbstractCachingDiffFunction objFunc, AbstractCachingDiffFunction biasedObjFunc, LogPrior prior) {\n    //this.objFunc = objFunc;\n    //this.biasedObjFunc = biasedObjFunc;\n    //this.prior = prior;\n    this(objFunc,biasedObjFunc,prior,0.5);\n  }\n\n}\n","sourceCodeStart":39,"sourceCodeEnd":68,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/classify/SemiSupervisedLogConditionalObjectiveFunction.java#L39-L68","documentation":"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.","triggerScenarios":"Thrown at src/edu/stanford/nlp/classify/SemiSupervisedLogConditionalObjectiveFunction.java:57 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a fraction between 0.0 and 1.0 inclusive","Clamp the value before constructing the function","Review code that computes the fraction dynamically"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}