zen_mapper.adapters =================== .. py:module:: zen_mapper.adapters .. autoapi-nested-parse:: Adapters for converting between zen-mapper types and 3rd party types Functions --------- .. autoapisummary:: zen_mapper.adapters.to_networkx zen_mapper.adapters.sk_learn Module Contents --------------- .. py:function:: to_networkx(komplex: zen_mapper.types.Komplex) Converts a zen-mapper komplex to a networkx graph This function takes a `Komplex` object, which represents a simplicial complex, and converts it into a `networkx.Graph` object. The vertices of the `Komplex` become the nodes in the `networkx` graph, and the 1-simplices (edges) of the `Komplex` become the edges in the `networkx` graph. :param komplex: The `Komplex` object to convert. This object is expected to have a `vertices` attribute and support indexing for its simplices (e.g., `komplex[1]` for 1-simplices). :type komplex: Komplex :returns: A `networkx.Graph` object representing the 0- and 1-dimensional structure of the input `Komplex`. :rtype: networkx.Graph :raises ImportError: If the `networkx` library is not installed. .. py:function:: sk_learn(base_clusterer: C) -> zen_mapper.types.Clusterer[C] Wraps a scikit-learn clusterer for use with zen-mapper. This function acts as an adapter, allowing scikit-learn's clustering algorithms to be integrated into the zen-mapper pipeline. Note: any datapoints which are considered noise by the base clusterer are ignored. :param base_clusterer: An instance of a scikit-learn compatible clustering algorithm. This object should have a `fit_predict` method and a `labels_` attribute after fitting, which is standard for scikit-learn clusterers. :type base_clusterer: C :returns: An object conforming to the zen-mapper `Clusterer` protocol, which wraps the provided `clusterer`. This allows zen-mapper to use the scikit-learn clusterer's `fit_predict` methods within its pipeline. A copy of the fitted base clusterer is also returned as metadata allowing for inspection of the fitted model (e.g., centroids, parameters, dendrograms) after the mapper pipeline. :rtype: Clusterer[C]