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

织梦做的网站首页幻灯片怎么不能显示百度站长工具怎么查排名

织梦做的网站首页幻灯片怎么不能显示,百度站长工具怎么查排名,双语网站系统,企业平台网弹性网络 代码原文 下面代码参考scikit-learn中文社区,链接在上面。 但是由于scikit-learn中文社区上的代码有些地方跑不通,故对此代码做了修改,输出结果与社区中显示的结果相同。 对弹性网络进行简单的介绍: ElasticNet是一个训…

弹性网络

代码原文
下面代码参考scikit-learn中文社区,链接在上面。
但是由于scikit-learn中文社区上的代码有些地方跑不通,故对此代码做了修改,输出结果与社区中显示的结果相同。

对弹性网络进行简单的介绍:
ElasticNet是一个训练时同时用ℓ1和ℓ2范数进行正则化的线性回归模型,lasso是使用ℓ1范数进行正则化的线性回归模型。
弹性网络简弹性网络简介弹性网络简

from itertools import cycle
import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import lasso_path, enet_path
from sklearn import datasetsX, y = datasets.load_diabetes(return_X_y=True)X /= X.std(axis=0)  # Standardize data (easier to set the l1_ratio parameter)
print("------------------------------------")
print(X)
print("------------------------------------")
print(y)
# Compute pathseps = 5e-3  # the smaller it is the longer is the pathprint("Computing regularization path using the lasso...")
# alphas_lasso, coefs_lasso, _ = lasso_path(X, y, eps=eps, fit_intercept=False)
alphas_lasso, coefs_lasso, _ = lasso_path(X, y)print("Computing regularization path using the positive lasso...")
# alphas_positive_lasso, coefs_positive_lasso, _ = lasso_path(
#     X, y, eps=eps, positive=True, fit_intercept=False)
alphas_positive_lasso, coefs_positive_lasso, _ = lasso_path(X, y, eps=eps, positive=True)print("Computing regularization path using the elastic net...")
# alphas_enet, coefs_enet, _ = enet_path(
#     X, y, eps=eps, l1_ratio=0.8, fit_intercept=False)
alphas_enet, coefs_enet, _ = enet_path(X, y, eps=eps, l1_ratio=0.8)print("Computing regularization path using the positive elastic net...")
# alphas_positive_enet, coefs_positive_enet, _ = enet_path(
#     X, y, eps=eps, l1_ratio=0.8, positive=True, fit_intercept=False)
alphas_positive_enet, coefs_positive_enet, _ = enet_path(X, y, eps=eps, l1_ratio=0.8, positive=True)
print("------------------------------------")
print(alphas_positive_enet)
print("------------------------------------")
print(coefs_positive_enet)
# Display resultsplt.figure(1)
colors = cycle(['b', 'r', 'g', 'c', 'k'])
neg_log_alphas_lasso = -np.log10(alphas_lasso)
neg_log_alphas_enet = -np.log10(alphas_enet)
for coef_l, coef_e, c in zip(coefs_lasso, coefs_enet, colors):l1 = plt.plot(neg_log_alphas_lasso, coef_l, c=c)l2 = plt.plot(neg_log_alphas_enet, coef_e, linestyle='--', c=c)plt.xlabel('-Log(alpha)')
plt.ylabel('coefficients')
plt.title('Lasso and Elastic-Net Paths')
plt.legend((l1[-1], l2[-1]), ('Lasso', 'Elastic-Net'), loc='lower left')
plt.axis('tight')plt.figure(2)
neg_log_alphas_positive_lasso = -np.log10(alphas_positive_lasso)
for coef_l, coef_pl, c in zip(coefs_lasso, coefs_positive_lasso, colors):l1 = plt.plot(neg_log_alphas_lasso, coef_l, c=c)l2 = plt.plot(neg_log_alphas_positive_lasso, coef_pl, linestyle='--', c=c)plt.xlabel('-Log(alpha)')
plt.ylabel('coefficients')
plt.title('Lasso and positive Lasso')
plt.legend((l1[-1], l2[-1]), ('Lasso', 'positive Lasso'), loc='lower left')
plt.axis('tight')plt.figure(3)
neg_log_alphas_positive_enet = -np.log10(alphas_positive_enet)
for (coef_e, coef_pe, c) in zip(coefs_enet, coefs_positive_enet, colors):l1 = plt.plot(neg_log_alphas_enet, coef_e, c=c)l2 = plt.plot(neg_log_alphas_positive_enet, coef_pe, linestyle='--', c=c)plt.xlabel('-Log(alpha)')
plt.ylabel('coefficients')
plt.title('Elastic-Net and positive Elastic-Net')
plt.legend((l1[-1], l2[-1]), ('Elastic-Net', 'positive Elastic-Net'),loc='lower left')
plt.axis('tight')
plt.show()
http://www.dt0577.cn/news/37686.html

相关文章:

  • 网站开发培训实训信阳seo公司
  • 网站推广方式怎样做软文推广多少钱一篇
  • 沂水网站优化长沙专业网络推广公司
  • 低调与华丽wordpress模关键词seo排名优化推荐
  • 拓普网站建设网站优化排名怎么做
  • wordpress 头部 空行简述seo的基本步骤
  • 做网站上找王思奇十大中文网站排名
  • 网站建设进展情况汇报河北搜索引擎优化
  • 哈尔滨的建设信息网站产品推广方式
  • 做二手手机的网站有哪些seo推广哪家好
  • 成都哪里有做网站的公司百度app首页
  • 常州今日头条新闻网络seo哈尔滨
  • 照片做视频的软件 模板下载网站好如何做网络营销?
  • 重庆网站优化排名推广软文营销经典案例
  • 在天津做网站的公司网络营销中的四种方法
  • 自己能不能做个网站高端网站建设深圳
  • 简约 时尚 高端 网站建设头条搜索站长平台
  • 做网站页面一般设置多大尺寸链接地址
  • 国外汽车配件网站模板最新域名查询ip
  • 烟台汽车租赁网站建设聊石家庄seo
  • 广西网站建设运营费用短视频seo营销系统
  • php网站的特点中国人民银行网站
  • 郑州市汉狮做网站知识营销
  • 网站建设自学网站404页面怎么做
  • 做域名跳转非法网站负什么责任贵阳seo网站推广
  • 杭州萧山区专业做网站的公司域名收录
  • 杭州做网站下沙提供seo顾问服务适合的对象是
  • 寻找昆明网站建设如何做seo
  • 邯郸市做网站友情链接交换源码
  • 厦门市建设区网站网站如何注册