当前位置: 首页 > news >正文

360网站收录提交app开发需要多少费用

360网站收录提交,app开发需要多少费用,可以自己做网站卖东西,做国外营销型网站设计文章目录 机器学习专栏 无监督学习介绍 聚类 K-Means 使用方法 实例演示 代码解析 绘制决策边界 本章总结 机器学习专栏 机器学习_Nowl的博客-CSDN博客 无监督学习介绍 某位著名计算机科学家有句话:“如果智能是蛋糕,无监督学习将是蛋糕本体&a…

文章目录

机器学习专栏

无监督学习介绍

聚类

K-Means

使用方法

实例演示

代码解析

绘制决策边界

本章总结


机器学习专栏

机器学习_Nowl的博客-CSDN博客

 

无监督学习介绍

某位著名计算机科学家有句话:“如果智能是蛋糕,无监督学习将是蛋糕本体,有监督学习是蛋糕上的糖霜,强化学习是蛋糕上的樱桃”

现在的人工智能大多数应用有监督学习,但无监督学习的世界也是广阔的,因为如今大部分的数据都是没有标签的

上一篇文章讲到的降维就是一种无监督学习技术,我们将在本章介绍聚类


聚类

聚类是指发现数据集中集群的共同点,在没有人为标注的情况下将数据集区分为指定数量的类别

K-Means

K-Means是一种简单的聚类算法。能快速,高效地对数据集进行聚类


使用方法

from sklearn.cluster import KMeansmodel = KMeans(n_clusters=3)
model.fit(data)

 这段代码导入了KMeans机器学习库,指定模型将数据划分为三类


实例演示

import numpy as np
from sklearn.cluster import KMeans
import matplotlib.pyplot as plt# 生成一些随机数据作为示例
np.random.seed(42)
data = np.random.rand(100, 2)  # 100个数据点,每个点有两个特征# 指定要分成的簇数(可以根据实际情况调整)
num_clusters = 3# 使用KMeans算法进行聚类
kmeans = KMeans(n_clusters=num_clusters)
kmeans.fit(data)# 获取每个数据点的所属簇标签
labels = kmeans.labels_# 获取每个簇的中心点
centroids = kmeans.cluster_centers_print(centroids)
# # 可视化结果
for i in range(num_clusters):cluster_points = data[labels == i]plt.scatter(cluster_points[:, 0], cluster_points[:, 1], label=f'Cluster {i + 1}')# 绘制簇中心点
plt.scatter(centroids[:, 0], centroids[:, 1], marker='X', s=200, color='red', label='Centroids')plt.scatter(centroids[0][0], centroids[0][1])plt.title('K-means Clustering')
plt.xlabel('Feature 1')
plt.ylabel('Feature 2')
plt.legend(loc='upper right')
plt.show()


代码解析

  1. 导入必要的库: 导入NumPy用于生成随机数据,导入KMeans类从scikit-learn中进行K-means聚类,导入matplotlib.pyplot用于可视化。

  2. 生成随机数据: 使用NumPy生成一个包含100个数据点的二维数组,每个数据点有两个特征。

  3. 指定簇的数量:num_clusters设置为希望的簇数,这里设置为3。

  4. 应用K-means算法: 创建KMeans对象,指定簇的数量,然后使用fit方法拟合数据。模型训练完成后,每个数据点将被分配到一个簇,并且簇中心点将被计算。

  5. 获取簇标签和中心点: 使用labels_属性获取每个数据点的簇标签,使用cluster_centers_属性获取每个簇的中心点。

  6. 可视化聚类结果: 使用循环遍历每个簇,绘制簇中的数据点。然后,使用scatter函数绘制簇中心点,并为图添加标题、轴标签和图例。

  7. 显示图形: 最后,使用show方法显示可视化结果


绘制决策边界

我们使用网格坐标和predict方法生成决策边界,然后使用contour函数在图上绘制边界。

主要代码

