From 13ef69b2e72fca604de78767e928e7296b63159c Mon Sep 17 00:00:00 2001 From: LILKRL <1069099229@QQ.COM> Date: Fri, 5 Jul 2024 20:59:19 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=AD=94=E6=98=AD=E7=8E=AE=E7=9A=84?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- homework2/.idea/.gitignore | 8 + .../inspectionProfiles/Project_Default.xml | 12 ++ .../inspectionProfiles/profiles_settings.xml | 6 + homework2/.idea/misc.xml | 7 + homework2/.idea/modules.xml | 8 + homework2/.idea/pythonProject1.iml | 10 ++ .../7.5/__pycache__/datas.cpython-312.pyc | Bin 0 -> 1027 bytes homework2/7.5/datas.py | 160 ++++++++++++++++++ homework2/7.5/predict.py | 33 ++++ homework2/main.py | 16 ++ 10 files changed, 260 insertions(+) create mode 100644 homework2/.idea/.gitignore create mode 100644 homework2/.idea/inspectionProfiles/Project_Default.xml create mode 100644 homework2/.idea/inspectionProfiles/profiles_settings.xml create mode 100644 homework2/.idea/misc.xml create mode 100644 homework2/.idea/modules.xml create mode 100644 homework2/.idea/pythonProject1.iml create mode 100644 homework2/7.5/__pycache__/datas.cpython-312.pyc create mode 100644 homework2/7.5/datas.py create mode 100644 homework2/7.5/predict.py create mode 100644 homework2/main.py diff --git a/homework2/.idea/.gitignore b/homework2/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/homework2/.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/homework2/.idea/inspectionProfiles/Project_Default.xml b/homework2/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..4ebeef7 --- /dev/null +++ b/homework2/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,12 @@ + + + + \ No newline at end of file diff --git a/homework2/.idea/inspectionProfiles/profiles_settings.xml b/homework2/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/homework2/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/homework2/.idea/misc.xml b/homework2/.idea/misc.xml new file mode 100644 index 0000000..a50ac5b --- /dev/null +++ b/homework2/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/homework2/.idea/modules.xml b/homework2/.idea/modules.xml new file mode 100644 index 0000000..fdd8fdf --- /dev/null +++ b/homework2/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/homework2/.idea/pythonProject1.iml b/homework2/.idea/pythonProject1.iml new file mode 100644 index 0000000..74d515a --- /dev/null +++ b/homework2/.idea/pythonProject1.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/homework2/7.5/__pycache__/datas.cpython-312.pyc b/homework2/7.5/__pycache__/datas.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e064b69b26ed4f0c04a7cb687263bd5b85b9d269 GIT binary patch literal 1027 zcmX@j%ge<81bwU9(*n2|7#@Q-FdzYCeAZxOV3^L3!jQt4!j!@cge)nnbJ&phY-oIT zD4!#R6Re&K%I8Mo^FaB$XzKaU)bm66F!cgpz95==5PXPx5PXPx1XEDmBbb8f9>Elt z`4IOY)C)oF!=|1I7$#u#=|WKqmBN}LrEI`(dpcq2vqgKw^sskeCCEG>8M1ta{ovKhp##?Wf6ji!~*&B(ZoU z!)Kr#hF@|nRxt&YB^mj70Y&*)smUdVG3I)vF<>=%1(m-zY;yBcN^?@}ihu?)fSg`@ z0Z4veW@KdiAiy9Xaf4szhJfG=K`<#G@{yOFmF Date: Fri, 5 Jul 2024 21:26:56 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=AD=94=E6=98=AD=E7=8E=AE=E7=9A=84?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- homework2/.idea/vcs.xml | 6 ++++++ homework2/7.5/datas.py | 40 ++++++++++++++++++---------------------- homework2/7.5/predict.py | 11 ++--------- 3 files changed, 26 insertions(+), 31 deletions(-) create mode 100644 homework2/.idea/vcs.xml diff --git a/homework2/.idea/vcs.xml b/homework2/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/homework2/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/homework2/7.5/datas.py b/homework2/7.5/datas.py index ac6ceff..0d57718 100644 --- a/homework2/7.5/datas.py +++ b/homework2/7.5/datas.py @@ -1,11 +1,7 @@ -# 经验是来源于数据 -# 大数据 爬虫 -# 模拟太原 和吕梁的房价数据 -# 怎么模拟 城市 面积 户型 是不是学区房 装修的风格 datas=[ { - "city":"吕梁", + "city":"大同", "area":100, "rooms":2, "school":1, @@ -13,7 +9,7 @@ datas=[ "price":8000 }, { - "city":"吕梁", + "city":"大同", "area":100, "rooms":2, "school":1, @@ -21,7 +17,7 @@ datas=[ "price":7800 }, { - "city":"吕梁", + "city":"大同", "area":100, "rooms":2, "school":1, @@ -31,7 +27,7 @@ datas=[ }, # 模拟 { - "city": "吕梁", + "city": "大同", "area": 130, "rooms": 3, "school": 1, @@ -39,7 +35,7 @@ datas=[ "price": 8300 }, { - "city":"吕梁", + "city":"大同", "area":135, "rooms":3, "school":1, @@ -47,7 +43,7 @@ datas=[ "price":8300 }, { - "city":"吕梁", + "city":"大同", "area":140, "rooms":3, "school":1, @@ -56,7 +52,7 @@ datas=[ }, { - "city": "吕梁", + "city": "大同", "area": 130, "rooms": 3, "school": 1, @@ -64,7 +60,7 @@ datas=[ "price": 5000 }, { - "city":"吕梁", + "city":"大同", "area":135, "rooms":3, "school":1, @@ -72,7 +68,7 @@ datas=[ "price":5300 }, { - "city":"吕梁", + "city":"大同", "area":140, "rooms":3, "school":1, @@ -80,7 +76,7 @@ datas=[ "price":6300 }, { - "city": "太原", + "city": "大同", "area": 100, "rooms": 2, "school": 1, @@ -88,7 +84,7 @@ datas=[ "price": 8000 }, { - "city": "太原", + "city": "大同", "area": 100, "rooms": 2, "school": 1, @@ -96,7 +92,7 @@ datas=[ "price": 7800 }, { - "city": "太原", + "city": "大同", "area": 100, "rooms": 2, "school": 1, @@ -106,7 +102,7 @@ datas=[ }, # 模拟 { - "city": "太原", + "city": "大同", "area": 130, "rooms": 3, "school": 1, @@ -114,7 +110,7 @@ datas=[ "price": 8300 }, { - "city": "太原", + "city": "大同", "area": 135, "rooms": 3, "school": 1, @@ -122,7 +118,7 @@ datas=[ "price": 8300 }, { - "city": "太原", + "city": "大同", "area": 140, "rooms": 3, "school": 1, @@ -131,7 +127,7 @@ datas=[ }, { - "city": "太原", + "city": "大同", "area": 130, "rooms": 3, "school": 1, @@ -139,7 +135,7 @@ datas=[ "price": 8500 }, { - "city": "太原", + "city": "大同", "area": 135, "rooms": 3, "school": 1, @@ -147,7 +143,7 @@ datas=[ "price": 8300 }, { - "city": "太原", + "city": "大同", "area": 140, "rooms": 3, "school": 2, diff --git a/homework2/7.5/predict.py b/homework2/7.5/predict.py index 3deb612..12b92ca 100644 --- a/homework2/7.5/predict.py +++ b/homework2/7.5/predict.py @@ -1,13 +1,6 @@ import numpy as np -# a=np.array([[1,2,3],[1,2,3],[1,2,3]]) -# b=np.array([1,2,3]) -# # 奇异矩阵 -# print(a.dot(b)) -# -# print(a) -# print(a.T) # 转置 -# print(np.linalg.pinv(a)) #求逆矩阵 + from datas import datas @@ -30,4 +23,4 @@ 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]))) -# print(theta) + -- Gitee