icat.anchors.TFIDFAnchor#
- class icat.anchors.TFIDFAnchor(container=None, *args, **kwargs)#
Bases:
SimilarityAnchorBase
A similarity anchor that uses cosine similarity between the TF-IDF vectors of the text data and the target texts.
Methods
__init__
([container])anchor_types
()Get a list of references to all defined Anchor subclasses in scope (directly and indirectly.)
debug
(**kwargs)Inspect .param.debug method for the full docstring
defaults
(**kwargs)Inspect .param.defaults method for the full docstring
featurize
(data)Return a column of cosine-similarity values from each entry in the passed dataframe to the targets set on this anchor.
fire_on_anchor_changed
(key, value)Trigger the event to notify that some property on this anchor changed.
force_new_dynamic_value
(**kwargs)Inspect .param.force_new_dynamic_value method for the full docstring
get_param_values
(**kwargs)Inspect .param.get_param_values method for the full docstring
get_value_generator
(**kwargs)Inspect .param.get_value_generator method for the full docstring
inspect_value
(**kwargs)Inspect .param.inspect_value method for the full docstring
load
(path)Load anchor from specified path.
message
(**kwargs)Inspect .param.message method for the full docstring
on_anchor_changed
(callback)Register a callback for the anchor_changed event.
params
(**kwargs)Inspect .param.params method for the full docstring
pprint
(*args, **kwargs)print_param_defaults
(*args, **kwargs)Inspect .param.print_param_defaults method for the full docstring
print_param_values
(**kwargs)Inspect .param.print_param_values method for the full docstring
remove_by_short
(short_text)Delete one of the reference texts based on the short version.
row_view
()save
(path)Save anchor to specified path.
script_repr
([imports, prefix])Deprecated variant of __repr__ designed for generating a runnable script.
set_default
(*args, **kwargs)Inspect .param.set_default method for the full docstring
set_dynamic_time_fn
(**kwargs)Inspect .param.set_dynamic_time_fn method for the full docstring
set_param
(**kwargs)Inspect .param.set_param method for the full docstring
state_pop
()Restore the most recently saved state.
state_push
()Save this instance's state.
to_dict
()Get a dictionary of all relevant parameters that define this anchor.
verbose
(**kwargs)Inspect .param.verbose method for the full docstring
warning
(**kwargs)Inspect .param.warning method for the full docstring
Attributes
Subclasses of
Anchor
can define this DESCRIPTION to show up in the UI explaining the given anchor type.Subclasses of
Anchor
can define this NAME to show up in the UI as the default name for this anchor type.anchor_name
Not to be confused with just
name
, which is the panel component id.global_cache
An anchor list level cache, (dictionary of key-value pairs) any keys set here are accessible by all other anchors.
in_model
Whether to include this feature in the training process.
in_view
Whether to show this anchor in anchorviz.
param
reference_short
A shortform version of the texts, either the row IDs if available, or just the first few words
reference_texts
The target texts to calculate the similarity to.
text_col
The text column from the data to use when measuring similarity.
weight
Scalar multiple to apply to all output features, the user can change this to modify how much a particular feature influences the model.
cache
A dictionary of key-value pairs specific to this one anchor instance that gets saved when
save()
is called (by default).- DESCRIPTION: str = 'Uses cosine similarity between TF-IDF vectors of data and target text as the feature value.'#
Subclasses of
Anchor
can define this DESCRIPTION to show up in the UI explaining the given anchor type.
- NAME: str = 'TF-IDF'#
Subclasses of
Anchor
can define this NAME to show up in the UI as the default name for this anchor type.
- featurize(data)#
Return a column of cosine-similarity values from each entry in the passed dataframe to the targets set on this anchor.
- Parameters:
data (DataFrame) –
- Return type:
Series
- name = 'TFIDFAnchor'#