1. 概要
本分析では、合計種族値600のドラゴンタイプ(いわゆる「600族」)ポケモンにおける
攻撃(Attack)と素早さ(Speed)のトレードオフ関係を、
20種類以上の機械学習モデルを用いて回帰分析した。
目的は、
- 「速いほど火力が落ちる」という傾向(反比例的関係)を数値的に検証すること
- 線形・非線形・木構造・ニューラル系モデルなどによる近似特性の比較
2. データセット概要
| 世代 | ポケモン | タイプ | 攻撃 | 素早さ |
|---|---|---|---|---|
| I | カイリュー | ドラゴン / ひこう | 134 | 80 |
| III | ボーマンダ | ドラゴン / ひこう | 135 | 100 |
| IV | ガブリアス | ドラゴン / じめん | 130 | 102 |
| V | サザンドラ | あく / ドラゴン | 105 | 98 |
| VI | ヌメルゴン | ドラゴン | 100 | 80 |
| VII | ジャラランガ | かくとう / ドラゴン | 110 | 85 |
| VIII | ドラパルト | ドラゴン / ゴースト | 120 | 142 |
| IX | セグレイブ | こおり / ドラゴン | 145 | 87 |
3. 使用モデル一覧
線形・非線形・アンサンブル・ニューラルなど多様な手法を採用。
| カテゴリ | モデル例 |
|---|---|
| 線形回帰 | Linear, Ridge, Lasso, ElasticNet, BayesianRidge, TheilSen |
| 非線形 | Polynomial (3次), SVR (Linear/RBF), KNN |
| 木構造 | DecisionTree, ExtraTree, RandomForest, ExtraTrees |
| アンサンブル | GradientBoosting, AdaBoost, Bagging, HistGradientBoosting |
| 確率・ベイズ | GaussianProcess |
| ニューラル | MLPRegressor (8×8層) |
4. 回帰結果(概要)
■ 平均的な傾向
-
線形モデル群(Linear, Ridge, Lasso)は、全体的に「ほぼ水平」の関係を学習。
→ 全体平均122前後の値に収束(強いトレードオフは検出せず)。 -
**非線形モデル(Polynomial, SVR, KNN)**は局所的変動を捉え、
高速ポケモン(ドラパルト)や鈍足高火力(セグレイブ)をより正確に表現。 -
木構造・アンサンブル系は学習データ点が少ないため、
特定点(例:145, 87)に過学習傾向を示した。 -
**ニューラルネット(MLP)**はやや不安定で、外れ値(ドラパルトなど)に大きく反応。
5. 各モデルの特徴と数値例
| モデル | 傾向 | Dragonite (S=80) | Dragapult (S=142) | Baxcalibur (S=87) |
|---|---|---|---|---|
| Linear | 平均近似(弱い負の傾向) | 122.0 | 123.3 | 122.2 |
| Polynomial (deg=3) | 非線形・曲線近似 | 117.3 | 120.1 | 124.9 |
| SVR (RBF) | 高速側に鋭敏反応 | 107.5 | 119.9 | 127.7 |
| Random Forest | 部分的過学習 | 116.6 | 122.7 | 134.0 |
| Gaussian Process | 滑らかなガウス曲線 | 112.9 | 120.0 | 145.0 |
| Neural Net (MLP) | 変動大(非線形過適合) | 101.3 | 165.9 | 108.6 |
6. 解釈と考察
-
全体として、**攻撃 × 素早さ ≈ 定数(約12000前後)**という
弱い反比例傾向が見られるが、完全な法則ではない。
→ 例:- ドラパルト (A=120, S=142) → 高速低火力傾向
- セグレイブ (A=145, S=87) → 鈍足高火力傾向
- ガブリアス (A=130, S=102) → バランス型
-
多くのモデルは速度の上昇と攻撃低下のバランス関係を暗に学習しており、
特にSVRやPolynomial回帰は**現実の設計思想(高速型/鈍足型の棲み分け)**に近い曲線を描いた。
7. 結論
| 観点 | 内容 |
|---|---|
| 主な関係 | 攻撃と素早さの間には弱い反比例的トレードオフが存在。 |
| 有効なモデル | Polynomial(3次), SVR(RBF), GaussianProcess が現実的カーブを再現。 |
| 平均基準 | 線形モデル群は平均攻撃値122付近で平坦化。 |
| 実際の意味 | 「速いドラゴンは火力を抑え、遅いドラゴンはパワー型」という設計指針を統計的に裏付け。 |
!pip install numpy pandas matplotlib scikit-learn
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.linear_model import (
LinearRegression, Ridge, Lasso, ElasticNet, HuberRegressor,
BayesianRidge, TheilSenRegressor
)
from sklearn.svm import SVR, LinearSVR
from sklearn.tree import DecisionTreeRegressor, ExtraTreeRegressor
from sklearn.ensemble import (
RandomForestRegressor, GradientBoostingRegressor, AdaBoostRegressor,
BaggingRegressor, ExtraTreesRegressor, HistGradientBoostingRegressor
)
from sklearn.neighbors import KNeighborsRegressor
from sklearn.gaussian_process import GaussianProcessRegressor
from sklearn.gaussian_process.kernels import RBF, ConstantKernel as C
from sklearn.neural_network import MLPRegressor
from sklearn.preprocessing import PolynomialFeatures
from sklearn.pipeline import make_pipeline
# ==============================
# Dataset (Dragon-Type Pseudo-Legendaries, Base Stat Total = 600)
# ==============================
data = {
"Generation": ["I", "III", "IV", "V", "VI", "VII", "VIII", "IX"],
"Pokemon": ["Dragonite", "Salamence", "Garchomp", "Hydreigon",
"Goodra", "Kommo-o", "Dragapult", "Baxcalibur"],
"Attack": [134, 135, 130, 105, 100, 110, 120, 145],
"Speed": [80, 100, 102, 98, 80, 85, 142, 87]
}
df = pd.DataFrame(data)
X = df[["Speed"]].values
y = df["Attack"].values
# ==============================
# Model Dictionary (20+ Regression Algorithms)
# ==============================
models = {
"Linear": LinearRegression(),
"Ridge": Ridge(alpha=1.0),
"Lasso": Lasso(alpha=0.01, max_iter=10000),
"ElasticNet": ElasticNet(alpha=0.01, l1_ratio=0.5),
"Huber": HuberRegressor(),
"BayesianRidge": BayesianRidge(),
"TheilSen": TheilSenRegressor(),
"Polynomial (deg=3)": make_pipeline(PolynomialFeatures(3), LinearRegression()),
"SVR (Linear)": LinearSVR(max_iter=5000),
"SVR (RBF)": SVR(kernel="rbf", C=50, gamma=0.05),
"KNN (k=3)": KNeighborsRegressor(n_neighbors=3),
"Decision Tree": DecisionTreeRegressor(max_depth=3, random_state=0),
"Extra Tree": ExtraTreeRegressor(random_state=0),
"Random Forest": RandomForestRegressor(n_estimators=100, random_state=0),
"Extra Trees": ExtraTreesRegressor(n_estimators=100, random_state=0),
"AdaBoost": AdaBoostRegressor(n_estimators=100, random_state=0),
"Bagging": BaggingRegressor(n_estimators=50, random_state=0),
"Gradient Boosting": GradientBoostingRegressor(random_state=0),
"HistGradientBoosting": HistGradientBoostingRegressor(random_state=0),
"Gaussian Process": GaussianProcessRegressor(kernel=C(1.0)*RBF(length_scale=20.0)),
"Neural Network (MLP)": MLPRegressor(hidden_layer_sizes=(8,8),
activation='relu', solver='adam',
max_iter=5000, random_state=0)
}
# ==============================
# Visualization
# ==============================
x_grid = np.linspace(min(df["Speed"]) - 10, max(df["Speed"]) + 10, 300).reshape(-1, 1)
plt.figure(figsize=(10,6))
plt.scatter(df["Speed"], df["Attack"], color="black", s=50, label="Pokémon Data (BST=600)")
for name, model in models.items():
try:
model.fit(X, y)
y_pred = model.predict(x_grid)
plt.plot(x_grid, y_pred, label=name, alpha=0.7)
except Exception as e:
print(f"Skipped {name}: {e}")
plt.title("Attack–Speed Regression (Pseudo-Legendary Dragons, 20+ ML Models)", fontsize=13)
plt.xlabel("Speed (S)")
plt.ylabel("Attack (A)")
plt.legend(fontsize=7)
plt.grid(True)
plt.tight_layout()
plt.show()
# ==============================
# Prediction Table
# ==============================
print("=== Model Predictions (Attack vs Speed) ===")
for name, model in models.items():
try:
y_pred = model.predict(X)
df[name] = np.round(y_pred, 2)
except:
df[name] = np.nan
print(df.to_string(index=False))

