Skip to content

Commit

Permalink
Refined exception messages
Browse files Browse the repository at this point in the history
  • Loading branch information
vruusmann committed Jun 17, 2024
1 parent 326f343 commit 00fc100
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pmml-rexp/src/main/java/org/jpmml/rexp/MaxLikConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public void encodeSchema(RExpEncoder encoder){

RFunctionCall settings = this.settings;
if(settings == null){
throw new IllegalArgumentException();
throw new IllegalArgumentException("Invalid \'apollo_probabilities\' element. Missing model settings (variable \'" + modelType.toLowerCase() + "_settings\')");
}

Map<String, RExp> settingsMap = parseList(settings, (value) -> value);
Expand All @@ -132,11 +132,11 @@ public void encodeSchema(RExpEncoder encoder){
Map<?, RFunctionCall> utilityFunctions = this.utilityFunctions;

if(utilityFunctions.isEmpty()){
throw new IllegalArgumentException();
throw new IllegalArgumentException("Invalid \'apollo_probabilities\' element. Missing utility function set (variable \'V\')");
} else

if(!(new LinkedHashSet<>(choices)).equals(utilityFunctions.keySet())){
throw new IllegalArgumentException();
throw new IllegalArgumentException("Invalid \'apollo_probabilities\' element. Invalid utility function set");
}

DataField choiceField = encoder.createDataField(choiceVar.getValue(), OpType.CATEGORICAL, TypeUtil.getDataType(choices, DataType.STRING), choices);
Expand Down Expand Up @@ -215,13 +215,13 @@ public Feature apply(RExp rexp){
Map<?, RFunctionCall> nlStructures = this.nlStructures;

if(nlNests == null){
throw new IllegalArgumentException();
throw new IllegalArgumentException("Invalid \'apollo_probabilities\' element. Missing nest lambda parameters (variable \'nlNests\')");
}

Map<?, Number> lambdas = parseLambdas(nlNests, estimates);

if(nlStructures.isEmpty()){
throw new IllegalArgumentException();
throw new IllegalArgumentException("Invalid \'apollo_probabilities\' element. Missing nest structure (variable \'nlStructure\')");
} // End if

List<?> nestCHoices = new ArrayList<>(nlStructures.keySet());
Expand Down

0 comments on commit 00fc100

Please sign in to comment.