AIGO
Simple and extensible AI models in Go for learning and experimentation
I - Introduction
AIGO is a library designed to provide comprehensive access to AI models.
The primary role of AIGO is to be a self-teaching, fun project and a good introduction to Machine Learning,
but it can also be used by anyone interested in AI to experiment and understand various models.
II - Install
To install AIGO in your project, you can use the following command:
go get github.com/eleby/aigo
III - Use
A usage example of each model is available in the examples folder.
Perceptron
The Perceptron is a simple linear classifier that can be used for binary classification tasks.
It learns a linear decision boundary by adjusting weights based on the input data and the expected output.
Here is a basic example of how to use the Perceptron model in your Go code:
package main
import (
"fmt"
"github.com/eleby/aigo/perceptron"
)
func main() {
// Training data: logical AND
inputs := [][]float64{
{0, 0}, {0, 1}, {1, 0}, {1, 1},
}
expected := []float64{0, 0, 0, 1}
// Create and train perceptron
neuron, err := perceptron.NewPerceptron(inputs, expected, 0.1)
if err != nil {
panic("Error creating perceptron:" + err.Error())
}
neuron.Train(10000)
// Test predictions
fmt.Println("Predict [1,1]:", neuron.PredictClass([]float64{1, 1})) // 1
fmt.Println("Predict [0,1]:", neuron.PredictClass([]float64{0, 1})) // 0
}
IV - Structure
.
├── perceptron/ # Implementation of the Perceptron model
├── examples/ # Usage examples of each model
│ └── perceptron/ # Usage examples of the Perceptron model
│ ├── main.go # Main entry point to run the Perceptron example
│ ├── data/ # Data used for the Perceptron model
│ └── preprocessing/ # Preprocessing utilities for the Perceptron data
└── README.md # <- You are here
V - Tests
To run the tests for the Perceptron model, you can use the following command in the Aigo directory :
go test ./perceptron
VI - Data
You can find various examples of data formats to use with the models.
Typically, the Perceptron model uses a slice of slices of floats.
You can see examples of this format in the perceptron/perceptron_test.go file (raw coded input data)
or in the examples/perceptron/data folder (CSV files).
VII - Roadmap
This project aims to evolve with time. Here is AIGO's roadmap :
- Add Perceptron model
- Add MLP (Multi-Layer Perceptron) model
- Add CNN (Convolutional Neural Network) model ?
- Add RNN (Recurrent Neural Network) model ?
VIII - Contributing
Contributions are welcome!
If you'd like to improve AIGO, here are the steps:
- Fork the repository
- Create your feature branch (
git checkout -b feature/my-feature)
- Commit your changes (
git commit -m 'Add my feature')
- Push to the branch (
git push origin feature/my-feature)
- Open a Pull Request
Feel free to open issues as well if you encounter bugs or have feature suggestions.
IX - License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
X - Changelog
See the CHANGELOG file for the list of changes made to the project.