![]() |
図 ◆政策,■政党.政策とそれに賛成する政党が近くにある…はず |
以下コード
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import numpy | |
# データ読み込み | |
f = open('nihonseiji.txt') | |
head = f.readline() | |
parties = head.strip().split('\t')[1:] | |
vlist = [] | |
for line in f: | |
cols = line.strip().split('\t') | |
matches = [float(col) for col in cols[1:]] | |
vlist.append(matches) | |
A = numpy.vstack(vlist) | |
# 標準化 | |
A = (A - numpy.mean(A, axis=0)) / numpy.std(A, axis=0) | |
# 特異値分解 | |
U, s, Vh = numpy.linalg.svd(A) | |
# 表示 | |
r, c = U.shape | |
for i in range(r): | |
print "\t".join([str(U[i,j]) for j in range(c)]) | |
r, c = Vh.shape | |
for i in range(c): | |
print "\t".join([str(Vh[j,i]) for j in range(r)]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
政策 民主党 自由民主党 日本未来の党 公明党 日本維新の会 みんなの党 日本共産党 社会民主党 国民新党 新党大地 新党改革 | |
消費税増税 1 1 -1 1 1 -1 -1 -1 1 -1 1 | |
TPP参加 1 -1 -1 -1 0 1 -1 -1 -1 -1 1 | |
脱原発 1 -1 1 0 -1 1 1 1 -1 1 0 | |
郵政民営化 -1 -1 -1 -1 1 1 -1 -1 -1 -1 -1 | |
後期高齢者医療制度廃止 1 -1 1 -1 1 1 1 1 0 1 0 | |
児童手当拡充 1 -1 1 0 0 -1 0 1 1 0 1 | |
日米同盟維持 1 1 1 1 1 1 -1 -1 1 0 1 | |
年金一元化 1 -1 1 -1 1 -1 1 1 0 1 -1 | |
道州制導入 -1 1 1 1 1 1 -1 -1 1 0 1 | |
議員定数削減 1 1 1 0 1 0 -1 -1 1 1 1 | |
憲法9条改正 0 1 0 -1 0 1 -1 -1 1 1 1 | |
高校無償化 1 -1 1 1 1 -1 1 1 1 0 0 | |
最低賃金引き上げ 0 -1 0 0 0 0 1 1 0 1 -1 | |
政治献金禁止 -1 -1 0 1 0 1 1 1 -1 1 1 | |
裁判員制度維持 1 1 0 1 0 0 -1 -1 -1 -1 0 | |
マイナンバー導入 1 0 1 0 1 1 -1 -1 1 0 1 | |
尖閣諸島実効支配強化 -1 1 -1 -1 1 0 -1 -1 1 -1 0 | |
外国人参政権付与 1 -1 1 1 -1 -1 1 1 -1 1 0 | |
公共事業継続 -1 1 1 1 -1 -1 -1 -1 1 1 -1 | |
日銀法改正 1 0 1 1 1 1 -1 1 0 0 0 |
No comments:
Post a Comment