From d91df293e79e34391af9079e845b0e18a7f2f3b0 Mon Sep 17 00:00:00 2001
From: ppp_com <14647731+pppcom@user.noreply.gitee.com>
Date: Fri, 5 Jul 2024 22:40:23 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9D=8E=E6=99=93=E6=BD=AD=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
---
py_study/.idea/.gitignore | 8 ++
.../inspectionProfiles/profiles_settings.xml | 6 ++
py_study/.idea/misc.xml | 7 ++
py_study/.idea/modules.xml | 8 ++
py_study/.idea/py_study.iml | 8 ++
py_study/__pycache__/data.cpython-312.pyc | Bin 0 -> 675 bytes
py_study/data.py | 81 ++++++++++++++++++
py_study/fangjia.py | 19 ++++
8 files changed, 137 insertions(+)
create mode 100644 py_study/.idea/.gitignore
create mode 100644 py_study/.idea/inspectionProfiles/profiles_settings.xml
create mode 100644 py_study/.idea/misc.xml
create mode 100644 py_study/.idea/modules.xml
create mode 100644 py_study/.idea/py_study.iml
create mode 100644 py_study/__pycache__/data.cpython-312.pyc
create mode 100644 py_study/data.py
create mode 100644 py_study/fangjia.py
diff --git a/py_study/.idea/.gitignore b/py_study/.idea/.gitignore
new file mode 100644
index 0000000..1c2fda5
--- /dev/null
+++ b/py_study/.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/py_study/.idea/inspectionProfiles/profiles_settings.xml b/py_study/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 0000000..105ce2d
--- /dev/null
+++ b/py_study/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/py_study/.idea/misc.xml b/py_study/.idea/misc.xml
new file mode 100644
index 0000000..f1bf6fa
--- /dev/null
+++ b/py_study/.idea/misc.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/py_study/.idea/modules.xml b/py_study/.idea/modules.xml
new file mode 100644
index 0000000..64826d1
--- /dev/null
+++ b/py_study/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/py_study/.idea/py_study.iml b/py_study/.idea/py_study.iml
new file mode 100644
index 0000000..d9e6024
--- /dev/null
+++ b/py_study/.idea/py_study.iml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/py_study/__pycache__/data.cpython-312.pyc b/py_study/__pycache__/data.cpython-312.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..5965af636004a4cd6fa6db734c296db3f28f41e0
GIT binary patch
literal 675
zcmX@j%ge<81iQYpr&Y5sFgylvU_b!M_`Cwhn9h*GkiwY4l)?;zEGevW*noVt6m~G5
z1Ip(F@15UXO>jnVo5AY
zO}xcgl%Jnle2c9(IU_$m=N4;mNo7vzE!Kjf%;eOUO(31jAe|N@Wa4
zLa(6m7l%!5eoARhs$G!?Pz}hD#cV+G12ZEd;{$Ht8{B+1czAE{f=M2MkG$;cOdo_8
YctkKI7>AEUAX5M%8&e}okq|IE0E7my0ssI2
literal 0
HcmV?d00001
diff --git a/py_study/data.py b/py_study/data.py
new file mode 100644
index 0000000..2b2ae5f
--- /dev/null
+++ b/py_study/data.py
@@ -0,0 +1,81 @@
+data=[{
+ "city":"吕梁",
+ "area":100,
+ "rooms":2,
+ "school":1,
+ "style":1,
+ "price":8000,
+},
+{
+ "city":"吕梁",
+ "area":130,
+ "rooms":3,
+ "school":1,
+ "style":1,
+ "price":8500,
+},
+{
+ "city":"吕梁",
+ "area":120,
+ "rooms":3,
+ "school":2,
+ "style":1,
+ "price":8300,
+},
+{
+ "city":"吕梁",
+ "area":150,
+ "rooms":2,
+ "school":2,
+ "style":2,
+ "price":7600,
+},
+{
+ "city":"吕梁",
+ "area":140,
+ "rooms":3,
+ "school":2,
+ "style":2,
+ "price":7500,
+},
+{
+ "city":"太原",
+ "area":120,
+ "rooms":2,
+ "school":1,
+ "style":1,
+ "price":8500,
+},
+{
+ "city":"太原",
+ "area":100,
+ "rooms":2,
+ "school":1,
+ "style":1,
+ "price":8000,
+},
+{
+ "city":"太原",
+ "area":150,
+ "rooms":3,
+ "school":1,
+ "style":1,
+ "price":8900,
+},
+{
+ "city":"太原",
+ "area":130,
+ "rooms":3,
+ "school":2,
+ "style":2,
+ "price":8000,
+},
+{
+ "city":"太原",
+ "area":150,
+ "rooms":3,
+ "school":2,
+ "style":2,
+ "price":8300,
+},
+]
\ No newline at end of file
diff --git a/py_study/fangjia.py b/py_study/fangjia.py
new file mode 100644
index 0000000..b781f5e
--- /dev/null
+++ b/py_study/fangjia.py
@@ -0,0 +1,19 @@
+import numpy as np
+from data import data
+X=[]
+Y=[]
+cityMark={"吕梁":1,"太原":2}
+for i in data:
+ print(i)
+ single=[]
+ single.append(cityMark[i["city"]])
+ single.append(i["area"])
+ single.append(i["rooms"])
+ single.append(i["school"])
+ single.append(i["style"])
+ X.append(single)
+ Y.append(i["price"])
+ 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
--
Gitee