File:Svr epsilons demo.svg
From Wikimedia Commons, the free media repository
Jump to navigation
Jump to search
Size of this PNG preview of this SVG file: 800 × 400 pixels. Other resolutions: 320 × 160 pixels | 640 × 320 pixels | 1,024 × 512 pixels | 1,280 × 640 pixels | 2,560 × 1,280 pixels | 900 × 450 pixels.
Original file (SVG file, nominally 900 × 450 pixels, file size: 65 KB)
File information
Structured data
Captions
Summary
[edit]DescriptionSvr epsilons demo.svg |
English: SVR with different epsilons. The data was generated by normally perturbing a sine curve. The plot was prepared using scikit-learn. |
Date | |
Source | Own work |
Author | Shiyu Ji |
Python Source Code
[edit]# Note: the original version of this demo is in sklearn doc:
# http://scikit-learn.org/stable/auto_examples/gaussian_process/plot_compare_gpr_krr.html
# http://scikit-learn.org/stable/auto_examples/plot_kernel_ridge_regression.html
# Authors: Jan Hendrik Metzen <jhm@informatik.uni-bremen.de>
# License: BSD 3 clause
import time
import numpy as np
import matplotlib
matplotlib.use('svg')
import matplotlib.pyplot as plt
from sklearn.svm import SVR
from sklearn.kernel_ridge import KernelRidge
from sklearn.model_selection import GridSearchCV
from sklearn.gaussian_process import GaussianProcessRegressor
from sklearn.gaussian_process.kernels import WhiteKernel, ExpSineSquared
rng = np.random.RandomState(0)
# Generate sample data
X = 15 * rng.rand(100, 1)
y = np.sin(X).ravel()
y[::2] += rng.normal(scale = 1.0, size = X.shape[0] // 2) # add noise
# epsilon = 0.01
svr_e001 = SVR(kernel="rbf", epsilon=0.01, C=1)
svr_e001.fit(X, y)
# epsilon = 0.1
svr_e01 = SVR(kernel="rbf", epsilon=0.1, C=1)
svr_e01.fit(X, y)
# epsilon = 1.0
svr_e10 = SVR(kernel="rbf", epsilon=1.0, C=1)
svr_e10.fit(X, y)
# epsilon = 2.0
svr_e20 = SVR(kernel="rbf", epsilon=2.0, C=1)
svr_e20.fit(X, y)
X_plot = np.linspace(0, 20, 10000)[:, None]
# Predict using SVR
y_e001 = svr_e001.predict(X_plot)
y_e01 = svr_e01.predict(X_plot)
y_e10 = svr_e10.predict(X_plot)
y_e20 = svr_e20.predict(X_plot)
# Plot results
plt.figure(figsize=(10, 5))
lw = 2
plt.scatter(X, y, c='k', label='Data')
plt.plot(X_plot, np.sin(X_plot), color='navy', lw=lw, label='True')
plt.plot(X_plot, y_e001,color='brown', lw=lw, label = 'epsilon = 0.01')
plt.plot(X_plot, y_e01, color='turquoise', lw=lw,
label='epsilon = 0.1')
plt.plot(X_plot, y_e10, color='orange', lw=lw,
label='epsilon = 1.0')
plt.plot(X_plot, y_e20, color='red', lw=lw,
label='epsilon = 2.0')
plt.xlabel('data')
plt.ylabel('target')
plt.xlim(0, 20)
plt.ylim(-3, 5)
plt.title('SVR (rbf kernel) with Different Epsilons')
plt.legend(loc="best", scatterpoints=1, prop={'size': 8})
plt.savefig('svr_epsilons_demo.svg', format='svg')
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.
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 19:57, 3 July 2017 | 900 × 450 (65 KB) | Shiyu Ji (talk | contribs) | User created page with UploadWizard |
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
- Usage on sr.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.
Width | 720pt |
---|---|
Height | 360pt |