TNeuralNetworkHandler is the native class in Ascoos OS for building, training, and evaluating neural networks. It fully supports deep learning architectures and operates without external libraries or cloud dependencies.
Integrated into the Web5 Kernel, it works seamlessly with macro scripts, semantic profilers, and DSL commands. This documentation outlines its capabilities, supported architectures, and practical examples.

TNeuralNetworkHandler supports multiple neural network architectures, offering flexibility and adaptability across tasks:
All networks can be combined, trained, and evaluated natively without external libraries. The class also supports custom layers and activation functions.
Below are practical examples of how to use TNeuralNetworkHandler in real-world scenarios:
$nn = new TNeuralNetworkHandler();
$nn->addLayer('dense', ['units' => 128, 'activation' => 'relu']);
$nn->addLayer('dense', ['units' => 64, 'activation' => 'relu']);
$nn->addLayer('dense', ['units' => 10, 'activation' => 'softmax']);
$nn->compile(['optimizer' => 'adam', 'loss' => 'categoricalCrossEntropy']);
$nn->fit($data, $labels, ['epochs' => 20, 'batchSize' => 32]);
$metrics = $nn->evaluate($testData, $testLabels);
echo $metrics['accuracy']; // e.g., 0.87
$prediction = $nn->predict($newInput);
print_r($prediction); // Array of probabilities or labels
TNeuralNetworkHandler is deeply integrated into the Web5 Kernel of Ascoos OS, enabling neural networks to participate in semantic and autonomous workflows.
This integration transforms Ascoos OS into a native deep learning platform, where logic and learning are core system capabilities.
✍️ Written by Christos Drogkidis — Developer, thinker, and advocate of logic-driven software design.