mlange-42 / kohonen Goto Github PK
View Code? Open in Web Editor NEWA Self-organizing Maps (SOM) / Kohonen networks library and command line tool in Rust.
License: MIT License
A Self-organizing Maps (SOM) / Kohonen networks library and command line tool in Rust.
License: MIT License
Implement CLI options:
--query
: filter training data by some script expression--calc
: calculate new columns in training data, e.g. log transformTest an implementation of the algorithm described in:
Berglund & Sitte 2006: The Parameterless Self-Organizing Map Algorithm
In addition to Y-X-fused Super-SOMs (XYF), implement bi-direction SOMs (BDK).
Implement label propagation
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.