fn nested_clusters() {
    // Create a circuit of points and then a cluster in the centre
    // and ensure they are identified as two separate clusters
    let mut data: Array2<f64> = Array2::zeros((50, 2));
    let rising = Array1::linspace(0.0, 8.0, 10);
    data.column_mut(0).slice_mut(s![0..10]).assign(&rising);
    data.column_mut(0).slice_mut(s![10..20]).assign(&rising);
    data.column_mut(1).slice_mut(s![20..30]).assign(&rising);
    data.column_mut(1).slice_mut(s![30..40]).assign(&rising);

    data.column_mut(1).slice_mut(s![0..10]).fill(0.0);
    data.column_mut(1).slice_mut(s![10..20]).fill(8.0);
    data.column_mut(0).slice_mut(s![20..30]).fill(0.0);
    data.column_mut(0).slice_mut(s![30..40]).fill(8.0);

    data.column_mut(0).slice_mut(s![40..]).fill(5.0);
    data.column_mut(1).slice_mut(s![40..]).fill(5.0);

    let labels = AppxDbscan::params(2)
        .tolerance(1.0)
        .slack(1e-4)
        .predict(&data);

    assert!(labels.slice(s![..40]).iter().all(|x| x == &Some(0)));
    assert!(labels.slice(s![40..]).iter().all(|x| x == &Some(1)));
}
// Identical to the one in the Exact DBSCAN
Identical to the one in the Exact DBSCAN
Identical to the one in the Exact DBSCAN
fn nested_clusters() {
    // Create a circuit of points and then a cluster in the centre
    // and ensure they are identified as two separate clusters
    let mut data: Array2<f64> = Array2::zeros((50, 2));
    let rising = Array1::linspace(0.0, 8.0, 10);
    data.column_mut(0).slice_mut(s![0..10]).assign(&rising);
    data.column_mut(0).slice_mut(s![10..20]).assign(&rising);
    data.column_mut(1).slice_mut(s![20..30]).assign(&rising);
    data.column_mut(1).slice_mut(s![30..40]).assign(&rising);
    data.column_mut(1).slice_mut(s![0..10]).fill(0.0);
    data.column_mut(1).slice_mut(s![10..20]).fill(8.0);
    data.column_mut(0).slice_mut(s![20..30]).fill(0.0);
    data.column_mut(0).slice_mut(s![30..40]).fill(8.0);
    data.column_mut(0).slice_mut(s![40..]).fill(5.0);
    data.column_mut(1).slice_mut(s![40..]).fill(5.0);
    let labels = AppxDbscan::params(2)
        .tolerance(1.0)
        .slack(1e-4)
        .predict(&data);
    assert!(labels.slice(s![..40]).iter().all(|x| x == &Some(0)));
    assert!(labels.slice(s![40..]).iter().all(|x| x == &Some(1)));
}
fn nested_clusters ( ) { // Create a circuit of points and then a cluster in the centre // and ensure they are identified as two separate clusters let mut data : Array2 < f64 > = Array2 :: zeros ( ( 50 , 2 ) ) ; let rising = Array1 :: linspace ( 0.0 , 8.0 , 10 ) ; data . column_mut ( 0 ) . slice_mut ( s ! [ 0 10 ] ) . assign ( & rising ) ; data . column_mut ( 0 ) . slice_mut ( s ! [ 10 20 ] ) . assign ( & rising ) ; data . column_mut ( 1 ) . slice_mut ( s ! [ 20 30 ] ) . assign ( & rising ) ; data . column_mut ( 1 ) . slice_mut ( s ! [ 30 40 ] ) . assign ( & rising ) ; data . column_mut ( 1 ) . slice_mut ( s ! [ 0 10 ] ) . fill ( 0.0 ) ; data . column_mut ( 1 ) . slice_mut ( s ! [ 10 20 ] ) . fill ( 8.0 ) ; data . column_mut ( 0 ) . slice_mut ( s ! [ 20 30 ] ) . fill ( 0.0 ) ; data . column_mut ( 0 ) . slice_mut ( s ! [ 30 40 ] ) . fill ( 8.0 ) ; data . column_mut ( 0 ) . slice_mut ( s ! [ 40 ] ) . fill ( 5.0 ) ; data . column_mut ( 1 ) . slice_mut ( s ! [ 40 ] ) . fill ( 5.0 ) ; let labels = AppxDbscan :: params ( 2 ) . tolerance ( 1.0 ) . slack ( 1e-4 ) . predict ( & data ) ; assert ! ( labels slice ( s [ 40 ] ) iter ( ) all ( x x Some ( 0 ) ) ) ; assert ! ( labels slice ( s [ 40 ] ) iter ( ) all ( x x Some ( 1 ) ) ) ; }
Identical to the one in the Exact DBSCAN
Identical to the one in the Exact DBSCAN