https://github.com/vaaaaanquish/label-propagation-rs
Label Propagation Algorithm by Rust. Label propagation (LP) is graph-based semi-supervised learning (SSL). LGC and CAMLP have been implemented.
https://github.com/vaaaaanquish/label-propagation-rs
graph graph-algorithms machine-learning machine-learning-algorithms rust rust-lang semi-supervised-learning
Last synced: 1 day ago
JSON representation
Label Propagation Algorithm by Rust. Label propagation (LP) is graph-based semi-supervised learning (SSL). LGC and CAMLP have been implemented.
- Host: GitHub
- URL: https://github.com/vaaaaanquish/label-propagation-rs
- Owner: vaaaaanquish
- License: mit
- Created: 2021-08-20T13:25:12.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-08-26T20:27:15.000Z (over 3 years ago)
- Last Synced: 2025-04-22T04:13:25.101Z (8 days ago)
- Topics: graph, graph-algorithms, machine-learning, machine-learning-algorithms, rust, rust-lang, semi-supervised-learning
- Language: Rust
- Homepage: https://github.com/vaaaaanquish/label-propagation-rs
- Size: 13.7 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# label-propagation-rs
Label Propagation Algorithm by Rust.
Label propagation (LP) is graph-based semi-supervised learning (SSL).
A simple LGC and a more advanced CAMLP have been implemented.
# Usage
You can find the examples in the examples directory.
The label is a continuous value of `[0, class_n]`, and the result of `predict_proba` is the value of the label.
```rust
use std::result::Result;
use std::error::Error;extern crate label_propagation;
extern crate ndarray;
extern crate ndarray_stats;use ndarray::prelude::*;
use label_propagation::{CAMLP, LGC};
use ndarray::Array;pub fn main() -> Result<(), Box> {
// make graph matrix ndarray
let graph = Array::from_shape_vec(
(3, 3),
vec![0.0, 0.3, 0.0, 0.3, 0.0, 0.0, 0.0, 0.0, 0.0]).unwrap();// node index for label
let x = array![0, 1];
// label
let y = array![0, 1];// make model
let mut model = CAMLP::new(graph).iter(30).beta(0.1);
// let mut model = LGC::new(graph).iter(30).alpha(0.99);model.fit(&x, &y)?;
let target = array![0, 1];
let result = model.predict_proba(&target);
println!("{:?}", result);Ok(())
}
```# develop
```sh
docker build -t graph .
docker run -it -v $PWD:/app graph bash
```# Thanks
- Local and Global Consistency (LGC) [Zhou+, NIPS'04] https://dennyzhou.github.io/papers/LLGC.pdf
- Core model in Confidence-Aware Modulated Label Propagation (CAMLP) [Yamaguchi+, SDM'16] https://epubs.siam.org/doi/pdf/10.1137/1.9781611974348.58
- [yamaguchiyuto/label_propagation](https://github.com/yamaguchiyuto/label_propagation) - Implementations of label propagation like algorithms, python