پرونده:Traintest.svg

پروندهٔ اصلی(پروندهٔ اس‌وی‌جی، با ابعاد ۷۲۰ × ۲۷۰ پیکسل، اندازهٔ پرونده: ۳۵ کیلوبایت)

خلاصه

توضیح
English: Plots showing a training set and a test set from the same statistical population. Two curves are fit to the training set, one of which is an overfit. By plotting these curves with the test data, the overfitting can be seen.
تاریخ
منبع اثر شخصی
پدیدآور Skbkekas
دیگر نسخه‌ها

[ویرایش]

SVG genesis
InfoField
 
کد مبدأ این پروندهٔ گرافیک برداری مقیاس‌پذیر، معتبر.
 
این گرافیک با Matplotlib ساخته شده است
کد منبع
InfoField

Python code

import numpy as np
import matplotlib.pyplot as plt

m = 0.2 ## mesh on the abscissa
s = 3 ## standard deviation of errors

def pdesign(X, d):
    """Generate a polynomial design matrix on X of order d."""
    V = X[:,np.newaxis]
    F = [V**k for k in range(d+1)]
    D = np.concatenate(F, axis=1)
    return D

def regfit(Y, D):
    """Regress Y on D using least squares."""
    U,S,Vt = np.linalg.svd(D,0)
    V = np.transpose(Vt)
    return np.dot(U, np.dot(np.transpose(U), Y))

X = np.arange(-2, 2, m, dtype=np.float64)

D1 = pdesign(X, 3)
D2 = pdesign(X, 13)

EY = X + X**3
Y1 = EY + np.random.normal(size=len(X))*s
Y2 = EY + np.random.normal(size=len(X))*s

Yhat1 = regfit(Y1, D1)
Yhat2 = regfit(Y1, D2)

plt.clf()
plt.figure(figsize=(8,3))
ax1 = plt.axes([0.06,0.1,0.4,0.8])
plt.title("Training set")
plt.plot(X, Y1, 'o')
plt.hold(True)
plt.plot(X, Yhat1, '-', color='green')
plt.plot(X, Yhat2, '-', color='orange')
ax1.set_ylim(-10, 10)
ax1.set_xticks([-2,-1,0,1,2])
ax2 = plt.axes([0.56,0.1,0.4,0.8])
plt.title("Test set")
plt.plot(X, Y2, 'o')
plt.plot(X, Yhat1, '-', color='green')
plt.plot(X, Yhat2, '-', color='orange')
ax2.set_xticks([-2,-1,0,1,2])
ax2.set_ylim(-10, 10)
plt.savefig("traintest.png")
plt.savefig("traintest.svg")

print ((Yhat1-Y1)**2).mean()
print ((Yhat2-Y1)**2).mean()

print ((Yhat1-Y2)**2).mean()
print ((Yhat2-Y2)**2).mean()

اجازه‌نامه

من، صاحب حقوق قانونی این اثر، به این وسیله این اثر را تحث اجازه‌نامهٔ ذیل منتشر می‌کنم:
w:fa:کرییتیو کامنز
انتساب
این پرونده با اجازه‌نامهٔ کریتیو کامانز Attribution 3.0 بومی نشده منتشر شده است.
شما اجازه دارید:
  • برای به اشتراک گذاشتن – برای کپی، توزیع و انتقال اثر
  • تلفیق کردن – برای انطباق اثر
تحت شرایط زیر:
  • انتساب – شما باید اعتبار مربوطه را به دست آورید، پیوندی به مجوز ارائه دهید و نشان دهید که آیا تغییرات ایجاد شده‌اند یا خیر. شما ممکن است این کار را به هر روش منطقی انجام دهید، اما نه به هر شیوه‌ای که پیشنهاد می‌کند که مجوزدهنده از شما یا استفاده‌تان حمایت کند.

عنوان

شرحی یک‌خطی از محتوای این فایل اضافه کنید

آیتم‌هایی که در این پرونده نمایش داده شده‌اند

توصیف‌ها

source of file انگلیسی

تاریخچهٔ پرونده

روی تاریخ/زمان‌ها کلیک کنید تا نسخهٔ مربوط به آن هنگام را ببینید.

تاریخ/زمانبندانگشتیابعادکاربرتوضیح
کنونی‏۱۲ مهٔ ۲۰۰۹، ساعت ۰۴:۳۳تصویر بندانگشتی از نسخهٔ مورخ ‏۱۲ مهٔ ۲۰۰۹، ساعت ۰۴:۳۳۷۲۰ در ۲۷۰ (۳۵ کیلوبایت)Skbkekas{{Information |Description={{en|1=Plots showing a training set and a test set from the same statistical population. Two curves are fit to the training set, one of which is an overfit. By plotting these curves with the test data, the overfitting can be s

صفحهٔ زیر از این تصویر استفاده می‌کند:

کاربرد سراسری پرونده

ویکی‌های دیگر زیر از این پرونده استفاده می‌کنند: