(->nd-array obj)
Like nd-array constructor but also works for already existing NDArray instances (do nothing). Useful mostly internally to allow flexibility but can be used to design external generic functions as well
Like nd-array constructor but also works for already existing NDArray instances (do nothing). Useful mostly internally to allow flexibility but can be used to design external generic functions as well
(->nilable-nd-array obj)
Internal usage. Also deal with nil
Internal usage. Also deal with nil
(arg-max a dimension)
Returns a NDArray of maximal values along dimension
Returns a NDArray of maximal values along dimension
(arg-min a dimension)
Returns a NDArray of muinimal values along dimension
Returns a NDArray of muinimal values along dimension
(clone nd-array)
Clones a nd-array. Useful for immutability
Clones a nd-array. Useful for immutability
(cotransform kind a1 a2)
(cotransform kind arg1 a1 a2)
(cotransform kind arg1 arg2 a1 a2)
Transforms a vector using an element-wise operator. This operation preserves input. See transform! for destructive operations. Slower than directly calling the specific operation, use this when needed. Usage (NDArray representation simplified for readibility, this is not a vector !) : (transform :ln [1.0 2.0 3.0]) ~ (ln [1.0 2.0 3.0]) = [0.0 0.693.. 1.098..]
(cotransform! kind a1 a2)
(cotransform! kind arg1 a1 a2)
(cotransform! kind arg1 arg2 a1 a2)
Transforms a vector using an element-wise operator. This is a destructive operation, i.e. the input is altered to target value. Use 'transform' for immutability. Slower than directly calling the specific operation, use this when needed. Usage (NDArray representation simplified for readibility, this is not a vector !) : (transform! :ln [1.0 2.0 3.0]) ~ (ln! [1.0 2.0 3.0]) = [0.0 0.693.. 1.098..]
(distance a1 a2)
(distance kind a1 a2)
Computes distance between two NDArray instances using euclidean distance by default (two arities) or the selected method. Methods are : :abs (n1), :euclidean (n2), :cos, :manhattan, :jaccard, :hamming Usage : (distance nd1 nd2) (distance :method nd1 nd2)
Computes distance between two NDArray instances using euclidean distance by default (two arities) or the selected method. Methods are : :abs (n1), :euclidean (n2), :cos, :manhattan, :jaccard, :hamming Usage : (distance nd1 nd2) (distance :method nd1 nd2)
(get-column nd-array n)
Gets nth column of the given nd-array
Gets nth column of the given nd-array
(get-double nd-array n)
Gets the nth leaf element of the flattended nd-array (line first) as a double
Gets the nth leaf element of the flattended nd-array (line first) as a double
(get-in-double nd-array indexes)
Gets the leaf element at specified location, following the standard java specification as a double
Gets the leaf element at specified location, following the standard java specification as a double
(get-in-scalar nd-array indexes)
Gets the leaf element at specified location, following the standard java specification as a nd-array (0d-array)
Gets the leaf element at specified location, following the standard java specification as a nd-array (0d-array)
(get-row nd-array n)
Gets nth row of the given nd-array
Gets nth row of the given nd-array
(get-scalar nd-array n)
Gets the nth leaf element of the flattended nd-array (line first) as a scalar nd-array (0d-array)
Gets the nth leaf element of the flattended nd-array (line first) as a scalar nd-array (0d-array)
(get-shape nd-array)
Gets shape of a NDArray as long[]
Gets shape of a NDArray as long[]
(load-nd-array path)
Load a NDArray from a file written with write-nd-array!
Load a NDArray from a file written with write-nd-array!
(nd-array data)
(nd-array shape data)
Creates a nd array (n dimensional array) from data. For predictable input, indicating a shape (dimensions) is wiser. Else, shape will be infered from a walk from every first element unless input is When you indicate a shape, data must be provided flattened, else the structure must be already formatted as a nested structure. The sole exceptions to this rules are when you want to create a matrix or a (1D) array (most common cases). There you can replace shape by a type hint : :array or :matrix. You can also use specialized constructors : matrix and array Example : (nd-array [2 2] [1 2 3 4]) ;; or (->nd-array [[1 2] [3 4]]) or (->nd-array :matrix [[1 2] [3 4]]) ~ [[1 2] [3 4]] (a matrix) (nd-array [4] [1 2 3 4]) ;; (or (->nd-array [1 2 3 4])) ~ [1 2 3 4] (an array)
Creates a nd array (n dimensional array) from data. For predictable input, indicating a shape (dimensions) is wiser. Else, shape will be infered from a walk from every first element unless input is When you indicate a shape, data must be provided flattened, else the structure must be already formatted as a nested structure. The sole exceptions to this rules are when you want to create a matrix or a (1D) array (most common cases). There you can replace shape by a type hint : :array or :matrix. You can also use specialized constructors : matrix and array Example : (nd-array [2 2] [1 2 3 4]) ;; or (->nd-array [[1 2] [3 4]]) or (->nd-array :matrix [[1 2] [3 4]]) ~ [[1 2] [3 4]] (a matrix) (nd-array [4] [1 2 3 4]) ;; (or (->nd-array [1 2 3 4])) ~ [1 2 3 4] (an array)
(nd-ones shape)
Creates a NDArray full of ones of input shape. Example : (nd-ones [2 2]) ~ [[1 1] [1 1]]
Creates a NDArray full of ones of input shape. Example : (nd-ones [2 2]) ~ [[1 1] [1 1]]
(nd-rand shape)
Creates a NDArray initialized with random values (between 0 and 1) and of input shape.
Creates a NDArray initialized with random values (between 0 and 1) and of input shape.
(nd-zeros shape)
Creates a NDArray full of zeros of input shape. Example : (nd-zeros [2 2]) ~ [[0 0] [0 0]]
Creates a NDArray full of zeros of input shape. Example : (nd-zeros [2 2]) ~ [[0 0] [0 0]]
(normalize a)
NDArray statistical normalization (zero mean and unit variance. Preserves input unlike normalize!
NDArray statistical normalization (zero mean and unit variance. Preserves input unlike normalize!
(normalize! a)
NDArray statistical normalization (zero mean and unit variance. Alters input unlike normalize
NDArray statistical normalization (zero mean and unit variance. Alters input unlike normalize
(transform kind a)
(transform kind arg1 a)
(transform kind arg1 arg2 a)
Transforms a vector using an element-wise operator. This operation preserves input. See transform! for destructive operations. Slower than directly calling the specific operation, use this when needed. Usage (NDArray representation simplified for readibility, this is not a vector !) : (transform :ln [1.0 2.0 3.0]) ~ (ln [1.0 2.0 3.0]) = [0.0 0.693.. 1.098..]
(transform! kind a)
(transform! kind a arg1)
(transform! kind a arg1 arg2)
Transforms a vector using an element-wise operator. This is a destructive operation, i.e. the input is altered to target value. Use 'transform' for immutability. Slower than directly calling the specific operation, use this when needed. Usage (NDArray representation simplified for readibility, this is not a vector !) : (transform! :ln [1.0 2.0 3.0]) ~ (ln! [1.0 2.0 3.0]) = [0.0 0.693.. 1.098..]
(write-nd-array! path nd-array)
(write-nd-array! path split nd-array)
Writes a nd-array directly into a text file (.txt or .csv). The main advantage is to avoid the potentially costly conversion to clojure code. By default, the split is ';'
Writes a nd-array directly into a text file (.txt or .csv). The main advantage is to avoid the potentially costly conversion to clojure code. By default, the split is ';'
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close