New! Use Simple ML for Sheets to apply machine learning to the data in your Google Sheets
Read More
tfdf.builder.AbstractBuilder
Stay organized with collections
Save and categorize content based on your preferences.
Generic model builder.
tfdf.builder.AbstractBuilder(
path: str,
objective: tfdf.py_tree.objective.AbstractObjective
,
model_format: Optional[tfdf.builder.ModelFormat
],
import_dataspec: Optional[data_spec_pb2.DataSpecification],
input_model_signature_fn: Optional[tf_core.InputModelSignatureFn],
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 close for advanced model edition.
|
objective
|
Objective of the model.
|
Methods
close
View source
close()
Finalize the builder work.
This method should be called last.
get_dictionary
View source
get_dictionary(
col_name: str
) -> List[str]
Gets the dictionary of a categorical(-set) string feature.
model_type
View source
@abc.abstractmethod
model_type() -> str
Unique key describing the type of the model.
observe_feature
View source
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
View source
set_dictionary(
col_name: str, dictionary: List[str]
) -> None
Sets the dictionary of a categorical or categorical-set column.
yggdrasil_model_path
View source
yggdrasil_model_path()
Gets the path to the destination yggdrasil model.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-04-26 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-04-26 UTC."],[],[],null,["# tfdf.builder.AbstractBuilder\n\n\u003cbr /\u003e\n\n|------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/decision-forests/blob/main/tensorflow_decision_forests/component/builder/builder.py#L182-L581) |\n\nGeneric model builder. \n\n tfdf.builder.AbstractBuilder(\n path: str,\n objective: ../../tfdf/py_tree/objective/AbstractObjective,\n model_format: Optional[../../tfdf/builder/ModelFormat],\n import_dataspec: Optional[data_spec_pb2.DataSpecification],\n input_model_signature_fn: Optional[tf_core.InputModelSignatureFn],\n file_prefix: Optional[str] = None,\n verbose: int = 1,\n advanced_arguments: Optional[../../tfdf/builder/AdvancedArguments] = None,\n keras_model_name: Optional[str] = None\n )\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Attributes ---------- ||\n|-------------|-----------------------------------------------------------------------------------------------------------|\n| `dataspec` | Dataspec, possibly partially constructed. \u003cbr /\u003e Can be called before `close` for advanced model edition. |\n| `objective` | Objective of the model. |\n\n\u003cbr /\u003e\n\nMethods\n-------\n\n### `close`\n\n[View source](https://github.com/tensorflow/decision-forests/blob/main/tensorflow_decision_forests/component/builder/builder.py#L229-L283) \n\n close()\n\nFinalize the builder work.\n\nThis method should be called last.\n\n### `get_dictionary`\n\n[View source](https://github.com/tensorflow/decision-forests/blob/main/tensorflow_decision_forests/component/builder/builder.py#L381-L391) \n\n get_dictionary(\n col_name: str\n ) -\u003e List[str]\n\nGets the dictionary of a categorical(-set) string feature.\n\n### `model_type`\n\n[View source](https://github.com/tensorflow/decision-forests/blob/main/tensorflow_decision_forests/component/builder/builder.py#L297-L301) \n\n @abc.abstractmethod\n model_type() -\u003e str\n\nUnique key describing the type of the model.\n\n### `observe_feature`\n\n[View source](https://github.com/tensorflow/decision-forests/blob/main/tensorflow_decision_forests/component/builder/builder.py#L419-L482) \n\n observe_feature(\n feature: ../../tfdf/inspector/SimpleColumnSpec,\n categorical_values: Optional[Union[List[str], List[int]]] = None\n )\n\nRegister a feature and some of its possible value.\n\nGenerally, users don't need to call this function. An example of advanced\nexception is if a model does not refer to a specific possible categorical\nvalue, and if this value should be treated differently than\nout-of-vocabulary values.\n\nShould be called at least once on each of the model input features.\nIf called multiple times with `categorical_values` the set of possible\nvalues will be the union of the `categorical_values`s.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|----------------------|-------------------------------------------------------------|\n| `feature` | Definition of the feature. |\n| `categorical_values` | Set of observed values. Only for categorical-like features. |\n\n\u003cbr /\u003e\n\n### `set_dictionary`\n\n[View source](https://github.com/tensorflow/decision-forests/blob/main/tensorflow_decision_forests/component/builder/builder.py#L393-L417) \n\n set_dictionary(\n col_name: str, dictionary: List[str]\n ) -\u003e None\n\nSets the dictionary of a categorical or categorical-set column.\n\n### `yggdrasil_model_path`\n\n[View source](https://github.com/tensorflow/decision-forests/blob/main/tensorflow_decision_forests/component/builder/builder.py#L285-L295) \n\n yggdrasil_model_path()\n\nGets the path to the destination yggdrasil model."]]