From 88e77e80434068656c5da4e360d035df7b01291a Mon Sep 17 00:00:00 2001
From: lllllleee <14647695+lllllleee@user.noreply.gitee.com>
Date: Fri, 5 Jul 2024 10:38:43 +0000
Subject: [PATCH 1/2] =?UTF-8?q?=E6=96=B0=E5=BB=BA=20homework?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
homework/.keep | 0
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 homework/.keep
diff --git a/homework/.keep b/homework/.keep
new file mode 100644
index 0000000..e69de29
--
Gitee
From fcebef339542e09d09ac286d32fb92d36288c3fb Mon Sep 17 00:00:00 2001
From: lllllleee <3417702868@qq.com>
Date: Fri, 5 Jul 2024 19:03:58 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E8=BD=AF=E5=B7=A52=E7=8F=AD-=E7=8E=8B?=
=?UTF-8?q?=E4=B9=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
homework/.idea/.gitignore | 8 ++
homework/.idea/7.5.iml | 8 ++
.../inspectionProfiles/profiles_settings.xml | 6 ++
homework/.idea/misc.xml | 4 +
homework/.idea/modules.xml | 8 ++
homework/__pycache__/datas.cpython-312.pyc | Bin 0 -> 649 bytes
homework/datas.py | 76 ++++++++++++++++++
homework/predict.py | 18 +++++
8 files changed, 128 insertions(+)
create mode 100644 homework/.idea/.gitignore
create mode 100644 homework/.idea/7.5.iml
create mode 100644 homework/.idea/inspectionProfiles/profiles_settings.xml
create mode 100644 homework/.idea/misc.xml
create mode 100644 homework/.idea/modules.xml
create mode 100644 homework/__pycache__/datas.cpython-312.pyc
create mode 100644 homework/datas.py
create mode 100644 homework/predict.py
diff --git a/homework/.idea/.gitignore b/homework/.idea/.gitignore
new file mode 100644
index 0000000..13566b8
--- /dev/null
+++ b/homework/.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/homework/.idea/7.5.iml b/homework/.idea/7.5.iml
new file mode 100644
index 0000000..d0876a7
--- /dev/null
+++ b/homework/.idea/7.5.iml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/homework/.idea/inspectionProfiles/profiles_settings.xml b/homework/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 0000000..105ce2d
--- /dev/null
+++ b/homework/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/homework/.idea/misc.xml b/homework/.idea/misc.xml
new file mode 100644
index 0000000..060d2c5
--- /dev/null
+++ b/homework/.idea/misc.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/homework/.idea/modules.xml b/homework/.idea/modules.xml
new file mode 100644
index 0000000..6b331e2
--- /dev/null
+++ b/homework/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/homework/__pycache__/datas.cpython-312.pyc b/homework/__pycache__/datas.cpython-312.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..779d9e27d345705c5486bbec18da4744f6858016
GIT binary patch
literal 649
zcmX@j%ge<81d*HC(<)dQ7#@Q-Fu)IGe4YVhOlL@8NMTH2N?`^IG6z)TeVsF;og_3YD?}o%eLY
z)MtwtU#0+=FPT6DBap~+kY`}fWV^+ZoLN$NizTrrHSrc}QGR}I@h!IEl32Ww;WJR4;g`INRZKu-Nk)F2OKNU@445$2GmQZ&(krO^#bJ}1pHiBW
zYF8uzR1b1-@p~Zgftit!@dF!!fW!@cp&J5%Hw3|?fXGK)c2>3zLJWeEHw1)1qC#L&
cP?Vqq6^$a@avVCGnLHWUnHpJ(gn)hq0Ethm-2eap
literal 0
HcmV?d00001
diff --git a/homework/datas.py b/homework/datas.py
new file mode 100644
index 0000000..5a56bcf
--- /dev/null
+++ b/homework/datas.py
@@ -0,0 +1,76 @@
+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": 135,
+ "rooms": 3,
+ "school": 1,
+ "style": 1,
+ "price": 8300
+ },
+ {
+ "city":"吕梁",
+ "area":110,
+ "rooms":2,
+ "school":1,
+ "style":1,
+ "price":8200
+ },
+ {
+ "city": "吕梁",
+ "area": 130,
+ "rooms": 3,
+ "school": 2,
+ "style": 2,
+ "price": 6500
+ },
+ {
+ "city": "吕梁",
+ "area": 140,
+ "rooms": 3,
+ "school": 1,
+ "style": 1,
+ "price": 8600
+ },
+ {
+ "city": "太原",
+ "area": 110,
+ "rooms": 2,
+ "school": 1,
+ "style": 1,
+ "price": 8200
+ },
+ {
+ "city": "太原",
+ "area": 130,
+ "rooms": 3,
+ "school": 2,
+ "style": 2,
+ "price": 6500
+ },
+ {
+ "city": "太原",
+ "area": 140,
+ "rooms": 3,
+ "school": 1,
+ "style": 1,
+ "price": 8600
+ },
+]
+#a1*1+a2*2+a3*3+a4*4+a5*5
+#[a1,a2,.....]
\ No newline at end of file
diff --git a/homework/predict.py b/homework/predict.py
new file mode 100644
index 0000000..f0e9faa
--- /dev/null
+++ b/homework/predict.py
@@ -0,0 +1,18 @@
+import numpy as np
+from datas import datas
+X=[]
+Y=[]
+cityMark={"吕梁":1,"太原":2}
+for item in datas:
+ signal=[]
+ signal.append(cityMark[item["city"]])
+ signal.append(item["area"])
+ signal.append(item["rooms"])
+ signal.append(item["school"])
+ signal.append(item["style"])
+ X.append(signal)
+ 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