#cross-platform #framework #artificial-intelligence #cross-language #neural #performance #net

athenna

阿特娜是一个轻量级高性能神经网络框架,用于创建和使用跨平台和语言的AI。

3个版本

0.1.2 2023年1月14日
0.1.1 2021年7月27日
0.1.0 2021年7月27日

#895 in 嵌入式开发

Download history 2/week @ 2024-06-29 13/week @ 2024-07-06 67/week @ 2024-07-27

每月80次下载

GPL-3.0-only

17KB
391

Athenna.Rs

跨平台 - 跨语言性能神经网络,设计用于嵌入到代码库中

查看示例 Athenna仓库

use athenna::nn::*;
use athenna::activations::*;

fn main() {
  println!("Testing Athenna NN");
  let test_file = &"c:/data/test.athenna".to_string();
	let layers:Vec<usize> = vec!{3,5,3};
	let activations:Vec<Activations> = vec!{ Activations::TanH, Activations::Linear };
  let mut nn = Athenna::new(layers, activations);

  nn.learning_rate = 0.02;

  let x = &vec!{0.2,0.8,0.4};
  let y = &vec!{0.7,0.4,0.5};

	// simulate learning and mutation
	// this model will overfit as there is only one set of data
  for i in 0..1000 {
    if i % 100 == 0 {
      // helps not get stuck in local minima!
      nn.mutate(7, 0.0001);
    }
    nn.back_propagate(x, y);
  }
  let w = nn.feed_forward(x);
  println!("cost: {} | {} {} {}", nn.cost, w[0], w[1], w[2]);
  nn.save(test_file);

  let mut nn = Athenna::load(test_file).unwrap();
  let w = nn.feed_forward(x);
  println!("check reloaded nn matches : {} {} {}", nn.cost, w[0], w[1], w[2]);
}

依赖项

~320KB