SimpleMLPModel

Simple Multi-Layer Perceptron (MLP) model implementation for KotlinDL integration.

This object provides a standardized interface for creating and configuring neural network models within the KARL Deep Learning (KLDL) framework. The implementation serves as a foundation for building feedforward neural networks with customizable architecture.

Current Implementation Status:

  • Stub Implementation: Placeholder until KotlinDL dependencies are fully integrated

  • Production Ready: Interface designed for seamless transition to KotlinDL backend

  • Backward Compatible: API stable across implementation changes

Neural Network Architecture:

Input Layer → Hidden Layer 1 → Hidden Layer 2 → ... → Output Layer
↓ ↓ ↓ ↓
[inputSize] [hiddenSizes[0]] [hiddenSizes[1]] [numClasses]
↓ ↓ ↓ ↓
Features Dense+ReLU Dense+ReLU Dense+Softmax

Default Configuration:

  • Input Layer: 3 neurons for feature vector processing

  • Hidden Layers: 2 layers with 10 neurons each using ReLU activation

  • Output Layer: 4 neurons with softmax activation for classification

  • Architecture: 3 → 10 → 10 → 4 (fully connected feedforward)

Planned KotlinDL Integration:

  • Framework: TensorFlow backend via KotlinDL

  • Optimization: Adam optimizer with configurable learning rate

  • Regularization: L2 regularization and dropout support

  • Training: Batch training with validation monitoring

Use Cases:

  • Classification tasks with categorical output

  • Feature learning from structured input data

  • Rapid prototyping of neural network architectures

  • Educational demonstrations of MLP principles

Design Patterns:

  • Singleton Pattern: Object-based implementation for stateless operations

  • Factory Pattern: createModel() method for model instantiation

  • Configuration Pattern: Default parameters with override capability

  • Stub Pattern: Current implementation provides interface without full logic

Future Enhancements:

  • Dynamic layer configuration with activation function selection

  • Model serialization and deserialization support

  • Performance optimization with GPU acceleration

  • Integration with KARL learning engine for adaptive behavior

Thread Safety: Object is stateless and inherently thread-safe Performance: O(1) configuration time, actual training complexity depends on KotlinDL backend

Since

1.0.0

Author

KARL AI Development Team

See also

KotlinDL Documentation for backend details

Functions

Link copied to clipboard
fun createModel(inputSize: Int = 3, numClasses: Int = 4, hiddenLayerSizes: List<Int> = listOf(10, 10)): String

Creates and configures a Multi-Layer Perceptron neural network model.

Link copied to clipboard

Returns the default input layer size for the neural network.

Link copied to clipboard

Returns the default number of output classes for classification tasks.