fit_transform_node_attribute

Fits and applies a preprocessor to transform node attributes.

sasviya.network.utils.preprocessing.fit_transform_node_attribute(g, node_attr, preprocessor, new_attrs=None, *, inplace=False, drop=False, sep=False, **fit_params)

Parameters

g : SAS graph object

Specifies the input graph to assess.

node_attr : str

Specifies the node attributes to transform.

preprocessor : transformer object

Specifies an instance of a class that implements fitting and transform, such as sklearn.preprocessing.OneHotEncoder.

new_attrs : str or list of str or callable, optional

Specifies the names of the transformed attributes. By default, attribute names are inferred. When new_attrs is a string (str), it names a single attribute (for preprocessors that create one output attribute). When new_attrs is a list, the element names one or more attributes (for preprocessors that create multiple output attributes). When new_attrs is callable, it specifies a function that creates a name for each attribute. The function must accept three positional arguments and return a string: new_attrs(attr, category, i) provides a name for the ith attribute, which corresponds to the categorical value category, and the input attribute name attr.

inplace : bool, optional

Specifies whether or not to add the transformed attributes from the input graph directly. The default is False. When the value is True, a copy of the graph is returned with the transformed attributes added.

drop : bool, optional

Specifies whether or not to remove the input attribute attr from the output. The default is False.

sep : str or None, optional

Specifies the separator to be used to split the string. The default is None. This parameter is required by preprocessors such as sklearn.preprocessors.MultiLabelBinarizer that operate on a list, and therefore each string attribute value must be split into a list.

Returns

SAS graph object or None

If the inplace parameter value is False, a copy of the input graph with transformed node attributes is returned; otherwise a value of None is returned.

Last updated: July 28, 2026