Documentation ¶
Overview ¶
Package rocketc is fast, simple and lightweight library for CSV data manipulation and mathematical computation involving 2D Matrices.
Index ¶
- func DimensionEqual(m1, m2 Matrix) bool
- func PrintDataframe(d ...DataFrame)
- func PrintMatrix(m ...Matrix)
- func WriteCSVDataFrame(d DataFrame, fname string) error
- func WriteCSVMatrix(m Matrix, fname string) error
- type DataFrame
- type Matrix
- func AddElementwise(m1, m2 Matrix) Matrix
- func ConvMatrix(d DataFrame) (Matrix, error)
- func CopyMatrix(src Matrix) Matrix
- func DivElementwise(m1, m2 Matrix) Matrix
- func GetColumnsMatrix(m Matrix, i ...int) Matrix
- func HStack(m ...Matrix) Matrix
- func Max(m Matrix, axis int) Matrix
- func Mean(m Matrix, axis int) Matrix
- func Min(m Matrix, axis int) Matrix
- func MulElementwise(m1, m2 Matrix) Matrix
- func Multiply(m1, m2 Matrix) Matrix
- func Ones(rows, cols int) Matrix
- func Random(rows, cols int) Matrix
- func ReadCSVMatrix(fname string, dropFirst bool) (Matrix, error)
- func SubElementwise(m1, m2 Matrix) Matrix
- func Sum(m Matrix, axis int) Matrix
- func VStack(m ...Matrix) Matrix
- func Zeros(rows, cols int) Matrix
- func (m *Matrix) Add(i float32, inplace bool) Matrix
- func (m Matrix) Cols() int
- func (m *Matrix) Div(i float32, inplace bool) Matrix
- func (m *Matrix) Fill(i float32)
- func (m Matrix) Filter(f func(v float32) bool) [][]bool
- func (m *Matrix) Init()
- func (m *Matrix) MakeMatrixUniform()
- func (m *Matrix) Map(f func(v float32) float32, inplace bool) Matrix
- func (m *Matrix) Mul(i float32, inplace bool) Matrix
- func (m *Matrix) Ones()
- func (m *Matrix) ReciproElementwise(inplace bool) Matrix
- func (m Matrix) Rows() int
- func (m Matrix) Shape() [2]int
- func (m *Matrix) Sub(i float32, inplace bool) Matrix
- func (m *Matrix) Transpose(inplace bool) Matrix
- func (m *Matrix) Zeros()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DimensionEqual ¶
DimensionEqual : Checks if m1 and m2 has same dimension, returns boolean.
func PrintDataframe ¶
func PrintDataframe(d ...DataFrame)
PrintDataframe : for pretty printing of DataFrame.
func WriteCSVDataFrame ¶
WriteCSVDataFrame : Writes DataFrame into a file, so that DataFrame can be saved to disk for furthur. Takes a DataFrame and filename as arguments. Returns an error value in case of any error occurred. Note : This function can only write DataFrame to file.
func WriteCSVMatrix ¶
WriteCSVMatrix : Writes Matrix into a file, so that Matrix can be saved to disk for furthur. Takes a Matrix, slice of strings which are headers and filename as arguments. Returns an error value in case of any error occurred. Note : This function can only write Matrix to file.
Types ¶
type DataFrame ¶
type DataFrame [][]string
DataFrame : Basic data container, stores data in form of 2D slices of string.
func DropColumn ¶
DropColumn : Drops columns from a DataFrame, takes a DataFrame and variable number of arguments which are indexes of columns to be droped.
func GetColumnsDataFrame ¶
GetColumnsDataFrame : Returns a DataFrame by only including specific columns whose column indexs are passed as argument. Take a DataFrame and variadic number integers which are column indexes.
func ReadCSVDataFrame ¶
ReadCSVDataFrame : Use this function to read CSV file completely. Takes a string filename. Returns DataFrame and not nil error value in case of any error occurred. Currently ReadCSVDataFrame can only read matrices which do not have multiple values in single column. Note : Use this function if data contains both numeric and string values.
func WipeDown ¶
WipeDown : Returns unifom DataFrame by only including rows of length l in returned DataFrame. Takes a DataFrame and a integer as arguments.
func (DataFrame) Cols ¶
Cols : Returns number of columns in DataFrame, DataFrame must be uniform for accurate result.
func (*DataFrame) SetHeaders ¶
SetHeaders : Set custom column names to a DataFrame. Takes a slice of string containing name of columns.
type Matrix ¶
type Matrix [][]float32
Matrix : Basic numerical container (2D array), core datatype.
func AddElementwise ¶
AddElementwise : Adds two Matrix m1 and m2.
func ConvMatrix ¶
ConvMatrix : Converts numerical DataFrame into Matrix, returns err if dataframe contains values that cannot be converted into a float64.
func DivElementwise ¶
DivElementwise : Elementwise division of Matric m1 and m2.
func GetColumnsMatrix ¶
GetColumnsMatrix : Returns a Matrix only containing columns whose index is passed. columns are 0 indexed. Takes variadic arguments i.e index.
func HStack ¶
HStack : Returns a Matrix which is constructed by horizontally stacking every Matrix passed in argument. Takes variadic number of arguments i.e Matrix.
func Max ¶
Max : Returns a Matrix containing the maximum of elements of Matrix m according to given axis. If axis = 0, along the rows and if axis = 1, along the columns.
func Mean ¶
Mean : Returns a Matrix containing the mean of elements of Matrix m according to given axis. If axis = 0, along the rows and if axis = 1, along the columns.
func Min ¶
Min : Returns a Matrix containing the minimum of elements of Matrix m according to given axis. If axis = 0, along the rows and if axis = 1, along the columns.
func MulElementwise ¶
MulElementwise : Elementwise multiplication of Matrix m1 and m2.
func Random ¶
Random : Generates and returns a Matrix of given rows and cols containing random numbers.
func ReadCSVMatrix ¶
ReadCSVMatrix : Use this function to read CSV if you are sure that CSV file only contains parsable numerical values (float64).Takes a string filename and a boolean whether to drop first row or not. Returns a Matrix. Note : Drop first row if it contains name of columns.
func SubElementwise ¶
SubElementwise : Subtracts two Matrix m1 and m2.
func Sum ¶
Sum : Returns a Matrix containing sum of elements of Matrix m according to given axis. If axis = 0, along the rows and if axis = 1, along the columns.
func VStack ¶
VStack : Returns a Matrix which is constructed by vertically stacking every Matrix passed in argument. Takes variadic number of arguments i.e Matrix.
func (*Matrix) Add ¶
Add : Adds a given number to every element of Matrix, takes a boolean inplace if True performs addition inplace.
func (*Matrix) Div ¶
Div : Divides every element of Matrix by i, takes a boolean inplace if True performs division inplace.
func (Matrix) Filter ¶
Filter : Takes a function f as argument which in turn takes a float32 and returns bool. Filter function applies f to every element in m and returns the result as a boolean matrix.
func (*Matrix) Init ¶
func (m *Matrix) Init()
Init : Initializes a Matrix to 1 X 1 Matrix containing zero.
func (*Matrix) MakeMatrixUniform ¶
func (m *Matrix) MakeMatrixUniform()
MakeMatrixUniform : Makes Matrix rows of same size, by filling rest of the row with zero value of float32 if different size rows are present in Matrix.
func (*Matrix) Map ¶
Map : Applies given function to every element of Matrix, takes a boolean inplace if True performs mapping inplace.
func (*Matrix) Mul ¶
Mul : Multiplies i to every element of the Matrix, takes a boolean inplace if True performs multiplication inplace.
func (*Matrix) ReciproElementwise ¶
ReciproElementwise : Elementwise reciprocal of Matrix elements, takes a boolean inplace if True performs reciprocal inplace.
func (*Matrix) Sub ¶
Sub : Subtracts a given number from every element of Matrix, takes a boolean inplace if True performs subtraction inplace.