LearningModel

A generic interface representing a machine learning model within a LearningEngine.

This abstraction allows a LearningEngine implementation (like :karl-kldl) to be designed to work with different model architectures (e.g., MLP, RNN, Transformer) that conform to this contract. It defines the essential operations of a model: prediction, training, and state management.

Functions

Link copied to clipboard
abstract fun initialize()

Initializes the model's internal structure and parameters. This is where the actual model graph (e.g., a KotlinDL Sequential model) would be built.

Link copied to clipboard
abstract fun loadState(state: KarlContainerState)

Loads the model's learned parameters (e.g., weights) from a serialized state.

Link copied to clipboard
abstract fun predict(input: FloatArray): FloatArray

Performs inference on a given input feature vector.

Link copied to clipboard

Retrieves the model's current learned parameters in a serializable format.

Link copied to clipboard
abstract fun train(input: FloatArray, target: FloatArray)

Performs a single training step on the model.