From 380e171f8d426a7e23229c469a0e353e8ccd9e53 Mon Sep 17 00:00:00 2001
From: haofengyyyyy <13682504+haofengyyyy@user.noreply.gitee.com>
Date: Fri, 5 Jul 2024 19:30:31 +0800
Subject: [PATCH] =?UTF-8?q?=E9=83=9D=E5=87=A4=E8=8B=B1=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
---
pythonProject7/.idea/.gitignore | 3 +
.../inspectionProfiles/profiles_settings.xml | 6 +
pythonProject7/.idea/misc.xml | 4 +
pythonProject7/.idea/modules.xml | 8 +
pythonProject7/.idea/pythonProject7.iml | 10 +
pythonProject7/datas.py | 182 ++++++++++++++++++
pythonProject7/main.py | 16 ++
pythonProject7/predict.py | 8 +
8 files changed, 237 insertions(+)
create mode 100644 pythonProject7/.idea/.gitignore
create mode 100644 pythonProject7/.idea/inspectionProfiles/profiles_settings.xml
create mode 100644 pythonProject7/.idea/misc.xml
create mode 100644 pythonProject7/.idea/modules.xml
create mode 100644 pythonProject7/.idea/pythonProject7.iml
create mode 100644 pythonProject7/datas.py
create mode 100644 pythonProject7/main.py
create mode 100644 pythonProject7/predict.py
diff --git a/pythonProject7/.idea/.gitignore b/pythonProject7/.idea/.gitignore
new file mode 100644
index 0000000..26d3352
--- /dev/null
+++ b/pythonProject7/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/pythonProject7/.idea/inspectionProfiles/profiles_settings.xml b/pythonProject7/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 0000000..105ce2d
--- /dev/null
+++ b/pythonProject7/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pythonProject7/.idea/misc.xml b/pythonProject7/.idea/misc.xml
new file mode 100644
index 0000000..e975d30
--- /dev/null
+++ b/pythonProject7/.idea/misc.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/pythonProject7/.idea/modules.xml b/pythonProject7/.idea/modules.xml
new file mode 100644
index 0000000..f88b335
--- /dev/null
+++ b/pythonProject7/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pythonProject7/.idea/pythonProject7.iml b/pythonProject7/.idea/pythonProject7.iml
new file mode 100644
index 0000000..74d515a
--- /dev/null
+++ b/pythonProject7/.idea/pythonProject7.iml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pythonProject7/datas.py b/pythonProject7/datas.py
new file mode 100644
index 0000000..4725f97
--- /dev/null
+++ b/pythonProject7/datas.py
@@ -0,0 +1,182 @@
+datas=[
+ {
+ "city": "吕梁",
+ "area": "100",
+ "room": "3",
+ "school": 2,
+ "style": 1,
+ "price": 8600
+ },
+ {
+ "city": "吕梁",
+ "area": "120",
+ "room": "2",
+ "school": 1,
+ "style": 1,
+ "price": 8300
+ },
+ {
+ "city": "吕梁",
+ "area": "110",
+ "room": "2",
+ "school": 1,
+ "style": 1,
+ "price": 8200
+ },
+ #二类
+ {
+ "city": "吕梁",
+ "area": "130",
+ "room": "4",
+ "school": 2,
+ "style": 1,
+ "price": 9000
+ },
+ {
+ "city": "吕梁",
+ "area": "140",
+ "room": "4",
+ "school": 2,
+ "style": 1,
+ "price": 8500
+ },
+ {
+ "city": "吕梁",
+ "area": "122",
+ "room": "3",
+ "school": 2,
+ "style": 1,
+ "price": 8100
+ },
+ #三类
+ {
+ "city": "吕梁",
+ "area": "84",
+ "room": "2",
+ "school": 1,
+ "style": 1,
+ "price": 7600
+ },
+ {
+ "city": "吕梁",
+ "area": "60",
+ "room": "2",
+ "school": 2,
+ "style": 1,
+ "price": 5000
+ },
+ {
+ "city": "吕梁",
+ "area": "90",
+ "room": "2",
+ "school": 2,
+ "style": 1,
+ "price": 6600
+ },
+
+ #太原1类
+ {
+ "city": "太原",
+ "area": "110",
+ "room": "3",
+ "school": 1,
+ "style": 1,
+ "price": 8400
+ },
+ {
+ "city": "太原",
+ "area": "101",
+ "room": "2",
+ "school": 2,
+ "style": 1,
+ "price": 7000
+ },
+ {
+ "city": "太原",
+ "area": "100",
+ "room": "2",
+ "school": 2,
+ "style": 1,
+ "price": 6600
+ },
+ #太原二类
+ {
+ "city": "太原",
+ "area": "80",
+ "room": "5",
+ "school": 2,
+ "style": 1,
+ "price": 5000
+ },
+ {
+ "city": "太原",
+ "area": "99",
+ "room": "2",
+ "school": 2,
+ "style": 1,
+ "price": 5200
+ },
+ {
+ "city": "太原",
+ "area": "130",
+ "room": "1",
+ "school": 2,
+ "style": 1,
+ "price": 6600
+ },
+ #太原三类
+ {
+ "city": "太原",
+ "area": "140",
+ "room": "5",
+ "school": 2,
+ "style": 1,
+ "price": 9600
+ },
+ {
+ "city": "太原",
+ "area": "130",
+ "room": "4",
+ "school": 2,
+ "style": 1,
+ "price": 8880
+ },
+ {
+ "city": "太原",
+ "area": "100",
+ "room": "2",
+ "school": 2,
+ "style": 1,
+ "price": 6500
+ },
+ #3000 10 1000 1300 1500
+ #太原2 100 3 1 1
+ #城市*1 面积*2 房间数量*3 学区房*4 装修*5
+ # *1=1 *2=2
+ #3000+14000+30000+26000+30000
+]
+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["rooms"])
+single.append(item["school"])
+single.append(item["style"])
+single.append(item["area"])
+X.append(single)
+Y.append(item["price"])
+
+X=np.array(X)
+Y=np.array(Y)
+
+theta=np.linalg.pinv(X.T.dot(X)).dot(Y)
+
+
+print(theta)
+
+print(theta.dot(np.array([2,100,2,1,1])))
\ No newline at end of file
diff --git a/pythonProject7/main.py b/pythonProject7/main.py
new file mode 100644
index 0000000..5596b44
--- /dev/null
+++ b/pythonProject7/main.py
@@ -0,0 +1,16 @@
+# This is a sample Python script.
+
+# Press Shift+F10 to execute it or replace it with your code.
+# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
+
+
+def print_hi(name):
+ # Use a breakpoint in the code line below to debug your script.
+ print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint.
+
+
+# Press the green button in the gutter to run the script.
+if __name__ == '__main__':
+ print_hi('PyCharm')
+
+# See PyCharm help at https://www.jetbrains.com/help/pycharm/
diff --git a/pythonProject7/predict.py b/pythonProject7/predict.py
new file mode 100644
index 0000000..3cae856
--- /dev/null
+++ b/pythonProject7/predict.py
@@ -0,0 +1,8 @@
+import numpy as np
+a=np.array([[3,2,3],[3,2,3],[3,2,3]])
+b=np.array([1,2,3])
+
+
+print(a.T)
+print(a.dot(b))
+print(np.linalg.pinv(a))
--
Gitee