pub struct Algo<Point: PartialEq + 'static> { /* private fields */ }
Expand description

Fits incoming points to a set of balls model.

The algorithm can fit any kind of points in a space that:

  • defines the square of the distance between two points,
  • defines the weighted center of two points.
use fluent_data::algorithm::Algo;
use fluent_data::model::Model;
use fluent_data::space;

let dataset = vec![
       vec![5., -1.],
       vec![1., 1.],
       vec![11., -9.],
   ];
let algo = Algo::new(space::euclid_dist, space::real_combine);
let mut model = Model::new(space::euclid_dist);
for i in 0..3 {
   algo.fit(&mut model, dataset[i].clone());
}
let mut balls = model.iter_balls();
let first = balls.next().unwrap();
assert_eq!(&vec![6., -4.], first.center());
assert_eq!(f64::sqrt(110.), first.radius());
assert!(first.weight() < 2.001 && first.weight() > 1.999);

Implementations

Creates a new algorithm for the given distance and combination functions.

Fits the incoming points to the given mixture model.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.