- 博客(8)
- 收藏
- 关注
原创 对线性回归模型的两种分析方法-闭式方程&迭代优化即梯度下降
import numpyX = 2 * numpy.random.rand(100, 1)Y = 4 + 3 * X + numpy.random.randn(100, 1)import matplotlib.pyplot as pltplt.plot(X, Y, 'b.')[<matplotlib.lines.Line2D at 0x152a8c1a4c0>]# numpy.ones()函数返回给定形状和数据类型的新数组,其中元素的值设置为1X_b = numpy.c
2021-04-24 21:33:00
644
原创 Matplotlib.pyplot.plot画图函数详解
import numpy# random.rand(100,1) 生成一个值为0~1内随机分布的100行1列的列表,参数为列表的shape(100*1# random.randn(100,1) 生成一组符合正态分布,均值为0,标准差为1的列表,参数为列表的shape(100*1X = 2 * numpy.random.rand(100, 1)Y = 4 + 3 * X + numpy.random.randn(100, 1)import matplotlib.pyplot as plt.
2021-04-22 21:28:32
1058
原创 Kaggle入门竞赛-Titanic成员幸存
# This Python 3 environment comes with many helpful analytics libraries installed# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python# For example, here's several helpful packages to loadimport numpy # linear alge
2021-04-20 20:59:43
255
2
原创 一个端到端的机器学习项目全纪录(加州房价预测)
1 导入数据import pandas使用DataFrames里的head()看看前五行是什么样子的:housing_data = pandas.read_csv(r'C:\Users\Administrator\Desktop\PHD\Machine learning\housing.csv')housing_data.head() longitude latitude housing_median_age t
2021-04-10 21:20:00
559
原创 用Python写一个自动解数独的小程序
跟朋友最近聊起来数独游戏,突发奇想使用python编写一个自动计算数独解的小程序。数独的规则不再过多阐述,在此描述一下程序的主要思路:(当前程序只针对于简单的数独,更复杂的还待深入挖掘) 1.计算当前每个空格可能的取值集合,并将空格顺序值对应取值集合置于字典中;2.对取值集合位数为1,即空格处为单一取值的进行赋值,(填入动作),重复1刷新字典直到字典为空位置;当前实现如下:...
2018-09-29 09:31:53
2207
1
原创 用列表模拟堆栈,队列
用列表模拟堆栈#用列表模拟堆栈stack = [] #新建一个空列表def pushit(): #提示用户输入一个字符到STACK末尾中 stack.append(input('Enter string:').strip()) #input.strip(chars) 移除输入首尾指定的cha...
2018-09-13 20:51:49
314
原创 Python核心编程第二版 -5.9练习
该练习属个人愚见,若在之后的学习中发现有更好的写法,会随时更新。5.2:# 5-2def product(a,b): return a*bprint(product(1,2))5.3:#5-3def test(): score = int(input("Please input score:")) if score//10 == (9 or 1...
2018-09-05 03:34:10
242
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人