From e54e02d653f8e4e64777ac5b5ddc017ad1b5adc4 Mon Sep 17 00:00:00 2001 From: orange-flavored-dumb-hair <3182237507@qq.com> Date: Fri, 5 Jul 2024 20:48:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A8=8A=E6=99=AF=E5=8D=8E=E7=9A=84=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pythonProject/.idea/.gitignore | 8 +++ .../inspectionProfiles/profiles_settings.xml | 6 ++ pythonProject/.idea/misc.xml | 7 +++ pythonProject/.idea/modules.xml | 8 +++ pythonProject/.idea/pythonProject.iml | 10 ++++ .../7.5/__pycache__/datas.cpython-312.pyc | Bin 0 -> 544 bytes pythonProject/7.5/datas.py | 53 ++++++++++++++++++ pythonProject/7.5/predict.py | 28 +++++++++ 8 files changed, 120 insertions(+) create mode 100644 pythonProject/.idea/.gitignore create mode 100644 pythonProject/.idea/inspectionProfiles/profiles_settings.xml create mode 100644 pythonProject/.idea/misc.xml create mode 100644 pythonProject/.idea/modules.xml create mode 100644 pythonProject/.idea/pythonProject.iml create mode 100644 pythonProject/7.5/__pycache__/datas.cpython-312.pyc create mode 100644 pythonProject/7.5/datas.py create mode 100644 pythonProject/7.5/predict.py diff --git a/pythonProject/.idea/.gitignore b/pythonProject/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /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 0000000..105ce2d --- /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 0000000..87a0ccf --- /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 0000000..e15ec35 --- /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 0000000..a141524 --- /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..492af0ff5f2fe5eba54b8fd2aad33fdad469abb1 GIT binary patch literal 544 zcmX@j%ge<81n1Vbr~PDMV0aATzyJ@F@i_y?n9h*GkiwY4l)?;zEGevW*noVt6n3x( z2b9kVLhSv??DiX;OA#EK=Wp7zau*#r{o5C%$51F;Ikfvi;^R)jPI zgP$hjE!LF8lEmVb44;953}3Z?go{x#0O?ZM#c|p41$t31cYx03f&L_lY*ij bdD&UnJ_uozV5E;kFrx`OQzL5;Fi02xU%!?a literal 0 HcmV?d00001 diff --git a/pythonProject/7.5/datas.py b/pythonProject/7.5/datas.py new file mode 100644 index 0000000..f8fed41 --- /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 0000000..d7caf98 --- /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]))) + + -- Gitee