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

predict and score functions #63

Open
pchronz opened this issue May 11, 2016 · 0 comments
Open

predict and score functions #63

pchronz opened this issue May 11, 2016 · 0 comments
Labels

Comments

@pchronz
Copy link

pchronz commented May 11, 2016

For some use cases predict and score functions would be helpful.
The predict function should return the assigned clusters for a set of observations like this for kmeans:

function predict(kmresult, X)
    dmat = Distances.pairwise(Distances.SqEuclidean(), kmresult.centers, X)   
    mod(findmin(dmat, 1)[2] .- 1, size(dmat, 1)) .+ 1
end

The score function should assign given observations and return the 1/totalcost for these observations and could look like this for kmeans:

function score(kmresult, X)
    dmat = Distances.pairwise(Distances.SqEuclidean(), kmresult.centers, X)   
    sum(findmin(dmat, 1)[1])
end

Of course, it would be great to have those functions for all of the available clustering algorithms.

@alyst alyst added the feature label Mar 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants