ææ¸éã®é¡ä¼¼åº¦ãæ±ããæ¹æ³ã®ä¸ã¤ã¨ãã¦ãã³ãµã¤ã³å°ºåº¦ãæãããã¾ããã³ãµã¤ã³å°ºåº¦ã¨ã¯ã2ã¤ã®ãã¯ãã«ã®ãªãè§åº¦ã§ãããææ¸ããã¯ãã«åãããã¨ã«ãããææ¸éã®é¡ä¼¼åº¦ãæ±ãããã¨ãåºæ¥ã¾ãã sub cosine_similarity { my ($vector_1, $vector_2) = @_; my $inner_product = 0.0; map { if ($vector_2->{$_}) { $inner_product += $vector_1->{$_} * $vector_2->{$_}; } } keys %{$vector_1}; my $norm_1 = 0.0; map { $norm_1 += $_ ** 2 } values %{$vector_1}; $norm_1 = sqrt($norm_1); my $norm_2 = 0.0; map { $nor
{{#tags}}- {{label}}
{{/tags}}