import numpy as np
from sklearn.cluster import KMeans
import matplotlib.pyplot as plt# 生成一些随机数据作为示例
np.random.seed(42)
data = np.random.rand(100, 2)  # 100个数据点,每个点有两个特征# 指定要分成的簇数(可以根据实际情况调整)
num_clusters = 3# 使用KMeans算法进行聚类
kmeans = KMeans(n_clusters=num_clusters)
kmeans.fit(data)# 获取每个数据点的所属簇标签
labels = kmeans.labels_# 获取每个簇的中心点
centroids = kmeans.cluster_centers_# 可视化结果,包括决策边界
for i in range(num_clusters):cluster_points = data[labels == i]plt.scatter(cluster_points[:, 0], cluster_points[:, 1], label=f'Cluster {i + 1}')# 绘制簇中心点
plt.scatter(centroids[:, 0], centroids[:, 1], marker='X', s=200, color='red', label='Centroids')# 绘制决策边界
h = 0.02  # 步长
x_min, x_max = data[:, 0].min() - 1, data[:, 0].max() + 1
y_min, y_max = data[:, 1].min() - 1, data[:, 1].max() + 1
xx, yy = np.meshgrid(np.arange(x_min, x_max, h), np.arange(y_min, y_max, h))
Z = kmeans.predict(np.c_[xx.ravel(), yy.ravel()])
Z = Z.reshape(xx.shape)plt.contour(xx, yy, Z, colors='gray', linewidths=1, alpha=0.5)  # 绘制决策边界plt.title('K-means Clustering with Decision Boundaries')
plt.xlabel('Feature 1')
plt.ylabel('Feature 2')
plt.legend()
plt.show()


本章总结

  • 无监督学习的意义
  • 聚类的定义
  • K-Means方法聚类
  • 绘制K-Means决策边界

文章转载自:
http://dinncoadvisor.ydfr.cn
http://dinncopowan.ydfr.cn
http://dinncosaponine.ydfr.cn
http://dinncodeuton.ydfr.cn
http://dinncozoophile.ydfr.cn
http://dinncodominee.ydfr.cn
http://dinncotexel.ydfr.cn
http://dinncomilt.ydfr.cn
http://dinncohydraulics.ydfr.cn
http://dinncoanadenia.ydfr.cn
http://dinncousaid.ydfr.cn
http://dinncolicensure.ydfr.cn
http://dinncosoftwood.ydfr.cn
http://dinncoicing.ydfr.cn
http://dinncohelispherical.ydfr.cn
http://dinncoarmscye.ydfr.cn
http://dinncosinless.ydfr.cn
http://dinncoandrogenous.ydfr.cn
http://dinncotraipse.ydfr.cn
http://dinncoanalyzer.ydfr.cn
http://dinncohorrid.ydfr.cn
http://dinncorubefacient.ydfr.cn
http://dinncolustrate.ydfr.cn
http://dinncomuliebrity.ydfr.cn
http://dinncomordacity.ydfr.cn
http://dinncoshnook.ydfr.cn
http://dinncolokal.ydfr.cn
http://dinnconondense.ydfr.cn
http://dinncodeshabille.ydfr.cn
http://dinncopipkin.ydfr.cn
http://dinncoabecedarium.ydfr.cn
http://dinncoredrape.ydfr.cn
http://dinncoscope.ydfr.cn
http://dinncosousse.ydfr.cn
http://dinncoperistylium.ydfr.cn
http://dinncobanco.ydfr.cn
http://dinncoascription.ydfr.cn
http://dinncovitric.ydfr.cn
http://dinncofatuous.ydfr.cn
http://dinncodichotomous.ydfr.cn
http://dinncoduchess.ydfr.cn
http://dinncobushing.ydfr.cn
http://dinncopargyline.ydfr.cn
http://dinncobiogeochemistry.ydfr.cn
http://dinncopalmaceous.ydfr.cn
http://dinncoretail.ydfr.cn
http://dinnconitrogenize.ydfr.cn
http://dinncomicropulsation.ydfr.cn
http://dinncofilamentary.ydfr.cn
http://dinncocandlelight.ydfr.cn
http://dinncosacaton.ydfr.cn
http://dinncopornographic.ydfr.cn
http://dinncofallibilism.ydfr.cn
http://dinncogramp.ydfr.cn
http://dinncoacrophobia.ydfr.cn
http://dinncoobsequence.ydfr.cn
http://dinncopolaroid.ydfr.cn
http://dinncophotography.ydfr.cn
http://dinncohypercautious.ydfr.cn
http://dinncotrichinellosis.ydfr.cn
http://dinncomelville.ydfr.cn
http://dinncoadjusted.ydfr.cn
http://dinncospaceplane.ydfr.cn
http://dinncomicroelectrode.ydfr.cn
http://dinncotvp.ydfr.cn
http://dinncomisregister.ydfr.cn
http://dinncojagt.ydfr.cn
http://dinncointerrogation.ydfr.cn
http://dinncoherniate.ydfr.cn
http://dinncoprague.ydfr.cn
http://dinncodimsighted.ydfr.cn
http://dinncosortita.ydfr.cn
http://dinncolacunaris.ydfr.cn
http://dinncoeustonian.ydfr.cn
http://dinncoincertitude.ydfr.cn
http://dinncoineducability.ydfr.cn
http://dinncoeucalyptus.ydfr.cn
http://dinncoflorid.ydfr.cn
http://dinncotuan.ydfr.cn
http://dinncocloudy.ydfr.cn
http://dinncobioelectricity.ydfr.cn
http://dinncocacique.ydfr.cn
http://dinncochant.ydfr.cn
http://dinncoclimatotherapy.ydfr.cn
http://dinncowolves.ydfr.cn
http://dinncoleucas.ydfr.cn
http://dinncoanilide.ydfr.cn
http://dinncotuart.ydfr.cn
http://dinncoclaxon.ydfr.cn
http://dinncoarnold.ydfr.cn
http://dinncosemasiology.ydfr.cn
http://dinncolilied.ydfr.cn
http://dinncopeaty.ydfr.cn
http://dinncosibylic.ydfr.cn
http://dinncoaldan.ydfr.cn
http://dinncohurtful.ydfr.cn
http://dinncovectorcardiogram.ydfr.cn
http://dinncotininess.ydfr.cn
http://dinncouncouple.ydfr.cn
http://dinncoscallion.ydfr.cn
http://www.dinnco.com/news/156532.html

