https://github.com/harold-crane/dart-mlp
https://github.com/harold-crane/dart-mlp
artificial-neural-networks multilayer-perceptron pubdev
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/harold-crane/dart-mlp
- Owner: Harold-Crane
- License: mit
- Created: 2024-07-24T09:43:12.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-11T12:43:27.000Z (almost 2 years ago)
- Last Synced: 2025-10-23T02:56:15.405Z (8 months ago)
- Topics: artificial-neural-networks, multilayer-perceptron, pubdev
- Language: Dart
- Homepage:
- Size: 305 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# mlp
`mlp` is a Dart package for constructing and working with multi-layer perceptron (MLP) neural networks. It provides classes to define neurons, layers, edges, and the overall model, enabling easy creation and manipulation of neural networks for machine learning tasks.
## Features

- Define neurons (`Neuron` class) with various attributes such as value, name, and connections.
- Create layers (`Layer` class) with different types (input, hidden, output) and manage their connectivity.
- Establish connections between neurons using edges (`Edge` class) with optional weights.
- Build and manage the entire neural network model (`Model` class).
## Getting started
To start using the `mlp` package, add it to your `pubspec.yaml`:
```yaml
dependencies:
mlp: ^1.0.0
```
Then, run `pub get` to install the package.
## Usage
Here is a simple example to demonstrate how to use the mlp package to create a neural network:
```dart
void main() async{
ARFFConverter arffConverter = ARFFConverter();
ARFF arff = await arffConverter.parseARFFFile(fileName: 'assets/penguins.arff');
// Or csv file like that one:
// ARFF arff = await arffConverter.parseARFFFile(fileName: 'assets/penguins.csv');
MultilayerPerceptron mlp = MultilayerPerceptron(
inputLayer: Layer.input(
neurons: arff.getInputLayerNeurons(className: 'species')),
outputLayer:
Layer.output(neurons: arff.getOutputLayerNeurons(className: 'species')),
);
// 'Gentoo','Biscoe',42.8,14.2,209,4700,'female'
// 'Adelie','Biscoe',37.8,20.0,190,4250,'male'
var model = await mlp.createModel(ARFFModelCreationParameter(arff: arff, className: 'species'));
var prediction = mlp.getPrediction(arff: arff, model: model, data: [
ARFFData(name: 'island', value: 'Biscoe'),
ARFFData(name: 'flipper_length_mm', value: '209'),
ARFFData(name: 'bill_length_mm', value: '42.8'),
ARFFData(name: 'bill_depth_mm', value: '14.2'),
ARFFData(name: 'sex', value: 'female'),
ARFFData(name: 'body_mass_g', value: '4700'),
]);
var prediction2 = mlp.getPrediction(arff: arff, model:model, data: [
ARFFData(name: 'island', value: 'Biscoe'),
ARFFData(name: 'flipper_length_mm', value: '190'),
ARFFData(name: 'bill_length_mm', value: '37.8'),
ARFFData(name: 'bill_depth_mm', value: '20.0'),
ARFFData(name: 'sex', value: 'male'),
ARFFData(name: 'body_mass_g', value: '4250'),
]);
print(prediction);
print(prediction2);
}
```
## Additional information
To contribute to this package, please visit the GitHub repository and follow the contribution guidelines.
If you encounter any issues, please file them on the issue tracker. The package authors will try to respond as quickly as possible.