Skip to content

A neural network from principles and linear algebra library using C++ linked lists

Notifications You must be signed in to change notification settings

lincketheo/cTensor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cMatrix

build instructions

This is a CMake project. There is a script (maker) that automates the build, or you can follow the standard procedure

  $ mkdir build
  $ cd build
  $ cmake -G "<Make file type>" ../src/
  $ make
  $ ./run

Note

The training images we used are no longer avaliable due to cpywrite, data has some sample faces and onetestimages.zip contains number test images. For a good test, you must have two test sets, training and testing. Make sure to add the path to your file in ./include/constants.hpp. Thus, while running the minimal gui, when it asks for the path to training and test, you can just press enter

Description

Documentation is not up to date

A C++ library for Machine Learning

Summary

This is not a production level library and should not be treated like one.
A machine learning library in c++.

Matrix

matrix.cpp -- matrix.hpp
A Matrix is a reresentation of a matrix / vector of dimension (m x n). Matrix. Designed primarily for speed, matrix impliments matrix caching algorithms
Method Description Usage
Matrix() Default Constructor Creates a 4x4 matrix filled with zero values
Matrix(int, int) Zero Constructor Creates a dim1 x dim2 Matrix of zero values
Matrix(int, int, int) Random Number initialized Creates a dim1 x dim2 Matrix with random values between zero and desired Max
add(Matrix) Add Method Adds {Matrix} to self
stdMult(Matrix) Multiply Method Multiplies {matrix} with self, standard algorithm
transpose() transpose method returns transpose of self
getShape() returns dimensions returns a sized 2 array with index 0, 1 as dim1 dim2
sigmoid() sigmoid opperation returns a matrix with all values passed through the sigmoid function -- bounds all values between 0 and 1

Network

network.cpp -- network.hpp
A network is a linked list data structure for a neural network using Matrixs and layer structs.
struct layer
A layer struct contains a size, a bias Matrix, a weights matrix and a pointer to the next layer (nullptr if output layer)
Method Description Usage
Network(int, int, int, int) Default Constructor Initializes a network with numHidden layers hidden layers of size size hiddenlayers. All layers have biases and weights initialized to random matrces / vectors
propogateNetwork(Matrix) Main opperational method Inputs an input vector, feeds input through network by multiplying input by weights, adding biases then applying sigmoid
printNetwork() A print method Prints network in clean format. Prints biases followed by weights matrix
storeNetwork(string) external storage of a network stores network in 'string' filepath as a csv file
extractNetwork(string) extract a csv network extracts a network from a csv file

About

A neural network from principles and linear algebra library using C++ linked lists

Resources

Stars

Watchers

Forks

Packages

No packages published