ansys.dpf.core.operators.compression.kmeans_clustering#

class ansys.dpf.core.operators.compression.kmeans_clustering(clusters_number=None, formula=None, fields_container=None, component_number=None, config=None, server=None)#

Bases: ansys.dpf.core.dpf_operator.Operator

Apply kMeans clustering to group data depending on the data’s non-linearity.

Parameters:
  • clusters_number (int, optional) – number of the clusters (dafault is 3)

  • formula (str, optional) – formula (‘dist’/’dotprod’), default is ‘dist’

  • fields_container (FieldsContainer) – an iunput fields container containing the data which will be used for the clustering

  • component_number (int, optional) – component number as an int (default is 0), ex ‘0’ for X-displacement, ‘1’ for Y-displacement,…

Returns:

scoping_clusters – Scopings container with the space scoping (entities’ ids) corresponding to each of k-clusters

Return type:

ScopingsContainer

Examples

>>> from ansys.dpf import core as dpf
>>> # Instantiate operator
>>> op = dpf.operators.compression.kmeans_clustering()
>>> # Make input connections
>>> my_clusters_number = int()
>>> op.inputs.clusters_number.connect(my_clusters_number)
>>> my_formula = str()
>>> op.inputs.formula.connect(my_formula)
>>> my_fields_container = dpf.FieldsContainer()
>>> op.inputs.fields_container.connect(my_fields_container)
>>> my_component_number = int()
>>> op.inputs.component_number.connect(my_component_number)
>>> # Instantiate operator and connect inputs in one line
>>> op = dpf.operators.compression.kmeans_clustering(
...     clusters_number=my_clusters_number,
...     formula=my_formula,
...     fields_container=my_fields_container,
...     component_number=my_component_number,
... )
>>> # Get output data
>>> result_scoping_clusters = op.outputs.scoping_clusters()
_inputs#
_outputs#
static _spec() ansys.dpf.core.operators.specification.Specification#
static default_config(server: ansys.dpf.core.server_types.AnyServerType = None) ansys.dpf.core.config.Config#

Returns the default config of the operator.

This config can then be changed to the user needs and be used to instantiate the operator. The Configuration allows to customize how the operation will be processed by the operator.

Parameters:

server – Server with channel connected to the remote or local instance. When None, attempts to use the global server.

Returns:

A new Config instance equivalent to the default config for this operator.

Return type:

config

property inputs: InputsKmeansClustering#

Enables to connect inputs to the operator

Returns:

An instance of InputsKmeansClustering.

Return type:

inputs

property outputs: OutputsKmeansClustering#

Enables to get outputs of the operator by evaluating it

Returns:

An instance of OutputsKmeansClustering.

Return type:

outputs