qeep

module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 2, 2025 License: MIT

README

qeep

Welcome to qeep! This project implements a deep learning framework in pure Go. It allows you to define neural networks in a declarative way while being able to control operations at tensor level.

Features

  • Multi-Dimensional Tensors with a variety of linear algebra and statistical operations. (GPU acceleration is planned for future development)
  • Automatic differentiation (AutoGrad) for tensors.
  • Variety of neural network Components such as FC (fully-connected).
  • A Declarative approach to define neural networks using stream package.

Installation

Ensure that you have Go installed. Then, you can install the package using Go modules:

go get github.com/sahandsafizadeh/qeep

Usage

Here is an example of defining a classification model:

package main

import (
	"github.com/sahandsafizadeh/qeep/component/layers"
	"github.com/sahandsafizadeh/qeep/component/layers/activations"
	"github.com/sahandsafizadeh/qeep/component/losses"
	"github.com/sahandsafizadeh/qeep/component/optimizers"
	"github.com/sahandsafizadeh/qeep/model"
	"github.com/sahandsafizadeh/qeep/model/stream"
)

func prepareModel() (m *model.Model, err error) {
	input := stream.Input()

	x := stream.FC(&layers.FCConfig{
		Inputs:  4,
		Outputs: 4,
	})(input)
	x = stream.Tanh()(x)

	x = stream.FC(&layers.FCConfig{
		Inputs:  4,
		Outputs: 3,
	})(x)
	output := stream.Softmax(&activations.SoftmaxConfig{Dim: 1})(x)

	/* ---------- */

	m, err = model.NewModel(input, output, &model.ModelConfig{
		Loss:      losses.NewCE(),
		Optimizer: optimizers.NewSGD(&optimizers.SGDConfig{LearningRate: 1e-5}),
	})
	if err != nil {
		return
	}

	return m, nil
}

More working examples are provided. You can download their dataset and run them like the following for Iris Classification:

cd ./examples/03-Iris/
curl -o data.csv https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data
go run .

License

The qeep project is licensed under the MIT License. See the LICENSE file for details.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL