Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: a67102ee65
Fetching contributors…

Cannot retrieve contributors at this time

50 lines (39 sloc) 1.737 kb
@comment{
Copyright 2011 JBoss Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
}
@comment{
Sets to missing the derived field, if the original value does not fall within one of the given intervals
/**
* @param name - derived field name
* @param origField - the field to alias
* @param bins - the DiscretizeBin collection (pmml)
* @param target - the value associated to the bin
*/
}
@declare{'outOfBinningMissingRule'}
rule "noBinMissing_@{name}"
@if{ isInnerFieldName( name ) } @@activationListener('direct') @end{}
when
$in : @{origField}( valid == true, missing == false,
@foreach{ bin : bins } (value @if{bin.interval.closure.startsWith("closed")}<@else{}<=@end{} @{bin.interval.leftMargin} || value @if{bin.interval.closure.endsWith("Closed")}>@else{}>=@end{} @{bin.interval.rightMargin}) @end{' && '}
@if{ context != null } , context == @{format("string",context)} @end{} )
then
@{name} x = new @{name}();
x.setValue(null);
x.setMissing(true);
x.setValid(true);
x.setName(@{format("string",name)});
x.setContext(@{context});
insertLogical(x);
end
@end{}
@includeNamed{'outOfBinningMissingRule'}
Jump to Line
Something went wrong with that request. Please try again.