摘要: 此博客仅是我平时学习遇到的一些小代码,随着我学习的增多,博客也会慢慢的增添 导入函数库 import matplotlib from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt 1.matplotlib画图用的 阅读全文
posted @ 2019-08-25 21:21 lcyok 阅读(248) 评论(0) 推荐(0)
摘要: 纯手工实现线性回归,代码中数据为房价。 import numpy as np import matplotlib.pyplot as plt #线性回归,代价方程,含惩罚项 def hhh(x,y,xt,m,z,s): h=np.matmul(x,xt.T) w=h-y w1=np.matmul(z 阅读全文
posted @ 2019-08-25 16:56 lcyok 阅读(377) 评论(0) 推荐(0)
摘要: 参考网站 1.高阶函数 1.map()函数:接收两个参数,一个是函数(也可以是内部函数),另一个是数值序列(列表),map()将传入的函数依次作用到序列的每个元素,并把结果作为新的序列返回。 def f(x): a=x*x return a r = map(f,[1,2,3,4,5,6,7,8,9] 阅读全文
posted @ 2019-08-25 11:35 lcyok 阅读(142) 评论(0) 推荐(0)