2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

シンデレラガールズで最も体型の近い二人は誰?

Posted at

前回の続きというかおまけみたいな感じ.
ソースコードはここ

やること

全員分のcos類似度を計算するだけ。データは(身長,体重,B,W,H)の5次元ベクトル。190人いるので、組合せは~~190×189×(1/2)=17955通りあります。~~4人抜いてるので186×185×(1/2)=17205通りでした。

コード

前回と概ね同じです。

import numpy as np
import pandas as pd

# csv読み込み
df=pd.read_csv("cg.csv")

# 内積
def ip(a,b):
  return (a*b).sum()
# ノルム
def norm(x):
  sum=(x*x).sum()
  return np.sqrt(sum)
# 類似度
def sim(a,b):
  return ip(a,b)/(norm(a)*norm(b))

# 名前と計算結果をリストに保存
name1list=[]
name2list=[]
simlist=[]
count = 0 #計算の進捗確認用
for i in range(0,185):
  for j in range(i+1,186):
    result=sim(df.iloc[i,1:6],df.iloc[j,1:6])
    count+=1
    if count%1000==0:
      print(result)
    name1list.append(df.iloc[i,0])
    name2list.append(df.iloc[j,0])
    simlist.append(result)

# 新たにデータフレームを作成
df_result=pd.DataFrame({'name1':name1list, 'name2':name2list, 'sim':simlist})

# 類似度top10を出力
print(df_result.sort_values("sim",ascending=False).iloc[0:10])

結果
スクリーンショット 2019-09-26 0.52.50.png

一番類似度が高かったのは里奈とライラさんでした。けっこう意外?
数値見比べてみるとこんな感じ。

|身長|体重|B|W|H
---|---|---|---|---|---
藤本里奈|154|41|77|55|80
ライラ|150|40|75|54|78

確かに近いですね。里奈がライラさんのほぼ上位互換といったところ(失礼).調べてみたらこの二人,2014年のクリスマスガチャで絡んでるんですね.ユニットとかあったら個人的に面白いと思う.
他にも、飛鳥と頼子、イヴとほたるが同率で2位だったり、けっこう面白い結果になりました。

まとめ

ライラさんは成長するとぽよる(暴論)

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?