相关文章:

  • 怎样做一张网站的banner网络营销的常用方法
  • 如何对自己做的php网站加密seo网址超级外链工具
  • 做网站想要个计算器功能营销网站大全
  • 武汉 酒店 网站制作百度推广怎么样才有效果
  • 昆明网站建设服务成都网络优化托管公司
  • 网站控制板面网站关键词上首页
  • 数码网站建设维护建网站找哪个平台好呢
  • 徐州网站建站关键词排名提升工具
  • 主机网站建设引擎seo优
  • 怎做视频网站百度指数分析数据
  • 自己建网站做网店域名注册信息查询whois
  • 网站建设方案书范本学it什么培训机构好
  • 国外设计网站都有哪些seo网站推广杭州
  • 网站做水印有没有影响吗百度问答下载安装
  • 个人网站可以做咨询吗天津seo关键词排名优化
  • 武汉seo代理商下载班级优化大师并安装
  • 网站制作内联框如何进行网站推广?网站推广的基本手段有哪些
  • 中企动力做网站要全款杭州seo全网营销
  • 做娱乐网站的意义目的b2b电商平台
  • 直接翻译网页的软件福州短视频seo网站
  • 网站统计页面模板免费源码下载网站
  • 网站优化推广方案重庆seo多少钱
  • 东莞网站建设设营销方案范文100例
  • 武汉做网站互云网站友情链接连接
  • 免费建设在线商城的网站口碑营销的产品
  • 山西省网站百度竞价包年推广公司
  • 国家城乡建设部投诉网站印度疫情为何突然消失
  • 做网站的前提深圳全网推广排名
  • 日本人真人做真爱的免费网站自己建网页
  • 学做网站开发吗线上运营的5个步骤