B:BD[
6.2399] → [
6.2399:2436]
fn tfidf_transformation_test() {
fn vectorization_hashing_normalised() {
let v = HashingVectorizer::new(16, 5, 5, true);
let t = array![
[
0.,
0.,
-0.35355339,
-0.35355339,
0.35355339,
0.,
0.,
-0.35355339,
-0.35355339,
0.,
0.,
-0.35355339,
-0.35355339,
0.,
-0.35355339,
0.
],
[
0.,
0.24253563,
-0.48507125,
-0.48507125,
0.24253563,
0.24253563,
0.,
0.24253563,
0.24253563,
0.,
-0.24253563,
0.,
-0.24253563,
0.,
-0.24253563,
-0.24253563
],
[
-0.63245553,
0.,
0.,
0.,
0.31622777,
0.31622777,
0.,
-0.31622777,
0.,
0.,
0.,
-0.31622777,
0.,
0.31622777,
-0.31622777,
0.
],
[
0.,
0.,
-0.70710678,
-0.35355339,
0.35355339,
0.,
0.,
-0.35355339,
-0.35355339,
0.,
0.,
0.,
0.,
0.,
0.,
0.
]
];
let mut r = v.fit_transform(&INPUT).to_dense();
r.mapv_inplace(|v| round_dec(v, 8));
assert_eq!(t, r);
}
#[test]
fn tfidf_transformation() {