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 with missing entries #12

Closed
thevolatilebit opened this issue Dec 2, 2023 · 0 comments
Closed

Mahalanobis distance with missing entries #12

thevolatilebit opened this issue Dec 2, 2023 · 0 comments
Assignees
Labels
question Further information is requested

Comments

@thevolatilebit
Copy link
Collaborator

The Mahalanobis distance between a state with missing readouts for a subset of features and a "historical" row is essentially calculated as if we were setting the missing entry equal to the respective record in the "historical" row. See the following link for reference:

compute_distances = function (evidence::Evidence)
if isempty(evidence)
return zeros(nrow(data))
else
vec_evidence = map(colname -> get(evidence, colname, 0), non_targets)
distances = map(eachrow(data)) do row
vec_row = map(
colname -> haskey(evidence, colname) ? row[colname] : 0,
non_targets,
)
z = vec_evidence - vec_row
dot(z, Λ * z)
end

However, this might not be the optimal approach. For more information, consider the following resources: https://search.r-project.org/CRAN/refmans/modi/html/MDmiss.html and also https://www.jstor.org/stable/3559861, particularly on page 285.

@thevolatilebit thevolatilebit added the question Further information is requested label Dec 2, 2023
@thevolatilebit thevolatilebit self-assigned this Dec 2, 2023
thevolatilebit added a commit that referenced this issue Dec 3, 2023
- Implemented a variant of sq. Mahalanobis distance
with missing entries, see https://www.jstor.org/stable/3559861
on page 285, fixes #12
- Renamed `MahalanobisDistance` to `SquaredMahalanobisDistance`
- Minor adjustments to tutorials
- Removed extra dependencies
- Incremented version

Fixes #11 and #12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant