Categorization¶
Categorization Project¶
-
class
tamr_unify_client.categorization.project.
CategorizationProject
(client, data, alias=None)[source]¶ A Categorization project in Tamr.
-
model
()[source]¶ Machine learning model for this Categorization project. Learns from verified labels and predicts categorization labels for unlabeled records.
- Returns
The machine learning model for categorization.
- Return type
-
create_taxonomy
(creation_spec)[source]¶ Creates a
Taxonomy
for this project.A taxonomy cannot already be associated with this project.
-
taxonomy
()[source]¶ Retrieves the
Taxonomy
associated with this project. If a taxonomy is not already associated with this project, callcreate_taxonomy()
first.- Returns
The project’s Taxonomy
- Return type
-
add_input_dataset
(dataset)¶ Associate a dataset with a project in Tamr.
By default, datasets are not associated with any projects. They need to be added as input to a project before they can be used as part of that project
- Parameters
dataset (
Dataset
) – The dataset to associate with the project.- Returns
HTTP response from the server
- Return type
-
as_categorization
()¶ Convert this project to a
CategorizationProject
-
as_mastering
()¶ Convert this project to a
MasteringProject
- Returns
This project.
- Return type
- Raises
-
attribute_configurations
()¶ Project’s attribute’s configurations.
- Returns
The configurations of the attributes of a project.
- Return type
-
attribute_mappings
()¶ Project’s attribute’s mappings.
- Returns
The attribute mappings of a project.
- Return type
-
property
attributes
¶ Attributes of this project.
- Returns
Attributes of this project.
- Return type
-
delete
()¶ Deletes this resource. Some resources do not support deletion, and will raise a 405 error if this is called.
- Returns
HTTP response from the server
- Return type
-
input_datasets
()¶ Retrieve a collection of this project’s input datasets.
- Returns
The project’s input datasets.
- Return type
-
remove_input_dataset
(dataset)¶ Remove a dataset from a project.
- Parameters
dataset (
Dataset
) – The dataset to be removed from this project.- Returns
HTTP response from the server
- Return type
-
spec
()¶ Returns this project’s spec.
- Returns
The spec for the project.
- Return type
-
property
type
¶ A Tamr project type, listed in https://docs.tamr.com/reference#create-a-project.
- Type
-
Categories¶
Category¶
-
class
tamr_unify_client.categorization.category.resource.
Category
(client, data, alias=None)[source]¶ A category of a taxonomy
-
parent
()[source]¶ Gets the parent Category of this one, or None if it is a tier 1 category
- Returns
The parent Category or None
- Return type
-
delete
()¶ Deletes this resource. Some resources do not support deletion, and will raise a 405 error if this is called.
- Returns
HTTP response from the server
- Return type
-
Category Spec¶
-
class
tamr_unify_client.categorization.category.resource.
CategorySpec
(client, data, api_path)[source]¶ A representation of the server view of a category.
-
static
of
(resource)[source]¶ Creates a category spec from a category.
- Parameters
resource (
Category
) – The existing category.- Returns
The corresponding category spec.
- Return type
-
static
new
()[source]¶ Creates a blank spec that could be used to construct a new category.
- Returns
The empty spec.
- Return type
-
from_data
(data)[source]¶ Creates a spec with the same client and API path as this one, but new data.
- Parameters
data (dict) – The data for the new spec.
- Returns
The new spec.
- Return type
-
to_dict
()[source]¶ Returns a version of this spec that conforms to the API representation.
- Returns
The spec’s dict.
- Return type
-
with_name
(new_name)[source]¶ Creates a new spec with the same properties, updating name.
- Parameters
new_name (str) – The new name.
- Returns
The new spec.
- Return type
-
with_description
(new_description)[source]¶ Creates a new spec with the same properties, updating description.
- Parameters
new_description (str) – The new description.
- Returns
The new spec.
- Return type
-
static
Category Collection¶
-
class
tamr_unify_client.categorization.category.collection.
CategoryCollection
(client, api_path)[source]¶ Collection of
Category
s.- Parameters
-
by_external_id
(external_id)[source]¶ Retrieve an attribute by external ID.
Since categories do not have external IDs, this method is not supported and will raise a
NotImplementedError
.- Parameters
external_id (str) – The external ID.
- Returns
The specified category, if found.
- Return type
- Raises
KeyError – If no category with the specified external_id is found
LookupError – If multiple categories with the specified external_id are found
-
stream
()[source]¶ Stream categories in this collection. Implicitly called when iterating over this collection.
- Returns
Stream of categories.
- Return type
Python generator yielding
Category
- Usage:
>>> for category in collection.stream(): # explicit >>> do_stuff(category) >>> for category in collection: # implicit >>> do_stuff(category)
-
create
(creation_spec)[source]¶ Creates a new category.
- Parameters
creation_spec (dict) – Category creation specification, formatted as specified in the Public Docs for Creating a Category.
- Returns
The newly created category.
- Return type
Taxonomy¶
-
class
tamr_unify_client.categorization.taxonomy.
Taxonomy
(client, data, alias=None)[source]¶ A project’s taxonomy
-
categories
()[source]¶ Retrieves the categories of this taxonomy.
- Returns
A collection of the taxonomy categories.
- Return type
-
delete
()¶ Deletes this resource. Some resources do not support deletion, and will raise a 405 error if this is called.
- Returns
HTTP response from the server
- Return type
-