blob: 625898d16e3600bb155b9d570d83c95b1d54a2f3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.searchlib.gbdt;
import com.yahoo.searchlib.rankingexpression.evaluation.DoubleValue;
import com.yahoo.searchlib.rankingexpression.evaluation.Value;
import java.util.Arrays;
import java.util.Optional;
/**
* A GBDT node representing a set inclusion test: feature IN [value-list] where values can be strings or numbers.
*
* @author bratseth
*/
public final class CategoryFeatureNode extends FeatureNode {
private final Value[] values;
public CategoryFeatureNode(String feature, Value[] values, Optional<Integer> samples, TreeNode left, TreeNode right) {
super(feature, samples, left, right);
this.values = Arrays.copyOf(values, values.length);
}
/** Returns a copy of the array of values in this */
public Value[] values() {
return Arrays.copyOf(values, values.length);
}
@Override
protected String rankingExpressionCondition() {
return " in " + Arrays.toString(values);
}
}
|