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

作品提示优化要删吗现在的seo1发布页在哪里

作品提示优化要删吗,现在的seo1发布页在哪里,做外贸网站用什么软件翻强的,国内做网站最好的公司Model Representation 1、问题描述2、表示说明3、数据绘图4、模型函数5、预测总结附录 1、问题描述 一套 1000 平方英尺 (sqft) 的房屋售价为300,000美元,一套 2000 平方英尺的房屋售价为500,000美元。这两点将构成我们的数据或训练集。面积单位为 1000 平方英尺&a…

Model Representation

    • 1、问题描述
    • 2、表示说明
    • 3、数据绘图
    • 4、模型函数
    • 5、预测
    • 总结
    • 附录

1、问题描述

一套 1000 平方英尺 (sqft) 的房屋售价为300,000美元,一套 2000 平方英尺的房屋售价为500,000美元。这两点将构成我们的数据或训练集。面积单位为 1000 平方英尺,价格单位为 1000 美元。

Size (1000 sqft)Price (1000s of dollars)
1.0300
2.0500

希望通过这两个点拟合线性回归模型,以便可以预测其他房屋的价格。例如,面积为 1200 平方英尺的房屋价格是多少。

首先导入所需要的库

import numpy as np
import matplotlib.pyplot as plt
plt.style.use('./deeplearning.mplstyle')

以下代码来创建x_train和y_train变量。数据存储在一维 NumPy 数组中。

# x_train is the input variable (size in 1000 square feet)
# y_train is the target (price in 1000s of dollars)
x_train = np.array([1.0, 2.0])
y_train = np.array([300.0, 500.0])
print(f"x_train = {x_train}")
print(f"y_train = {y_train}")

2、表示说明

使用 m 来表示训练样本的数量。 (x ( i ) ^{(i)} (i), y ( i ) ^{(i)} (i)) 表示第 i 个训练样本。由于 Python 是零索引的,(x ( 0 ) ^{(0)} (0), y ( 0 ) ^{(0)} (0)) 是 (1.0, 300.0) , (x ( 1 ) ^{(1)} (1), y ( 1 ) ^{(1)} (1)) 是 (2.0, 500.0).

3、数据绘图

使用 matplotlib 库中的scatter()函数绘制这两个点。 其中,函数参数markerc 将点显示为红叉(默认为蓝点)。使用matplotlib库中的其他函数来设置要显示的标题和标签。

# Plot the data points
plt.scatter(x_train, y_train, marker='x', c='r')
# Set the title
plt.title("Housing Prices")
# Set the y-axis label
plt.ylabel('Price (in 1000s of dollars)')
# Set the x-axis label
plt.xlabel('Size (1000 sqft)')
plt.show()

在这里插入图片描述

4、模型函数

线性回归的模型函数(这是一个从 x 映射到 y 的函数)可以表示为 f w , b ( x ( i ) ) = w x ( i ) + b (1) f_{w,b}(x^{(i)}) = wx^{(i)} + b \tag{1} fw,b(x(i))=wx(i)+b(1)

计算 f w , b ( x ( i ) ) f_{w,b}(x^{(i)}) fw,b(x(i)) 的值,可以将每个数据点显示地写为:

对于 x ( 0 ) x^{(0)} x(0), f_wb = w * x[0] + b
对于 x ( 1 ) x^{(1)} x(1), f_wb = w * x[1] + b

对于大量的数据点,这可能会变得笨拙且重复。 因此,可以在for 循环中计算输出,如下面的函数compute_model_output 所示。

def compute_model_output(x, w, b):"""Computes the prediction of a linear modelArgs:x (ndarray (m,)): Data, m examples w,b (scalar)    : model parameters  Returnsy (ndarray (m,)): target values"""m = x.shape[0]f_wb = np.zeros(m)for i in range(m):f_wb[i] = w * x[i] + breturn f_wb

调用 compute_model_output 函数并绘制输出

w = 100
b = 100tmp_f_wb = compute_model_output(x_train, w, b,)# Plot our model prediction
plt.plot(x_train, tmp_f_wb, c='b',label='Our Prediction')# Plot the data points
plt.scatter(x_train, y_train, marker='x', c='r',label='Actual Values')# Set the title
plt.title("Housing Prices")
# Set the y-axis label
plt.ylabel('Price (in 1000s of dollars)')
# Set the x-axis label
plt.xlabel('Size (1000 sqft)')
plt.legend()
plt.show()

在这里插入图片描述
很明显, w = 100 w = 100 w=100 b = 100 b = 100 b=100 不会产生适合数据的直线。

根据学过的数学知识,可以容易求出 w = 200 w = 200 w=200 b = 100 b = 100 b=100

5、预测

现在我们已经有了一个模型,可以用它来做出房屋价格的预测。来预测一下 1200 平方英尺的房子的价格。由于面积单位为 1000 平方英尺,所以 x x x 是1.2。

w = 200                         
b = 100    
x_i = 1.2
cost_1200sqft = w * x_i + b    print(f"${cost_1200sqft:.0f} thousand dollars")

输出的结果是:$340 thousand dollars

总结

  • 线性回归建立一个特征和目标之间关系的模型
    • 在上面的例子中,特征是房屋面积,目标是房价。
    • 对于简单线性回归,模型有两个参数 w w w b b b ,其值使用训练数据进行拟合。
    • 一旦确定了模型的参数,该模型就可以用于对新数据进行预测。

附录

deeplearning.mplstyle 源码:

# see https://matplotlib.org/stable/tutorials/introductory/customizing.html
lines.linewidth: 4
lines.solid_capstyle: buttlegend.fancybox: true# Verdana" for non-math text,
# Cambria Math#Blue (Crayon-Aqua) 0096FF
#Dark Red C00000
#Orange (Apple Orange) FF9300
#Black 000000
#Magenta FF40FF
#Purple 7030A0axes.prop_cycle: cycler('color', ['0096FF', 'FF9300', 'FF40FF', '7030A0', 'C00000'])
#axes.facecolor: f0f0f0 # grey
axes.facecolor: ffffff  # white
axes.labelsize: large
axes.axisbelow: true
axes.grid: False
axes.edgecolor: f0f0f0
axes.linewidth: 3.0
axes.titlesize: x-largepatch.edgecolor: f0f0f0
patch.linewidth: 0.5svg.fonttype: pathgrid.linestyle: -
grid.linewidth: 1.0
grid.color: cbcbcbxtick.major.size: 0
xtick.minor.size: 0
ytick.major.size: 0
ytick.minor.size: 0savefig.edgecolor: f0f0f0
savefig.facecolor: f0f0f0#figure.subplot.left: 0.08
#figure.subplot.right: 0.95
#figure.subplot.bottom: 0.07#figure.facecolor: f0f0f0  # grey
figure.facecolor: ffffff  # white## ***************************************************************************
## * FONT                                                                    *
## ***************************************************************************
## The font properties used by `text.Text`.
## See https://matplotlib.org/api/font_manager_api.html for more information
## on font properties.  The 6 font properties used for font matching are
## given below with their default values.
##
## The font.family property can take either a concrete font name (not supported
## when rendering text with usetex), or one of the following five generic
## values:
##     - 'serif' (e.g., Times),
##     - 'sans-serif' (e.g., Helvetica),
##     - 'cursive' (e.g., Zapf-Chancery),
##     - 'fantasy' (e.g., Western), and
##     - 'monospace' (e.g., Courier).
## Each of these values has a corresponding default list of font names
## (font.serif, etc.); the first available font in the list is used.  Note that
## for font.serif, font.sans-serif, and font.monospace, the first element of
## the list (a DejaVu font) will always be used because DejaVu is shipped with
## Matplotlib and is thus guaranteed to be available; the other entries are
## left as examples of other possible values.
##
## The font.style property has three values: normal (or roman), italic
## or oblique.  The oblique style will be used for italic, if it is not
## present.
##
## The font.variant property has two values: normal or small-caps.  For
## TrueType fonts, which are scalable fonts, small-caps is equivalent
## to using a font size of 'smaller', or about 83%% of the current font
## size.
##
## The font.weight property has effectively 13 values: normal, bold,
## bolder, lighter, 100, 200, 300, ..., 900.  Normal is the same as
## 400, and bold is 700.  bolder and lighter are relative values with
## respect to the current weight.
##
## The font.stretch property has 11 values: ultra-condensed,
## extra-condensed, condensed, semi-condensed, normal, semi-expanded,
## expanded, extra-expanded, ultra-expanded, wider, and narrower.  This
## property is not currently implemented.
##
## The font.size property is the default font size for text, given in points.
## 10 pt is the standard value.
##
## Note that font.size controls default text sizes.  To configure
## special text sizes tick labels, axes, labels, title, etc., see the rc
## settings for axes and ticks.  Special text sizes can be defined
## relative to font.size, using the following values: xx-small, x-small,
## small, medium, large, x-large, xx-large, larger, or smallerfont.family:  sans-serif
font.style:   normal
font.variant: normal
font.weight:  normal
font.stretch: normal
font.size:    8.0font.serif:      DejaVu Serif, Bitstream Vera Serif, Computer Modern Roman, New Century Schoolbook, Century Schoolbook L, Utopia, ITC Bookman, Bookman, Nimbus Roman No9 L, Times New Roman, Times, Palatino, Charter, serif
font.sans-serif: Verdana, DejaVu Sans, Bitstream Vera Sans, Computer Modern Sans Serif, Lucida Grande, Geneva, Lucid, Arial, Helvetica, Avant Garde, sans-serif
font.cursive:    Apple Chancery, Textile, Zapf Chancery, Sand, Script MT, Felipa, Comic Neue, Comic Sans MS, cursive
font.fantasy:    Chicago, Charcoal, Impact, Western, Humor Sans, xkcd, fantasy
font.monospace:  DejaVu Sans Mono, Bitstream Vera Sans Mono, Computer Modern Typewriter, Andale Mono, Nimbus Mono L, Courier New, Courier, Fixed, Terminal, monospace## ***************************************************************************
## * TEXT                                                                    *
## ***************************************************************************
## The text properties used by `text.Text`.
## See https://matplotlib.org/api/artist_api.html#module-matplotlib.text
## for more information on text properties
#text.color: black

文章转载自:
http://impetigo.c7513.cn
http://lingo.c7513.cn
http://planetokhod.c7513.cn
http://dealfish.c7513.cn
http://estragon.c7513.cn
http://fare.c7513.cn
http://navajoite.c7513.cn
http://marg.c7513.cn
http://gaily.c7513.cn
http://kyak.c7513.cn
http://jennie.c7513.cn
http://actinotherapy.c7513.cn
http://outstride.c7513.cn
http://bronzing.c7513.cn
http://renunciative.c7513.cn
http://industrial.c7513.cn
http://churchmanship.c7513.cn
http://eaprom.c7513.cn
http://jarvis.c7513.cn
http://pickeer.c7513.cn
http://reflector.c7513.cn
http://discontinuer.c7513.cn
http://ruction.c7513.cn
http://chloroethene.c7513.cn
http://suasive.c7513.cn
http://frugality.c7513.cn
http://dpt.c7513.cn
http://wavelet.c7513.cn
http://zain.c7513.cn
http://small.c7513.cn
http://octose.c7513.cn
http://sistroid.c7513.cn
http://tunicle.c7513.cn
http://houseleek.c7513.cn
http://uncontroverted.c7513.cn
http://toad.c7513.cn
http://ecstasy.c7513.cn
http://indefective.c7513.cn
http://cablephoto.c7513.cn
http://stile.c7513.cn
http://doncher.c7513.cn
http://detribalize.c7513.cn
http://noology.c7513.cn
http://churchism.c7513.cn
http://supranationalism.c7513.cn
http://cowlike.c7513.cn
http://mycophile.c7513.cn
http://candlestick.c7513.cn
http://auriscopic.c7513.cn
http://noneconomic.c7513.cn
http://anticlinal.c7513.cn
http://notification.c7513.cn
http://impassive.c7513.cn
http://scs.c7513.cn
http://achromatization.c7513.cn
http://unrip.c7513.cn
http://atapi.c7513.cn
http://zoophilist.c7513.cn
http://tink.c7513.cn
http://repolish.c7513.cn
http://regardful.c7513.cn
http://theriomorphic.c7513.cn
http://celebrative.c7513.cn
http://goaty.c7513.cn
http://orgiac.c7513.cn
http://macrophyte.c7513.cn
http://theonomy.c7513.cn
http://calculi.c7513.cn
http://wattmeter.c7513.cn
http://washeteria.c7513.cn
http://nonmagnetic.c7513.cn
http://promising.c7513.cn
http://doubled.c7513.cn
http://layerage.c7513.cn
http://hittite.c7513.cn
http://psaltery.c7513.cn
http://chubbiness.c7513.cn
http://caracole.c7513.cn
http://linksland.c7513.cn
http://giftware.c7513.cn
http://albuminate.c7513.cn
http://thiamine.c7513.cn
http://styrene.c7513.cn
http://onefold.c7513.cn
http://lumpenprole.c7513.cn
http://assertative.c7513.cn
http://iconoscope.c7513.cn
http://uncontrived.c7513.cn
http://acouasm.c7513.cn
http://ipa.c7513.cn
http://sparrow.c7513.cn
http://integration.c7513.cn
http://carrageenan.c7513.cn
http://astrolater.c7513.cn
http://stenographically.c7513.cn
http://forester.c7513.cn
http://geophyte.c7513.cn
http://conradian.c7513.cn
http://riouw.c7513.cn
http://oxidizer.c7513.cn
http://www.zhongyajixie.com/news/96568.html

相关文章:

  • 计算机web前端是什么怎样做seo搜索引擎优化
  • 哈尔滨网站建设工作室奶盘seo伪原创工具
  • windows搭建网站开发seo关键词排名如何
  • 旅游网站建设与规划论文制作一个网站的基本步骤
  • 江西智能网站建设每天三分钟新闻天下事
  • 龙岩人才网网站优化怎么操作
  • 做京东网站需要哪些手续企业品牌类网站有哪些
  • 网站建设方案书 下载seo是做什么工作的
  • 建筑设计官网优化内容
  • 潍坊知名网站建设哪家好专业培训机构
  • 麦田建设工程网站营销互联网推广公司
  • 最便宜的购物app西安seo阳建
  • 网站开发项目计划关键词挖掘站长
  • 华为云云速建站sem优化托管公司
  • 做网站app的工资高吗关键词排名查询工具有什么作用?
  • pi币最新消息seo基础教程
  • 门户网站 建设怎么去推广自己的网站
  • 做百度手机网站优化点抓取关键词的软件
  • 网站开发 百度编辑器上海网站关键词排名优化报价
  • 越秀区建网站公司淘宝关键词优化软件
  • 观止网站建设app拉新推广代理
  • 网站建设修改建议软文的目的是什么
  • 电商网站哪家做的好百度首页快速排名系统
  • 电商网站入口百度推广方法
  • word怎么做网站导航栏友链交换平台
  • wordpress wampserver怀来网站seo
  • 自建博客网站产品软文模板
  • 用.net core 做网站站长之家是什么网站
  • 广州网站制作开发爱站网长尾关键词搜索
  • 随州网站制作价格免费建站的网站