This repository contains the core of the previous project Ainari
Saki contains in its core a custom experimental artificial neural network, which can work on unnormalized and unfiltered input-data, like sensor measurement data. The network growth over time by creating new nodes and connections between the nodes while learning new data. The original concept was created by myself, merged with classical deep-learning and the code was written from scratch without any frameworks. The goal behind Saki is to create something unique, which works more like the human brain. It wasn't targeted to get a higher accuracy than classical artificial neural networks like Tensorflow, but to be more flexible.
-
Growing neural network:
The artificial neural network, which is the core of the project, growth over time while learning new things by creating new nodes and connections between the nodes based on the given input. A resize of the network is also quite linear in complexity.
-
No normalization of input
The input of the network is not restricted to range of 0.0 - 1.0 . Every value can be inserted, even negative values. Also if there is a single broken value in the input-data, which is million times higher, than the rest of the input-values, it has nearly no effect on the rest of the already trained data.
-
No strict layer structure
The base of a new neural network is defined by a cluster-template. In these templates the structure of the network in planed in hexagons, indeed of layer. When a node tries to create a new synapse, the location of the target-node depends on the location of the source-node within these hexagons. The target is random and the probability depends on the distance to the source. This way it is possible to break the static layer structure. But when defining a line of hexagons and allow nodes only to connect to the nodes of the next hexagon, a classical layer-structure can still be enforced.
-
Spiking neural network
The concept also supports a special version of working as a spiking neural network. This is optional for a created network and basically has the result, that an input is impacted by an older input, based on the time how long ago this input happened.
-
3-dimensional networks
It is basically possible to define 3-dimensional networks. This was only added, because the human brain is also a 3D-object. This feature exist, but was never tested until now. Maybe in bigger tests in the future this feature could become useful to better mix information with each other.
-
Parallelism
The processing structure works also for multiple threads, which can work at the same time on the same network. (GPU-support with CUDA is disabled at the moment for various reasons).
-
Create and activate a virtual environment
python3 -m venv .venv source .venv/bin/activate -
Install maturin
pip3 install maturin
-
Build and install the library locally into the virtual environment
maturin develop
-
Run example-script
import saki # Initialize the class engine = saki.Saki() # init model uuid_str = engine.init_default_model() # train data training_inputs = {"input": [1.0, 2.5, 3.1]} target_outputs = {"output": [0.1, 0.5, 0.9]} for i in range(0, 1000): engine.train(uuid_str, training_inputs, target_outputs) # make request inputs = {"input": [1.0, 2.5, 3.1]} outputs = {"output": [0.0, 0.0, 0.0]} engine.request(uuid_str, inputs, outputs) print(outputs) # Outputs is something like: {'output': [0.13057079911231995, 0.5001742243766785, 0.8688104152679443]} # delete model engine.delete_model(uuid_str)
For a more complex example look into the test.py
