From 35728ad0feef87438f3fe8866e139b67c8168a25 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=A7=8B=E6=A2=B5?= <2497491709@qq.com>
Date: Fri, 5 Jul 2024 20:30:07 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9D=8E=E6=99=8B=E7=9A=84=E4=BD=9C=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 -> 1067 bytes
pythonProject/7.5/datas.py | 152 ++++++++++++++++++
pythonProject/7.5/predict.py | 27 ++++
8 files changed, 218 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..2a01189
--- /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..2c80e12
--- /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..1c7e899513a9c8b84e1fc1922746770664060155
GIT binary patch
literal 1067
zcmX@j%ge<81RL(Pr^#_MFgylvU_b)O_^iRmz%ZR5g&~D8g(-y@2w75C=ddC1+0gjx
zP(DWrCs;ifl+O+2^FaB$P(B}$dM2P9{7C9Sd;ui&Aif}&F9dgwFdAP3jV}u2!`veV
z<-^<~4&}q#BY~tIWFN%+LMb5iAU?$XLMb5iAU@dr=|WKqm6DoLrEI`(dpcq2vqg?IK0kLKP#WGVQfy5kOq-8!3Wnh4~
zV#%tfee*K~)PaH?YCz(HGLT@=1QIqHKq3Rk^3!Cz#hQ{>l32Ww;WN-MhF=;kRxtsU
zB^mj778WK(F$G{|Kv8~HYH~@8xt?hZShZe3CIv)3^0KqCeGnp9LWE=;IPIXRQKHoIAWowQNl?*)@hss?
N>`aZUMS{SX1px2U7gPWM
literal 0
HcmV?d00001
diff --git a/pythonProject/7.5/datas.py b/pythonProject/7.5/datas.py
new file mode 100644
index 0000000..ed9304d
--- /dev/null
+++ b/pythonProject/7.5/datas.py
@@ -0,0 +1,152 @@
+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
+ },
+]
\ 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..2600a3e
--- /dev/null
+++ b/pythonProject/7.5/predict.py
@@ -0,0 +1,27 @@
+import numpy as np
+
+from datas import datas
+X=[]
+Y=[]
+cityMark={"吕梁":1, "太原":2}
+for itme in datas:
+ single=[]
+ #城市
+ single.append(cityMark[itme["city"]])
+ #面积
+ single.append(itme["area"])
+ #房间数
+ single.append(itme["rooms"])
+ #学区房
+ single.append(itme["school"])
+ #装修
+ single.append(itme["style"])
+ X.append(single)
+ Y.append(itme["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