diff --git a/pythonProject/.idea/.gitignore b/pythonProject/.idea/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..13566b81b018ad684f3a35fee301741b2734c8f4 --- /dev/null +++ b/pythonProject/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/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..2a01189048dd51552f6ba99bf21b7c67f3613c98 --- /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..74d515a027de98657e9d3d5f0f1831882fd81374 --- /dev/null +++ b/pythonProject/.idea/pythonProject.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/pythonProject/7.5/__pycache__/datas.cpython-312.pyc b/pythonProject/7.5/__pycache__/datas.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c7d6d507fd92bf728aa0c81c2281d7962d3a8b48 Binary files /dev/null and b/pythonProject/7.5/__pycache__/datas.cpython-312.pyc differ diff --git a/pythonProject/7.5/datas.py b/pythonProject/7.5/datas.py new file mode 100644 index 0000000000000000000000000000000000000000..f8fed411cff6df4d7cc411eb1d11913127c5b340 --- /dev/null +++ b/pythonProject/7.5/datas.py @@ -0,0 +1,53 @@ +datas=[ + { #模拟吕梁的第一类房子 + "city": "吕梁", + "area": 100, + "rooms": 2, + "school": 1, + "style": 1, + "price": 4500 + }, +{ #模拟吕梁的第二类房子 + "city": "吕梁", + "area": 120, + "rooms": 3, + "school": 2, + "style": 1, + "price": 5500 + }, +{ #模拟吕梁的第三类房子 + "city": "吕梁", + "area": 140, + "rooms": 2, + "school": 2, + "style": 2, + "price": 6500 + }, +{ #模拟太原的第一类房子 + "city": "太原", + "area": 130, + "rooms": 1, + "school": 2, + "style": 2, + "price": 5000 + }, +{ #模拟太原的第二类房子 + "city": "太原", + "area": 150, + "rooms": 3, + "school": 2, + "style": 2, + "price": 6000 + }, +{ #模拟太原的第三类房子 + "city": "太原", + "area": 170, + "rooms": 3, + "school": 2, + "style": 2, + "price": 7000 + }, + # 城市 *1 面积 *2 房间数量 *3 学区房 *4 装修 *5 + # a1*1+a2*2+a3*3+a4*4+a5*5+y + #[a1,a2....] 数学模型 机器学习 机器学习软件开发 +] \ No newline at end of file diff --git a/pythonProject/7.5/predict.py b/pythonProject/7.5/predict.py new file mode 100644 index 0000000000000000000000000000000000000000..d7caf987ff4d4b2979a73ca680b6ae5ee652f08a --- /dev/null +++ b/pythonProject/7.5/predict.py @@ -0,0 +1,28 @@ +# 1.先安装一个 科学计算器 +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) + +theta=np.linalg.pinv(X.T.dot(X)).dot(X.T).dot(Y) +print(theta.dot(np.array([2,100,2,1,1]))) + +