corelay.processor.laplacian

A module that contains processors for computing the graph Laplacian, which is mainly used for spectral embeddings.

Functions

a1ifmat

Converts the specified matrix to a flat representation.

Classes

Laplacian

The abstract base class for processors that compute a graph Laplacian.

RandomWalkNormalLaplacian

A Processor that computes the normal random walk graph Laplacian.

SymmetricNormalLaplacian

A Processor that computes the normal symmetric graph Laplacian.

corelay.processor.laplacian.a1ifmat(matrix: ndarray[Any, Any] | matrix[Any, Any]) ndarray[Any, Any][source]

Converts the specified matrix to a flat representation. If the matrix is already a flat NumPy array, it is returned as is.

Parameters:

matrix (numpy.ndarray[Any, Any] | numpy.matrix[Any, Any]) – The input matrix to be converted.

Returns:

Returns the converted matrix. If the input was a NumPy matrix, it is returned as a flat NumPy array. Otherwise, the input is returned as is.

Return type:

numpy.ndarray[Any, Any]

class corelay.processor.laplacian.Laplacian[source]

Bases: Processor

The abstract base class for processors that compute a graph Laplacian.

Parameters:
  • is_output (bool) – A value indicating whether this Laplacian processor is the output of a Pipeline. Defaults to False.

  • is_checkpoint (bool | None) – A value indicating whether check-pointed pipeline computations should start at this point, if there exists a previously computed checkpoint value. Defaults to False.

  • io (Storable | None) – An IO object that is used to cache intermediate results of the Pipeline, which can then be re-used in this run or in subsequent runs of the Pipeline. Defaults to an instance of NoStorage.

__tracked__: collections.OrderedDict[str, Any]

An collections.OrderedDict with all public class attributes, i.e., all class attributes not enclosed with double underscores.

class corelay.processor.laplacian.SymmetricNormalLaplacian[source]

Bases: Laplacian

A Processor that computes the normal symmetric graph Laplacian.

Parameters:
  • is_output (bool) – A value indicating whether this SymmetricNormalLaplacian Laplacian processor is the output of a Pipeline. Defaults to False.

  • is_checkpoint (bool | None) – A value indicating whether check-pointed pipeline computations should start at this point, if there exists a previously computed checkpoint value. Defaults to False.

  • io (Storable | None) – An IO object that is used to cache intermediate results of the Pipeline, which can then be re-used in this run or in subsequent runs of the Pipeline. Defaults to an instance of NoStorage.

function(data: Any) Any[source]

Computes the symmetric normal graph Laplacian.

Parameters:

data (Any) – The graph affinity/similarity matrix. This can be a NumPy array or a sparse matrix.

Returns:

Returns the symmetric normal graph Laplacian, which is a sparse representation of the symmetric graph Laplacian matrix.

Return type:

Any

__tracked__: collections.OrderedDict[str, Any]

An collections.OrderedDict with all public class attributes, i.e., all class attributes not enclosed with double underscores.

class corelay.processor.laplacian.RandomWalkNormalLaplacian[source]

Bases: Laplacian

A Processor that computes the normal random walk graph Laplacian.

Parameters:
  • is_output (bool) – A value indicating whether this RandomWalkNormalLaplacian Laplacian processor is the output of a Pipeline. Defaults to False.

  • is_checkpoint (bool | None) – A value indicating whether check-pointed pipeline computations should start at this point, if there exists a previously computed checkpoint value. Defaults to False.

  • io (Storable | None) – An IO object that is used to cache intermediate results of the Pipeline, which can then be re-used in this run or in subsequent runs of the Pipeline. Defaults to an instance of NoStorage.

function(data: Any) Any[source]

Computes the random walk normal graph Laplacian.

Parameters:

data (Any) – The graph affinity/similarity matrix. This can be a NumPy array or a sparse matrix.

Returns:

Returns the random walk normal graph Laplacian, which is a sparse representation of the random walk graph Laplacian matrix.

Return type:

Any

__tracked__: collections.OrderedDict[str, Any]

An collections.OrderedDict with all public class attributes, i.e., all class attributes not enclosed with double underscores.