Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Vous êtes un professionnel et vous avez besoin d'une formation ? RAG (Retrieval-Augmented Generation)
et Fine Tuning d'un LLM
Voir le programme détaillé
Module « scipy.sparse.csgraph »

Fonction csgraph_from_masked - module scipy.sparse.csgraph

Signature de la fonction csgraph_from_masked

def csgraph_from_masked(graph) 

Description

help(scipy.sparse.csgraph.csgraph_from_masked)

    csgraph_from_masked(graph)

    Construct a CSR-format graph from a masked array.

    .. versionadded:: 0.11.0

    Parameters
    ----------
    graph : MaskedArray
        Input graph.  Shape should be (n_nodes, n_nodes).

    Returns
    -------
    csgraph : csr_array
        Compressed sparse representation of graph,

    Examples
    --------
    >>> import numpy as np
    >>> from scipy.sparse.csgraph import csgraph_from_masked

    >>> graph_masked = np.ma.masked_array(data =[
    ... [0, 1, 2, 0],
    ... [0, 0, 0, 1],
    ... [0, 0, 0, 3],
    ... [0, 0, 0, 0]
    ... ],
    ... mask=[[ True, False, False,  True],
    ...       [ True,  True,  True, False],
    ...       [ True,  True,  True, False],
    ...       [ True,  True,  True,  True]],
    ... fill_value = 0)

    >>> csgraph_from_masked(graph_masked)
    <Compressed Sparse Row sparse array of dtype 'float64'
        with 4 stored elements and shape (4, 4)>

    


Vous êtes un professionnel et vous avez besoin d'une formation ? Programmation Python
Les compléments
Voir le programme détaillé