numexy v0.1.5 Numexy

Documentation for Numexy.

Link to this section Summary

Functions

Add vector or matrix

Get index of max value

Avarage matrix or vector

Calculate inner product

Get matrix or vector value

Multiplication vector or matrix

New matrix

Create ones matrix or vector

Get relu function value

Get sigmoid function value

Get softmax function value

Get step function value

Sum matrix or vector

Calculate transpose matrix

Create zeros matrix or vector

Link to this section Functions

Add vector or matrix.

Examples

iex> x = Numexy.new([1,2,3])
%Array{array: [1,2,3], shape: {3, nil}}
iex> y = 4
iex> Numexy.add(x, y)
%Array{array: [5,6,7], shape: {3, nil}}

Get index of max value.

Examples

iex> Numexy.new([[1,2,9],[4,5,6]]) |> Numexy.argmax
2
iex> Numexy.new([[1,2,9],[4,6,3]]) |> Numexy.argmax(:row)
[2, 1]
iex> Numexy.new([[1,2,9],[4,6,3]]) |> Numexy.argmax(:col)
[1, 1, 0]
Link to this function argmax(array, atom)

Avarage matrix or vector.

Examples

iex> Numexy.new([2,9,5]) |> Numexy.avg
5.333333333333333
iex> Numexy.new([[1,2,3],[4,5,6]]) |> Numexy.avg
3.5
Link to this function dot(array1, array2)

Calculate inner product.

Examples

iex> x = Numexy.new([1,2,3])
%Array{array: [1,2,3], shape: {3, nil}}
iex> y = Numexy.new([1,2,3])
%Array{array: [1,2,3], shape: {3, nil}}
iex> Numexy.dot(x, y)
14
Link to this function get(array, arg)

Get matrix or vector value.

Examples

iex> Numexy.new([2,9,5]) |> Numexy.get({2, nil})
9
iex> Numexy.new([[1,2,3],[4,5,6]]) |> Numexy.get({2, 1})
4

Multiplication vector or matrix.

Examples

iex> x = Numexy.new([1,2,3])
%Array{array: [1,2,3], shape: {3, nil}}
iex> y = 4
iex> Numexy.mul(x, y)
%Array{array: [4,8,12], shape: {3, nil}}

New matrix.

Examples

iex> Numexy.new([1,2,3])
%Array{array: [1, 2, 3], shape: {3, nil}}
iex> Numexy.new([[1,2,3],[1,2,3]])
%Array{array: [[1, 2, 3], [1, 2, 3]], shape: {2, 3}}

Create ones matrix or vector.

Examples

iex> Numexy.ones({2, 3})
%Array{array: [[1, 1, 1], [1, 1, 1]], shape: {2, 3}}
iex> Numexy.ones({3, nil})
%Array{array: [1, 1, 1], shape: {3, nil}}

Get relu function value.

Examples

iex> Numexy.new([-2,9,5]) |> Numexy.relu()
%Array{array: [0, 9, 5], shape: {3, nil}}

Get sigmoid function value.

Examples

iex> Numexy.new([-2,9,5]) |> Numexy.sigmoid()
%Array{array: [0.11920292202211755, 0.9998766054240137, 0.9933071490757153], shape: {3, nil}}

Get softmax function value.

Examples

iex> Numexy.new([-2,9,5]) |> Numexy.softmax()
%Array{array: [1.6401031494862326e-5, 0.9819976839988096, 0.017985914969695496], shape: {3, nil}}
Link to this function step_function(array)

Get step function value.

Examples

iex> Numexy.new([-2,9,5]) |> Numexy.step_function()
%Array{array: [0, 1, 1], shape: {3, nil}}

Sum matrix or vector.

Examples

iex> Numexy.new([2,9,5]) |> Numexy.sum
16
iex> Numexy.new([[1,2,3],[4,5,6]]) |> Numexy.sum
21
Link to this function transpose(array)

Calculate transpose matrix.

Examples

iex> x = Numexy.new([[4,3],[7,5],[2,7]])
%Array{array: [[4, 3], [7, 5], [2, 7]], shape: {3, 2}}
iex> Numexy.transpose(x)
%Array{array: [[4, 7, 2], [3, 5, 7]], shape: {2, 3}}

Create zeros matrix or vector.

Examples

iex> Numexy.zeros({2, 3})
%Array{array: [[0, 0, 0], [0, 0, 0]], shape: {2, 3}}
iex> Numexy.zeros({3, nil})
%Array{array: [0, 0, 0], shape: {3, nil}}