package sklearn
Module Sklearn.Feature_extractionSource
Get an attribute of this module as a Py.Object.t. This is useful to pass a Python function to another function.
val grid_to_graph :
?n_z:int ->
?mask:[ `Dtype_bool of Py.Object.t | `Arr of [> `ArrayLike ] Np.Obj.t ] ->
?return_as:Py.Object.t ->
?dtype:Np.Dtype.t ->
n_x:int ->
n_y:int ->
unit ->
Py.Object.tGraph of the pixel-to-pixel connections
Edges exist if 2 voxels are connected.
Parameters ---------- n_x : int Dimension in x axis n_y : int Dimension in y axis n_z : int, default=1 Dimension in z axis mask : ndarray of shape (n_x, n_y, n_z), dtype=bool, default=None An optional mask of the image, to consider only part of the pixels. return_as : np.ndarray or a sparse matrix class, default=sparse.coo_matrix The class to use to build the returned adjacency matrix. dtype : dtype, default=int The data of the returned sparse matrix. By default it is int
Notes ----- For scikit-learn versions 0.14.1 and prior, return_as=np.ndarray was handled by returning a dense np.matrix instance. Going forward, np.ndarray returns an np.ndarray, as expected.
For compatibility, user code relying on this method should wrap its calls in ``np.asarray`` to avoid type issues.
val img_to_graph :
?mask:[ `Dtype_bool of Py.Object.t | `Arr of [> `ArrayLike ] Np.Obj.t ] ->
?return_as:Py.Object.t ->
?dtype:Np.Dtype.t ->
img:[> `ArrayLike ] Np.Obj.t ->
unit ->
Py.Object.tGraph of the pixel-to-pixel gradient connections
Edges are weighted with the gradient values.
Read more in the :ref:`User Guide <image_feature_extraction>`.
Parameters ---------- img : ndarray of shape (height, width) or (height, width, channel) 2D or 3D image. mask : ndarray of shape (height, width) or (height, width, channel), dtype=bool, default=None An optional mask of the image, to consider only part of the pixels. return_as : np.ndarray or a sparse matrix class, default=sparse.coo_matrix The class to use to build the returned adjacency matrix. dtype : dtype, default=None The data of the returned sparse matrix. By default it is the dtype of img
Notes ----- For scikit-learn versions 0.14.1 and prior, return_as=np.ndarray was handled by returning a dense np.matrix instance. Going forward, np.ndarray returns an np.ndarray, as expected.
For compatibility, user code relying on this method should wrap its calls in ``np.asarray`` to avoid type issues.