=== Model Predictions (Attack vs Speed) ===
Generation Pokemon Attack Speed Linear Ridge Lasso ElasticNet Huber BayesianRidge TheilSen Polynomial (deg=3) SVR (Linear) SVR (RBF) KNN (k=3) Decision Tree Extra Tree Random Forest Extra Trees AdaBoost Bagging Gradient Boosting HistGradientBoosting Gaussian Process Neural Network (MLP)
I Dragonite 134 80 122.05 122.05 122.05 122.05 122.04 122.37 100.41 117.25 102.11 107.54 114.67 117.00 117.0 116.56 117.0 117.00 117.25 117.01 122.38 112.88 101.28
III Salamence 135 100 122.44 122.44 122.44 122.44 122.32 122.38 106.05 125.45 127.46 121.66 123.33 128.33 135.0 128.05 135.0 130.00 127.30 134.96 122.38 135.00 122.11
IV Garchomp 130 102 122.48 122.48 122.48 122.48 122.34 122.38 106.62 124.48 130.00 130.10 123.33 128.33 130.0 129.25 130.0 130.00 128.10 130.01 122.38 130.00 124.19
V Hydreigon 105 98 122.40 122.40 122.40 122.40 122.29 122.38 105.49 126.21 124.93 105.58 123.33 105.00 105.0 112.75 105.0 105.00 114.10 105.03 122.38 105.00 120.02
VI Goodra 100 80 122.05 122.05 122.05 122.05 122.04 122.37 100.41 117.25 102.11 107.54 114.67 117.00 117.0 116.56 117.0 117.00 117.25 117.01 122.38 112.88 101.28
VII Kommo-o 110 85 122.14 122.14 122.14 122.14 122.11 122.37 101.82 123.38 108.45 110.10 118.33 110.00 110.0 120.73 110.0 114.67 118.63 110.02 122.38 110.00 106.48
VIII Dragapult 120 142 123.27 123.27 123.26 123.27 122.90 122.38 117.89 120.07 180.71 119.90 128.33 128.33 120.0 122.70 120.0 120.00 122.50 120.02 122.38 120.00 165.85
IX Baxcalibur 145 87 122.18 122.18 122.18 122.18 122.14 122.37 102.39 124.92 110.99 127.72 118.33 145.00 145.0 134.03 145.0 145.00 134.73 144.95 122.38 145.00 108.57