File:Bias-variance decomposition.png
From Wikimedia Commons, the free media repository
Jump to navigation
Jump to search
Size of this preview: 800 × 480 pixels. Other resolution: 320 × 192 pixels.
Original file (1,000 × 600 pixels, file size: 141 KB, MIME type: image/png)
File information
Structured data
Captions
Summary
[edit]DescriptionBias-variance decomposition.png |
English: Bias-variance decomposition in the case of mean squared loss. The green dots are samples of test label at a fixed test feature . Their variance around the mean is the irreducible error . The red dots are test label predictions as the training set is randomly sampled. Their variance around the mean is the variance . The difference between the red dash and the green dash is the bias . The bias-variance decomposition is then visually clear: the mean squared error between the red dots and the green dots is the sum of the three components.
Matplotlib codeimport numpy as np
import matplotlib.pyplot as plt
# Set random seed for reproducibility
np.random.seed(42)
# Create figure and axis
fig, ax = plt.subplots(figsize=(10, 6))
# Remove y-axis and x-ticks
ax.yaxis.set_visible(False)
ax.set_xticks([])
# Set x_0
x_0 = 0
xmin, xmax = -np.pi /3 , np.pi/3
x = np.linspace(xmin, xmax, 1000)
# Plot curves
for _ in range(200):
epsilon = np.random.normal(0, 0.1)
y = 1 + (1 + epsilon) * np.cos(x) + epsilon
ax.plot(x, y, color='blue', alpha=0.1)
n_points = 500
x_jitter = np.random.normal(x_0, 0.01, n_points)
y_values = 1 + (1 + np.random.normal(0, 0.1, n_points)) * np.cos(x_0) + np.random.normal(0, 0.2, n_points)
ax.scatter(x_jitter, y_values, color='red', alpha=0.5, s=1, label=r"$f(x |
Date | |
Source | Own work |
Author | Cosmia Nebula |
Licensing
[edit]I, the copyright holder of this work, hereby publish it under the following license:
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
- You are free:
- to share – to copy, distribute and transmit the work
- to remix – to adapt the work
- Under the following conditions:
- attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
- share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
This media file is uncategorized.
Please help improve this media file by adding it to one or more categories, so it may be associated with related media files (how?), and so that it can be more easily found.
Please notify the uploader with {{subst:Please link images|File:Bias-variance decomposition.png}} ~~~~ |
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 01:47, 16 September 2024 | 1,000 × 600 (141 KB) | Cosmia Nebula (talk | contribs) | Uploaded while editing "Bias–variance tradeoff" on en.wikipedia.org |
You cannot overwrite this file.
File usage on Commons
There are no pages that use this file.
File usage on other wikis
The following other wikis use this file:
- Usage on en.wikipedia.org
Metadata
This file contains additional information such as Exif metadata which may have been added by the digital camera, scanner, or software program used to create or digitize it. If the file has been modified from its original state, some details such as the timestamp may not fully reflect those of the original file. The timestamp is only as accurate as the clock in the camera, and it may be completely wrong.
Software used | |
---|---|
Horizontal resolution | 39.37 dpc |
Vertical resolution | 39.37 dpc |