• Skip to main content
  • Skip to primary sidebar

学習記録

コサイン類似度

2017年12月11日 by 河副 太智 Leave a Comment

コサイン類似度は、2つのベクトルがどれくらい似ているかの指標
2つのベクトル

a⃗ =(a1,a2,⋯,an)
b⃗ =(b1,b2,⋯,bn)

 

の場合以下の式になる

 

コサイン類似度を求める式

1
2
3
4
from scipy.spatial.distance import cosine
vec_a = np.array([1, 2, 3])
vec_b = np.array([2, 3, 4])
print(1 - cosine(vec_a, vec_b))

 

このエントリーをはてなブックマークに追加

Tweet
[`yahoo` not found]
このエントリーを Google ブックマーク に追加
LinkedIn にシェア
LINEで送る


Filed Under: 数学

Reader Interactions

コメントを残す コメントをキャンセル

メールアドレスが公開されることはありません。 ※ が付いている欄は必須項目です

Primary Sidebar

カテゴリー

  • AWS
  • Bootstrap
  • Dash
  • Django
  • flask
  • GIT(sourcetree)
  • Plotly/Dash
  • VPS
  • その他tool
  • ブログ
  • プログラミング
    • Bokeh
    • css
    • HoloViews
    • Jupyter
    • Numpy
    • Pandas
    • PosgreSQL
    • Python 基本
    • python3
      • webアプリ
    • python3解説
    • scikit-learn
    • scipy
    • vps
    • Wordpress
    • グラフ
    • コマンド
    • スクレイピング
    • チートシート
    • データクレンジング
    • ブロックチェーン
    • 作成実績
    • 時系列分析
    • 機械学習
      • 分析手法
      • 教師有り
    • 異常値検知
    • 自然言語処理
  • 一太郎
  • 数学
    • sympy
      • 対数関数(log)
      • 累乗根(n乗根)
    • 暗号学

Copyright © 2025 · Genesis Sample on Genesis Framework · WordPress · Log in