-
Notifications
You must be signed in to change notification settings - Fork 74
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
panick when use CosineSimilarity
#17
Comments
yes, you are right, because it's float type(https://en.wikipedia.org/wiki/IEEE_754) which have lots of situations, such as NaN. it can not be compared, so I have to make sure for every place where has use I will fix it as soon as possible and do something to avoid invalid value(maybe just panic?). |
hi @vaaaaanquish, I’ve read a post about hora as I was googling this project. Is it written by you? ;-) your application is great👍👍👍, and if you want to reach hora's full potential, you can enable firstly, use some command, such as export RUSTFLAGS='-C target-feature=+avx2,+fma' and in your hora = {version = "0.1.0", features = ["simd"]} then, use PS: The lack of SIMD-supported documents is my carelessness 😢, I will fill it up immediately, for more information, you can check this documentation, feel free to contribute! |
@salamer Thank you. PS: I published example, and I will do some PR in the future. Thx good project 😄 |
Can I display this example link in I think this is a very complete and great example. The model in my demo is still in Python ( Finally, thanks for using BTW, I'm continuing to study Japanese, |
Of course. I'm glad :)
Wow. I was wondering why. It's an interesting connection! |
my Japanese level may only be able to read but not the level of daily communication 😂. and of course, the most direct benefit of learning Japanese is to help the Japanese doc which I am writing 😂. |
As far as I can tell, this is because the dot product of a vector and itself is always negative, so the square root is always NaN. Is this intentional? It seems like it is as there is a test in calc.rs: #[cfg(test)]
mod tests {
use crate::core::calc::dot;
#[test]
fn test_dot() {
let a = [1., 2., 3.];
let b = [1., 2., 3.];
assert_eq!(dot::<f32>(&a, &b).unwrap(), -14.0);
}
} And both the simd and non-simd implementations negate the sums:
Removing the negation allows cosine similarity to work. Any suggestions about where to go from here? |
Great repository! I was able to integrate hora search into a rust application even as an inexperienced rust programmer. But I cannot use What is the status of a fix here? |
I'm getting the same crash. Euclidian works, but not Cosine Similarity. |
Hi.
With the latest hora, I get a panic when using
hora::core::metrics::Metric::CosineSimilarity
.I think this is an error caused by
partial_cmp
.partial_cmp
expect it to be None when the given value cannot be ordered.The text was updated successfully, but these errors were encountered: