View source on GitHub |
Gradient Boosted Tree model builder.
Inherits From: AbstractDecisionForestBuilder
, AbstractBuilder
tfdf.builder.GradientBoostedTreeBuilder(
path: str,
objective: tfdf.py_tree.objective.AbstractObjective
,
bias: Optional[float] = 0.0,
model_format: Optional[tfdf.builder.ModelFormat
] = tfdf.builder.ModelFormat.TENSORFLOW_SAVED_MODEL
,
import_dataspec: Optional[data_spec_pb2.DataSpecification] = None,
input_signature_example_fn: Optional[tf_core.InputModelSignatureFn] = tfdf.keras.build_default_input_model_signature
,
file_prefix: Optional[str] = None,
verbose: int = 1,
advanced_arguments: Optional[tfdf.builder.AdvancedArguments
] = None,
keras_model_name: Optional[str] = None
)
Attributes | |
---|---|
dataspec
|
Dataspec, possibly partially constructed.
Can be called before |
objective
|
Objective of the model. |
Methods
add_tree
add_tree(
tree: tfdf.py_tree.tree.Tree
)
Adds one tree to the model.
check_leaf
check_leaf(
node: tfdf.py_tree.node.LeafNode
)
Called on all the leaf nodes during the export.
check_non_leaf
check_non_leaf(
node: tfdf.py_tree.node.NonLeafNode
)
Called on all the non-leaf nodes during the export.
close
close()
Finalize the builder work.
This method should be called last.
get_dictionary
get_dictionary(
col_name: str
) -> List[str]
Gets the dictionary of a categorical(-set) string feature.
model_type
model_type() -> str
Unique key describing the type of the model.
observe_feature
observe_feature(
feature: tfdf.inspector.SimpleColumnSpec
,
categorical_values: Optional[Union[List[str], List[int]]] = None
)
Register a feature and some of its possible value.
Generally, users don't need to call this function. An example of advanced exception is if a model does not refer to a specific possible categorical value, and if this value should be treated differently than out-of-vocabulary values.
Should be called at least once on each of the model input features.
If called multiple times with categorical_values
the set of possible
values will be the union of the categorical_values
s.
Args | |
---|---|
feature
|
Definition of the feature. |
categorical_values
|
Set of observed values. Only for categorical-like features. |
set_dictionary
set_dictionary(
col_name: str, dictionary: List[str]
) -> None
Sets the dictionary of a categorical or categorical-set column.
specialized_header
specialized_header() -> Any
Gets the specialized header of the model.
specialized_header_filename
specialized_header_filename() -> str
Gets the filename of the specialized header.
yggdrasil_model_path
yggdrasil_model_path()
Gets the path to the destination yggdrasil model.