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

Mahalanobis distance metric #14

Open
1 of 2 tasks
niekdt opened this issue Jan 6, 2021 · 2 comments
Open
1 of 2 tasks

Mahalanobis distance metric #14

niekdt opened this issue Jan 6, 2021 · 2 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@niekdt
Copy link
Collaborator

niekdt commented Jan 6, 2021

Implement the Mahalanobis Distance (MD) as an internal metric. As MD is a distance measure, it could be used in different ways: measuring the distance of the trajectories to their most likely cluster trajectory, or measuring the distances between cluster trajectories.

Variations:

  • MD: Mean distance of trajectories to their most likely cluster, the default approach. Applicable to any method with an implementation of clusterTrajectories().
  • [ ] MD.fitted: Mean distance of the fitted trajectories to their most likely cluster. Not applicable to many methods (e.g., KmL), as this would always be zero. On second thought, this cannot be computed for most models as the covariance matrix will be singular because of the similarity between fitted trajectories under a parametric model.
  • MD.cluster: Mean distance between cluster trajectories. This provides useful insights into how far clusters are removed from each other. This is commonly used in the two-cluster case.
@niekdt niekdt added the enhancement New feature or request label Jan 6, 2021
@niekdt niekdt added the help wanted Extra attention is needed label Apr 25, 2021
@niekdt niekdt added the good first issue Good for newcomers label Jun 15, 2021
@niekdt niekdt removed the help wanted Extra attention is needed label Oct 18, 2021
@niekdt niekdt changed the title Add metrics for cluster separation Mahalanobis distance metric Nov 3, 2021
@niekdt niekdt self-assigned this Nov 3, 2021
niekdt added a commit that referenced this issue Nov 4, 2021
@SeoYeonJu4382
Copy link

Thank you for great develop for distance matrix change.
But i have some question,

my code

options(latrend.id = "Id", latrend.time = "Time")
for(d_n in c("Mahalanobis")){
kmlMethod_i <- lcMethodKML(response = "Y", nClusters = 3, distanceName = d_n)
model_i <- latrend(kmlMethod_i, data = latrendData)
summary(model_i)
print(plot(model_i))
}

as you mention that i try toy experiments but i got
"Error in distance(x, clustersCenter[1, ]) : unused arguments (x, clustersCenter[1, ]): " message can i ask what is worng with my code?

and also i want to use correlation distance too. but it cannot be possible now.
is there any comments and possible way?

i really want to know your answer or feedback.
I look forward to hearing from you.

@niekdt
Copy link
Collaborator Author

niekdt commented Apr 30, 2024

Thanks for reporting this, I'll look into it.

It's not yet possible to compute the correlation distance. Is there a package that has a function for that, that I could add?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants