机器学习sklearn

您所在的位置:网站首页 高斯过程的核函数有哪些类型 机器学习sklearn

机器学习sklearn

2024-07-11 10:47| 来源: 网络整理| 查看: 265

文章目录 前言 不同核函数对比分析 创建原始数据 不同核函数表现可视化 总结

前言

前面的SVC求解可视化一文中已经知道了SVC对于线性和非线性的数据有不同的核函数,线性只有一个,而非线性有三个,实际生活中我们遇到的数据大多数是非线性的,那么这些核函数具体应该怎么选择呢?

SVM的核函数:

linear:线性核函数,只能解决线性问题 ploy:多项式核函数,解决非线性问题和线性问题,但是偏线性 sigmoid:双曲正切核函数,解决线性和非线性问题 rbf:高斯径向基核函数,解决线性和非线性问题,偏非线性

核函数可以理解为将低维数据变换到高维数据,方便找到决策边界的这样一个数学过程 核函数的数学原理很复杂,这里不探究了,主要关注核函数在不同数据集上的选择

本文中使用到的第三方库

from sklearn.svm import SVC from sklearn.datasets import make_blobs, make_moons, make_circles, make_classification from sklearn.model_selection import cross_val_score # 交叉验证 import numpy as np import matplotlib.pyplot as plt import warnings %matplotlib inline warnings.filterwarnings("ignore") 不同核函数对比分析 创建原始数据 # 创建数据集 n_samples = 200 n_features = 2 datas = [ make_blobs(n_samples=n_samples, n_features=n_features, centers=2, cluster_std=8, random_state=1), make_moons(n_samples=n_samples, noise=0.2, random_state=1), make_circles(n_samples=n_samples, factor=0.6, noise=0.2, random_state=1), make_classification(n_samples=n_samples, n_features=n_features, n_informative=2, n_redundant


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3