In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article to share with you is about how to learn SVM algorithm, Xiaobian think quite practical, so share to everyone to learn, I hope you can read this article after some harvest, not much to say, follow Xiaobian to see it.
SVM is a classification algorithm based on statistical learning theory, which is suitable for dealing with data sets with high-dimensional features.
Here are a few I think are pretty good:
Support Vector Machine (SVM): blog.csdn.net/v_july_v/article/details/7624837
This article is very detailed, advancing from shallow to deep.
There is also a more popular simple version: teach you to implement SVM algorithm: blog.csdn.net/alvine008/article/details/9097105
SVN principle is more complex, but the idea is very simple, in a word, it is to find an optimal hyperplane in high-dimensional space through some kernel function, which can separate two kinds of data.
For different datasets, the classification effect of different kernel functions may be completely different. There are several optional kernel functions:
Linear function: A linear function of the form K(x,y)=x*y;
A polynomial function of the form K(x,y)=[(x·y)+1]^d;
Radial basis function: K(x,y)=exp(-|x-y| ^2/d^2);
Sigmoid function: Sigmoid function mentioned in the previous article.
Let's take a few data sets and give Python code directly to see the effect:
Test 1: Height and Weight Data
The results are as follows:
As you can see, SVM with a polynomial kernel of degree 3 gives the best results for this dataset.
Test 3: Circular Boundary
Finally, we test a case where the data classification boundary is circular: one class inside the circle and one class outside the prototype. See how SVM performs on this class of nonlinear data:
The test data generation code is as follows:
The test results are as follows:
SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0, degree=3, gamma=0.0, kernel='linear', max_iter=-1, probability=False, random_state=None,
shrinking=True, tol=0.001, verbose=False)
0.65
SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0, degree=3, gamma=0.0, kernel='poly', max_iter=-1, probability=False, random_state=None,
shrinking=True, tol=0.001, verbose=False)
0.675
SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0, degree=3, gamma=0.0, kernel='rbf', max_iter=-1, probability=False, random_state=None,
shrinking=True, tol=0.001, verbose=False)
0.9625
SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0, degree=3, gamma=0.0, kernel='sigmoid', max_iter=-1, probability=False, random_state=None,
shrinking=True, tol=0.001, verbose=False)
0.65
It can be seen that for this boundary, SVM of radial basis functions gives approximately perfect classification results.
The above is how to learn SVM algorithm, Xiaobian believes that some knowledge points may be seen or used in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.