Code Monkey home page Code Monkey logo

neural-network-library's Introduction

Homemamde Neural Network Framework

My first experience diving into low-level AI development

Slowly but surely, developing a neural network framework

Layer struct:

In this project, layers have a slightly different meaning. Layer is a struct with a vector for the values of its neurons and a matrix for the weights, whereas usually, a layer refers exclusively to neurons.

Its constructor requires the desired length for the layer and the length of the next layer(0 for the output layer); you may also give it a name for visualization purposes

Layer(unsigned int size, unsigned int next_layer_size, string name = "Layer")

Main network-related functions:

void layer_runr(Layer &A_layer, Layer &B_layer)

Gets the values from the neurons array and the weights matrix from the A_layer struct, then calculates everything and inserts the results in the B_layer neurons

void matrix_randomizer(vector<vector<double>> &data)

Set all values in a matrix to a random double between 0.0 and 1.0

void reset_matrix(vector<vector<double>> &matrix)

Set all values in a matrix to 0

void reset_vector(vector<double> &vec)

Set all values in a vector to 0

File handling functions:

vector<string> read_file(string file_name)

Get data from a file in the form of a vector of strings, where each line in the file becomes a string

void write_file(vector<string> data, string file_name)

Get a vector of strings and write it to a file

vector<vector<double>> dpkg(string data_file_path)

Get the matrix of doubles directly from a file

void repack(vector<vector<double>> data, string output_file)

Write a matrix of doubles to a file

Utilities functions:

void print_vector(vector<string> vec)

Print a vector of strings

void print_double_vector(vector<double> vec)

Print a vector of doubles. The largest value will be printed in a blue color

vector<string> split(string str, char delimiter)

Convert a string with words and spaces to a vector with each word, you may be able to use the optional delimiter, which has the default value of spaceBar

vector<string> split(string str, char delimiter = ' ')

Converts a phrase with spaces to a vector of its corresponding words, which is very similar to explode() from PHP

vector<double> multiply_scalar_by_vector(vector<double> vec, double scalar)

Multiply all values in a vector by the given number

void print_matrix(vector<vector<double>> matrix)

Print a matrix of doubles

vector<vector<double>> matrix_transponser(vector<vector<double>> matrix)

Transpose a matrix

double average(vector<double> vec)

Get the average of the values in a vector

double vector_numeric_difference(double test_set[], vector<double> values)

compare two vectors and return the total difference between them

bool is_largest(vector<double> vec, unsigned int indice)

verifies if and indices correspond to the largest value in a vector

neural-network-library's People

Contributors

william64644 avatar

Stargazers

OeTiao avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.