Column Name Model¶
Contains class for column name data labeling model.
- class dataprofiler.labelers.column_name_model.ColumnNameModel(label_mapping=None, parameters=None)¶
Bases:
dataprofiler.labelers.base_model.BaseModel
Class for column name data labeling model.
Initialize function for ColumnNameModel.
- Parameters
parameters (dict) –
Contains all the appropriate parameters for the model. Possible parameters are:
max_length, max_num_chars, dim_embed
- Returns
None
- reset_weights()¶
Reset weights function.
- predict(data, batch_size=None, show_confidences=False, verbose=True)¶
Apply the process.cdist for similarity score on input list of strings.
- Parameters
data (iterator) – list of strings to predict upon
batch_size (N/A) – does not impact this model and should be fixed to not be required.
show_confidences – Parameter disabled. Confidence values returned by default.
verbose (bool) – Flag to determine whether to print status or not
- Returns
char level predictions and confidences
- Return type
dict
- classmethod load_from_disk(dirpath)¶
Load whole model from disk with weights.
- Parameters
dirpath (str) – directory path where you want to load the model from
- Returns
None
- save_to_disk(dirpath)¶
Save whole model to disk with weights.
- Parameters
dirpath (str) – directory path where you want to save the model to
- Returns
None
- add_label(label: str, same_as: Optional[str] = None) None ¶
Add a label to the data labeler.
- Parameters
label (str) – new label being added to the data labeler
same_as (str) – label to have the same encoding index as for multi-label to single encoding index.
- Returns
None
- classmethod get_class(class_name: str) Optional[Type[dataprofiler.labelers.base_model.BaseModel]] ¶
Get subclasses.
- get_parameters(param_list: Optional[List[str]] = None) Dict ¶
Return a dict of parameters from the model given a list.
- Parameters
param_list (List[str]) – list of parameters to retrieve from the model.
- Returns
dict of parameters
- classmethod help() None ¶
Help describe alterable parameters.
- Returns
None
- property label_mapping: Dict[str, int]¶
Return mapping of labels to their encoded values.
- property labels: List[str]¶
Retrieve the label.
- Returns
list of labels
- property num_labels: int¶
Return max label mapping.
- requires_zero_mapping: bool = False¶
- property reverse_label_mapping: Dict[int, str]¶
Return reversed order of current labels.
Useful for when needed to extract Labels via indices.
- set_label_mapping(label_mapping: Union[List[str], Dict[str, int]]) None ¶
Set the labels for the model.
- Parameters
label_mapping (Union[list, dict]) – label mapping of the model or list of labels to be converted into the label mapping
- Returns
None
- set_params(**kwargs: Any) None ¶
Set the parameters if they exist given kwargs.