Skip to content

Instantly share code, notes, and snippets.

@horitaku1124
Created January 7, 2020 12:07
Show Gist options
  • Save horitaku1124/ae0c2cdd675d1f8f7208176b755fc89b to your computer and use it in GitHub Desktop.
Save horitaku1124/ae0c2cdd675d1f8f7208176b755fc89b to your computer and use it in GitHub Desktop.
multiple regression
# -*- coding: utf-8 -*-
import statsmodels.api as sm
import pandas as pd
from matplotlib import pyplot as plt
def main():
# 過去の案件データの取り込み(診断工数、画面数、診断員の経験値、Webサーバのレスポンス速度)
data = pd.read_csv('cpu_scores.csv', skiprows=1, names=['cores', 'threads', 'base_clock', 'boost_clock', 'L1_cache', 'L2_cache', 'L3_cache', 'CinebenchR20'], encoding='UTF_8')
# 画面数、診断員の経験値、Webサーバのレスポンス速度を説明変数として定義
x = data[['cores', 'threads', 'base_clock', 'boost_clock', 'L1_cache', 'L2_cache', 'L3_cache']]
# 定数項をxに加える
x = sm.add_constant(x)
# 診断工数を目的変数yとして定義
y = data['CinebenchR20']
# モデルを定義
model = sm.OLS(y, x, prepend=False)
# 重回帰分析の実行
results = model.fit()
# 分析結果の表示
print(results.summary())
if __name__ == '__main__':
main()
cpu cores threads base_clock boost_clock L1_cache L2_cache L3_cache CinebenchR20
Threadripper 3970X 32 64 3.7 4.5 3 16 128 16973
Threadripper 3960X 24 48 3.8 4.5 2.25 12 128 13551
Threadripper 2990WX 32 64 3 4.2 3 16 64 10972
Core i9 10980XE 18 36 3 4.6 1.1 18 24.75 8759
Ryzen9 3950X 16 32 3.5 4.7 1 8 64 9219
Ryzen9 3900X 12 24 3.5 4.6 0.768 6 64 7203
Core i9 9900KS 8 16 4 5 0.5 2 16 5180
Core i9 9980XE 18 36 3 4.5 1.1 18 24.75 8841
Ryzen7 3800X 8 16 3.9 4.5 0.512 4 32 5002
Core i9 9900K 8 16 3.6 5 0.5 2 16 4931
Ryzen7 3700X 8 16 3.6 4.4 0.512 4 32 4885
Ryzen5 3600X 6 12 3.8 4.4 0.384 3 32 3701
Core i7 9700K 8 8 3.6 4.9 0.512 2 12 3654
Ryzen5 3600 6 12 3.6 4.2 0.384 3 32 3582
Core i5 9600K 6 6 3.7 4.5 0.384 1.5 9 2586
Core i5 9400F 6 6 2.9 4.1 0.384 1.5 9 2317
Ryzen5 3400G 4 8 3.7 4.2 0.384 2 4 1928
Core i3 9100F 4 4 3.6 4.2 0.256 1 6 1568
Ryzen3 3200G 4 4 3.6 4 0.384 2 4 1480
Penrium Gold G5400 2 4 3.7 3.7 0.128 0.5 4 880
Athlon 200GE 2 4 3.2 3.2 0.192 1 4 798
Celeron G4900 2 2 3.1 3.1 0.128 0.5 6 534
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment