FeatureAgglomeration

class hana_ml.algorithms.pal.preprocessing.FeatureAgglomeration(n_clusters=None, linkage=None, metric=None, normalization=None)

Feature agglomeration is a dimensionality reduction technique. It reduces dataset dimensionality by merging related features into cohesive groups that capture the most informative aspects of the original data. The algorithm hierarchically clusters features based on pairwise similarities—such as correlation or Euclidean distance—and iteratively merges them to form composite features. By representing each cluster with a single aggregated feature, the method improves computational efficiency and makes your model easier to interpret.

Parameters
n_clustersint, optional

Specifies the number of clusters to find.

Defaults to 2.

linkagestr, optional

Specifies the linkage criterion to use, with valid values listed as follows : 'ward', 'complete', 'average', 'single'.

Defaults to 'ward'.

metricstr, optional

Specifies the metric used to compute the linkage, with valid values listed as follows: 'euclidean', 'L1', 'L2', 'cosine'

Defaults to 'euclidean'.

normalizationstr, optional

Specifies the normalization type, with valid values listed as follows: 'no', 'z-transform', 'scalar'.

Default to 'z-transform'.

Attributes
model_DataFrame

The model content for feature agglomeration derived from train data.

stats_DataFrame

Related statistics.

Methods

fit(data[, key, features])

Scaling of given datasets in multiple dimensions.

transform(data[, key, features])

Scaling of given datasets in multiple dimensions.

Examples

>>> fa = FeatureAgglomeration(n_clusters=3)
>>> fa.fit(data=df)
>>> res = fa.transform(data=df2)
>>> res.collect()
fit(data, key=None, features=None)

Scaling of given datasets in multiple dimensions.

Parameters
dataDataFrame

Dataframe that contains the training data.

keystr, optional

Name of the ID column data.

Defaults to the index column of data if data is indexed by a single columns.

If data is not indexed by a single column and key is not provided, then it is assumed that data contains no ID column.

featuresstr/ListofStrings, optional

Name of the feature columns which needs to be considered in the model.

If not specified, all columns(except key) will be treated as feature columns.

Returns
A fitted object of class FeatureAgglomeration.
transform(data, key=None, features=None)

Scaling of given datasets in multiple dimensions.

Parameters
dataDataFrame

Dataframe that contains data to be transformed.

keystr

Name of the ID column data.

If data is indexed by a single columns, the key defaults to that single index column otherwise key is mandatory.

featuresstr/ListofStrings, optional

Name of the feature columns which needs to be considered in the model.

If not specified, all columns(except key) will be treated as feature columns.

Users should ensure that the input/default value of features are consistency with that of the train data.

Returns
DataFrame

Transformed result of data.

Inherited Methods from PALBase

Besides those methods mentioned above, the FeatureAgglomeration class also inherits methods from PALBase class, please refer to PAL Base for more details.