GithubHelp home page GithubHelp logo

mlange-42 / kohonen Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 783 KB

A Self-organizing Maps (SOM) / Kohonen networks library and command line tool in Rust.

License: MIT License

Batchfile 4.28% Rust 95.72%
machine-learning self-organizing-map kohonen-map command-line kohonen som neural-network rust visualization

kohonen's Introduction

My projects and featured contributions:

Modelling Developer tools
Arche — Go entity component system
Finam — Python model coupling framework
rs-ecs — Rust entity component system
git-graph — Clear Git graphs. See for yourself!
git-igitt — Interactive TUI version of git-graph
yarner — Literate Programming in Markdown
Command line apps Games
track — Personal (work) time tracking
dirstat — Analyze and visualize disk usage
xwrd — Anagrams and word matching tool
chrono-photo — Chrono-photography tool
Tiny World — Tiny, slow-paced world building game
Cataclysm-DDA — Post-apocalyptic survival game
Planetary Defense — Colonize and defend a planet
Graviton — Puzzle with unique gravity mechanics

kohonen's People

Contributors

adamreichold avatar mlange-42 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

19h

kohonen's Issues

[Help] GodotNative: accessing Rust nodes from Rust nodes - Liftime problem

Trying to get a sibling node as Rust struct. Scene:

Node
 |- Kohonen
 '- Mapping

Trying to get the Rust Script attached to Kohonen, from Mapping:

use crate::Kohonen;
use gdnative::{Instance, Node2D, NodePath};

#[derive(gdnative::NativeClass)]
#[inherit(gdnative::Node2D)]
pub struct Mapping;

#[gdnative::methods]
impl Mapping {
    fn _init(_owner: gdnative::Node2D) -> Self {
        Mapping
    }

    #[export]
    fn _ready(&mut self, owner: gdnative::Node2D) {}

    #[export]
    pub fn _process(&mut self, owner: Node2D, _delta: f64) {}

    fn get_kohonen<'a>(&self, owner: &'a gdnative::Node2D) -> Option<&'a Kohonen> {
        let node = unsafe { owner.get_node(NodePath::from_str("../Kohonen")) };
        let koh: Option<&'a Kohonen> = node.and_then(|node| {
            Instance::<Kohonen>::try_from_base(node).map(|inst| inst.map(|koh, _| koh).unwrap())
        });
        koh
    }
}

Compiler errors:

error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
  --> kohvis\src\mapping_gd.rs:23:83
   |
23 |             Instance::<Kohonen>::try_from_base(node).map(|inst| inst.map(|koh, _| koh).unwrap())
   |                                                                                   ^^^
   |
note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 23:74...
  --> kohvis\src\mapping_gd.rs:23:74
   |
23 |             Instance::<Kohonen>::try_from_base(node).map(|inst| inst.map(|koh, _| koh).unwrap())
   |                                                                          ^^^^^^^^^^^^
note: ...so that the expression is assignable
  --> kohvis\src\mapping_gd.rs:23:83
   |
23 |             Instance::<Kohonen>::try_from_base(node).map(|inst| inst.map(|koh, _| koh).unwrap())
   |                                                                                   ^^^
   = note: expected  `&kohonen_gd::Kohonen`
              found  `&kohonen_gd::Kohonen`
note: but, the lifetime must be valid for the lifetime `'a` as defined on the method body at 20:20...
  --> kohvis\src\mapping_gd.rs:20:20
   |
20 |     fn get_kohonen<'a>(&self, owner: &'a gdnative::Node2D) -> Option<&'a Kohonen> {
   |                    ^^
note: ...so that the expression is assignable
  --> kohvis\src\mapping_gd.rs:22:40
   |
22 |           let koh: Option<&'a Kohonen> = node.and_then(|node| {
   |  ________________________________________^
23 | |             Instance::<Kohonen>::try_from_base(node).map(|inst| inst.map(|koh, _| koh).unwrap())
24 | |         });
   | |__________^
   = note: expected  `std::option::Option<&'a kohonen_gd::Kohonen>`
              found  `std::option::Option<&kohonen_gd::Kohonen>`

error: aborting due to previous error

SOM & units to file.

  • De-normalized / classified units to CSV file (DONE in 8a41ce9)
  • Raw SOM to file for re-reading and prediction/classification (DONE in 21da965 / version 0.2.0)
  • Find nearest unit for training data, and write to file

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.