diff --git a/pythonProject/.idea/.gitignore b/pythonProject/.idea/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..f649f0f6d931afba7aaf1471187b1146a9e166cb --- /dev/null +++ b/pythonProject/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# 基于编辑器的 HTTP 客户端请求 +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/pythonProject/.idea/inspectionProfiles/profiles_settings.xml b/pythonProject/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000000000000000000000000000000000000..105ce2da2d6447d11dfe32bfb846c3d5b199fc99 --- /dev/null +++ b/pythonProject/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/pythonProject/.idea/misc.xml b/pythonProject/.idea/misc.xml new file mode 100644 index 0000000000000000000000000000000000000000..64103c90f7d7a6d4cd1c1a9082f1da0a7931b325 --- /dev/null +++ b/pythonProject/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/pythonProject/.idea/modules.xml b/pythonProject/.idea/modules.xml new file mode 100644 index 0000000000000000000000000000000000000000..e15ec35fe054f3b2c7c21e3dcca866d6a79ca0ba --- /dev/null +++ b/pythonProject/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/pythonProject/.idea/pythonProject.iml b/pythonProject/.idea/pythonProject.iml new file mode 100644 index 0000000000000000000000000000000000000000..2c80e1269497d12e018fd6afa29982e56b0fb70d --- /dev/null +++ b/pythonProject/.idea/pythonProject.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/pythonProject/7,05/__pycache__/datas.cpython-311.pyc b/pythonProject/7,05/__pycache__/datas.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2b2ffe9243395d5a9e40a68c46daecf18e64298c Binary files /dev/null and b/pythonProject/7,05/__pycache__/datas.cpython-311.pyc differ diff --git a/pythonProject/7,05/datas.py b/pythonProject/7,05/datas.py new file mode 100644 index 0000000000000000000000000000000000000000..d0c0f240afa05b0386a7b222a19c53e6ebfe64f9 --- /dev/null +++ b/pythonProject/7,05/datas.py @@ -0,0 +1,154 @@ +#模拟太原和吕梁的房价的数据 预测系统 +#怎么模拟 城市 面积 户型 是不是学区房 装修的风格 +datas=[ + #模拟的吕梁第一类房子 + { + "city":"吕梁", + "area":100, + "rooms":2, + "school":1, + "style":1, + "price":8000 + }, + { + "city": "吕梁", + "area": 100, + "rooms": 2, + "school": 1, + "style": 1, + "price": 7800 + }, + { + "city": "吕梁", + "area": 100, + "rooms": 2, + "school": 1, + "style": 1, + "price": 8200 + }, + #模拟的吕梁第二类房子 + { + "city":"吕梁", + "area":130, + "rooms":3, + "school":1, + "style":1, + "price":8500 + }, + { + "city": "吕梁", + "area": 135, + "rooms": 3, + "school": 1, + "style": 1, + "price": 8300 + }, + { + "city": "吕梁", + "area": 140, + "rooms": 3, + "school": 1, + "style": 1, + "price": 8600 + }, + #模拟的吕梁第三类房子 + { + "city":"吕梁", + "area":130, + "rooms":3, + "school":2, + "style":2, + "price":6500 + }, + { + "city": "吕梁", + "area": 135, + "rooms": 3, + "school": 2, + "style": 2, + "price": 6300 + }, + { + "city": "吕梁", + "area": 140, + "rooms": 3, + "school": 2, + "style": 2, + "price": 5600 + }, + #模拟的太原第一类房子 + { + "city":"太原", + "area":100, + "rooms":2, + "school":1, + "style":1, + "price":10000 + }, + { + "city": "太原", + "area": 100, + "rooms": 2, + "school": 1, + "style": 1, + "price": 9800 + }, + { + "city": "太原", + "area": 100, + "rooms": 2, + "school": 1, + "style": 1, + "price": 9200 + }, + #模拟的太原第二类房子 + { + "city":"太原", + "area":130, + "rooms":3, + "school":1, + "style":1, + "price":10500 + }, + { + "city": "太原", + "area": 135, + "rooms": 3, + "school": 1, + "style": 1, + "price": 10300 + }, + { + "city": "太原", + "area": 140, + "rooms": 3, + "school": 1, + "style": 1, + "price": 10600 + }, + #模拟的太原第三类房子 + { + "city":"太原", + "area":130, + "rooms":3, + "school":2, + "style":2, + "price":8500 + }, + { + "city": "太原", + "area": 135, + "rooms": 3, + "school": 2, + "style": 2, + "price": 8300 + }, + { + "city": "太原", + "area": 140, + "rooms": 3, + "school": 2, + "style": 2, + "price": 8600 + }, +] diff --git a/pythonProject/7,05/predict.py b/pythonProject/7,05/predict.py new file mode 100644 index 0000000000000000000000000000000000000000..6810ae26a305c2f78cfcf3cc4083b181577ab2b3 --- /dev/null +++ b/pythonProject/7,05/predict.py @@ -0,0 +1,23 @@ +#先安装一个 科学计算的框架 pip install numpy +import numpy as np +from datas import datas +X=[] +Y=[] +cityMark={"吕梁":1,"太原":2} +for item in datas: + single=[] + single.append(cityMark[item["city"]]) + single.append(item["area"]) + single.append(item["rooms"]) + single.append(item["school"]) + single.append(item["style"]) + X.append(single) + Y.append(item["price"]) +X=np.array(X) +Y=np.array(Y) + +print(X) +print(Y) + +theta=np.linalg.pinv(X.T.dot(X)).dot(X.T).dot(Y) +print(theta.dot(np.array([2,100,2,1,1]))) \ No newline at end of file