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

seo怎么优化网站排名wordpress连接信息

seo怎么优化网站排名,wordpress连接信息,网站文件解压,泰安百度推广电话原题采用Kmeans方法对西瓜数据集进行聚类。我花了一些时间居然没找到西瓜数据集4.0在哪里#xff0c;于是直接采用sklearn给的例子来分析一遍#xff0c;更能说明Kmeans的效果。 #!/usr/bin/python # -*- coding:utf-8 -*- import numpy as np import matplotlib.pyplot as p…原题采用Kmeans方法对西瓜数据集进行聚类。我花了一些时间居然没找到西瓜数据集4.0在哪里于是直接采用sklearn给的例子来分析一遍更能说明Kmeans的效果。 #!/usr/bin/python # -*- coding:utf-8 -*- import numpy as np import matplotlib.pyplot as pltfrom sklearn.ensemble import BaggingClassifier from sklearn.tree import DecisionTreeClassifierfile1 open(c:\quant\watermelon.csv,r) data [line.strip(\n).split(,) for line in file1] data np.array(data) #X [[float(raw[-7]),float(raw[-6]),float(raw[-5]),float(raw[-4]),float(raw[-3]), float(raw[-2])] for raw in data[1:,1:-1]]X [[float(raw[-3]), float(raw[-2])] for raw in data[1:]] y [1 if raw[-1]1 else 0 for raw in data[1:]] X np.array(X) y np.array(y)print(__doc__)from time import time import numpy as np import matplotlib.pyplot as pltfrom sklearn import metrics from sklearn.cluster import KMeans from sklearn.datasets import load_digits from sklearn.decomposition import PCA from sklearn.preprocessing import scalenp.random.seed(42)digits load_digits() data scale(digits.data) n_samples, n_features data.shape n_digits len(np.unique(digits.target)) labels digits.targetsample_size 300print(n_digits: %d, \t n_samples %d, \t n_features %d% (n_digits, n_samples, n_features)) #一共十个不同的类print(79 * _) print(% 9s % init time inertia homo compl v-meas ARI AMI silhouette)def bench_k_means(estimator, name, data):t0 time()estimator.fit(data)print(% 9s %.2fs %i %.3f %.3f %.3f %.3f %.3f %.3f% (name, (time() - t0), estimator.inertia_,metrics.homogeneity_score(labels, estimator.labels_),metrics.completeness_score(labels, estimator.labels_),metrics.v_measure_score(labels, estimator.labels_),metrics.adjusted_rand_score(labels, estimator.labels_),metrics.adjusted_mutual_info_score(labels, estimator.labels_),metrics.silhouette_score(data, estimator.labels_,metriceuclidean,sample_sizesample_size))) #Homogeneity 和 completeness 表示簇的均一性和完整性。V值是他们的调和平均值越大说明效果越好。 bench_k_means(KMeans(initk-means, n_clustersn_digits, n_init10),namek-means, datadata)bench_k_means(KMeans(initrandom, n_clustersn_digits, n_init10),namerandom, datadata)# in this case the seeding of the centers is deterministic, hence we run the # kmeans algorithm only once with n_init1 pca PCA(n_componentsn_digits).fit(data) bench_k_means(KMeans(initpca.components_, n_clustersn_digits, n_init1),namePCA-based,datadata) print(79 * _)############################################################################### # Visualize the results on PCA-reduced datareduced_data PCA(n_components2).fit_transform(data) kmeans KMeans(initk-means, n_clustersn_digits, n_init10) kmeans.fit(reduced_data)# Step size of the mesh. Decrease to increase the quality of the VQ. h .02 # point in the mesh [x_min, m_max]x[y_min, y_max].# Plot the decision boundary. For that, we will assign a color to each x_min, x_max reduced_data[:, 0].min() - 1, reduced_data[:, 0].max() 1 y_min, y_max reduced_data[:, 1].min() - 1, reduced_data[:, 1].max() 1 xx, yy np.meshgrid(np.arange(x_min, x_max, h), np.arange(y_min, y_max, h))# Obtain labels for each point in mesh. Use last trained model. Z kmeans.predict(np.c_[xx.ravel(), yy.ravel()])# Put the result into a color plot Z Z.reshape(xx.shape) plt.figure(1) plt.clf() plt.imshow(Z, interpolationnearest,extent(xx.min(), xx.max(), yy.min(), yy.max()),cmapplt.cm.Paired,aspectauto, originlower)plt.plot(reduced_data[:, 0], reduced_data[:, 1], k., markersize2) # Plot the centroids as a white X centroids kmeans.cluster_centers_ plt.scatter(centroids[:, 0], centroids[:, 1],markerx, s169, linewidths3,colorw, zorder10) plt.title(K-means clustering on the digits dataset (PCA-reduced data)\nCentroids are marked with white cross) plt.xlim(x_min, x_max) plt.ylim(y_min, y_max) plt.xticks(()) plt.yticks(()) plt.show() 运行文本结果 n_digits: 10, n_samples 1797, n_features 64 _______________________________________________________________________________ init time inertia homo compl v-meas ARI AMI silhouette k-means 0.21s 69432 0.602 0.650 0.625 0.465 0.598 0.146random 0.20s 69694 0.669 0.710 0.689 0.553 0.666 0.147 PCA-based 0.02s 71820 0.673 0.715 0.693 0.567 0.670 0.150我们可以看到降维处理后运行时间缩短而且V值还略高于以上两种方法。 图片结果 转载于:https://www.cnblogs.com/zhusleep/p/5648244.html
http://www.pierceye.com/news/578256/

相关文章:

  • 中国建设银行上海市分行网站天津工程建设信息网站
  • 怎么做好网站开发、设计中国站长网站
  • 沈阳网站建设tlmh室内设计装修案例
  • 网站 linux 服务器配置长沙企业网站建设价格
  • 低价网站制作企业智慧团建官网登录口手机版
  • 临沂网站制作专业如何 做网站
  • 旅游景区网站开发的政策可行性天翼云电脑免费领取
  • 企业网站建设报价做网站要实名认证吗
  • 设计网站得多少钱ui设计师个人简历
  • 彩票网站建设基本流程wordpress上篇下篇代码
  • 一站式服务的优点无锡网站搜索优化
  • 怎么做地区网站烟台网站建设首推企汇互联见效付款
  • 杭州网站优化服务网站内容方案
  • 大气手机网站模板免费下载军事网站模板下载
  • 大兴德艺网站建设wordpress上传的gif图不会动
  • 三门峡住房和建设局网站房产主题wordpress
  • 网站改版 权重php做网站脑图
  • 交易网站建设需要学什么网店装修
  • 青岛市城市建设档案馆网站东莞网络推广优化排名
  • 成交型网站做网站优化的价格
  • 后台网站设计烟台优化网站公司
  • 网站开发中涉及的侵权行为软件开发案例展示
  • 网站开发u盘128够吗网络服务器是指什么
  • 网站空间试用百度搜索引擎关键词优化
  • 中山品牌网站设计阿里云企业网站怎么建设
  • 做网站推广广告房地产行业网站开发
  • 济宁网站建设 企业谷wordpress手机 不适应
  • 如何用php做网站合肥专业手机网站哪家好
  • 如何推广自己的网站和产品如何用dw做网站地图
  • 株洲有名的网站重庆市公路建设信息网官网