package scipy

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
val get_py : string -> Py.Object.t

Get an attribute of this module as a Py.Object.t. This is useful to pass a Python function to another function.

val distance_matrix : ?p:[ `T1_p_infinity of Py.Object.t | `F of float ] -> ?threshold:Py.Object.t -> x:Py.Object.t -> y:Py.Object.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

Compute the distance matrix.

Returns the matrix of all pair-wise distances.

Parameters ---------- x : (M, K) array_like Matrix of M vectors in K dimensions. y : (N, K) array_like Matrix of N vectors in K dimensions. p : float, 1 <= p <= infinity Which Minkowski p-norm to use. threshold : positive int If ``M * N * K`` > `threshold`, algorithm uses a Python loop instead of large temporary arrays.

Returns ------- result : (M, N) ndarray Matrix containing the distance from every vector in `x` to every vector in `y`.

Examples -------- >>> from scipy.spatial import distance_matrix >>> distance_matrix([0,0],[0,1], [1,0],[1,1]) array([ 1. , 1.41421356], [ 1.41421356, 1. ])

val heappop : Py.Object.t -> Py.Object.t

Pop the smallest item off the heap, maintaining the heap invariant.

val heappush : heap:Py.Object.t -> item:Py.Object.t -> unit -> Py.Object.t

Push item onto heap, maintaining the heap invariant.

val minkowski_distance : ?p:[ `T1_p_infinity of Py.Object.t | `F of float ] -> x:Py.Object.t -> y:Py.Object.t -> unit -> Py.Object.t

Compute the L**p distance between two arrays.

Parameters ---------- x : (M, K) array_like Input array. y : (N, K) array_like Input array. p : float, 1 <= p <= infinity Which Minkowski p-norm to use.

Examples -------- >>> from scipy.spatial import minkowski_distance >>> minkowski_distance([0,0],[0,0], [1,1],[0,1]) array( 1.41421356, 1. )

val minkowski_distance_p : ?p:[ `T1_p_infinity of Py.Object.t | `F of float ] -> x:Py.Object.t -> y:Py.Object.t -> unit -> Py.Object.t

Compute the p-th power of the L**p distance between two arrays.

For efficiency, this function computes the L**p distance but does not extract the pth root. If `p` is 1 or infinity, this is equal to the actual L**p distance.

Parameters ---------- x : (M, K) array_like Input array. y : (N, K) array_like Input array. p : float, 1 <= p <= infinity Which Minkowski p-norm to use.

Examples -------- >>> from scipy.spatial import minkowski_distance_p >>> minkowski_distance_p([0,0],[0,0], [1,1],[0,1]) array(2, 1)

OCaml

Innovation. Community. Security.