Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add facades and helpers to simplify usage #40

Open
bdelespierre opened this issue May 3, 2022 · 0 comments
Open

Add facades and helpers to simplify usage #40

bdelespierre opened this issue May 3, 2022 · 0 comments
Assignees
Milestone

Comments

@bdelespierre
Copy link
Owner

bdelespierre commented May 3, 2022

Proposed change

$data = [
    [80,55],[86,59],[19,85],[41,47],[57,58],
    [76,22],[94,60],[13,93],[90,48],[52,54],
    [62,46],[88,44],[85,24],[63,14],[51,40],
    [75,31],[86,62],[81,95],[47,22],[43,95],
    [71,19],[17,65],[69,21],[59,60],[59,12],
    [15,22],[49,93],[56,35],[18,20],[39,59],
    [50,15],[81,36],[67,62],[32,15],[75,65],
    [10,47],[75,18],[13,45],[30,62],[95,79],
    [64,11],[92,14],[94,49],[39,13],[60,68],
    [62,10],[74,44],[37,42],[97,60],[47,73],
];

// should auto-detect the arity of the euclidean space
$results = kmeans($data, clusters: 3);

For GPS coordinates

$cities = [
    [48.85889, 2.32004], // Paris
    [45.75781, 4.83201], // Lyon
    [43.29617, 5.36995], // Marseille
];

$results = kmeans_gps($cities, clusters: 1);
@bdelespierre bdelespierre added this to the v3.0 milestone May 3, 2022
@bdelespierre bdelespierre self-assigned this May 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant