From a1a1710f67bf4cc4bd107861e8b3c83484b13ec4 Mon Sep 17 00:00:00 2001 From: liqingze0601 <50614235@qq.com> Date: Sat, 6 Jul 2024 00:09:52 +0800 Subject: [PATCH 1/2] 1 --- .idea/.gitignore | 8 +++ .idea/.name | 1 + .../inspectionProfiles/profiles_settings.xml | 6 ++ .idea/misc.xml | 7 ++ .idea/modules.xml | 8 +++ .idea/pythonProject.iml | 10 +++ .idea/vcs.xml | 6 ++ __pycache__/datas.cpython-312.pyc | Bin 0 -> 519 bytes datas.py | 64 ++++++++++++++++++ reddict.py | 48 +++++++++++++ 10 files changed, 158 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/.name create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/pythonProject.iml create mode 100644 .idea/vcs.xml create mode 100644 __pycache__/datas.cpython-312.pyc create mode 100644 datas.py create mode 100644 reddict.py diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..1c2fda5 --- /dev/null +++ b/.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/.idea/.name b/.idea/.name new file mode 100644 index 0000000..35c0710 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +reddict.py \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..09af694 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..e1ceb69 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/pythonProject.iml b/.idea/pythonProject.iml new file mode 100644 index 0000000..f246f2c --- /dev/null +++ b/.idea/pythonProject.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..2e3f692 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/__pycache__/datas.cpython-312.pyc b/__pycache__/datas.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bf3e684343b76adf9cc0b44d12d0ba8cb2aced65 GIT binary patch literal 519 zcmX@j%ge<81R5LK({xxF7#@Q-Fu((4e9izerZc24q%fv1r7!~_OA6~8HXxr3%4di2 zIiP$_FrN#qo*T-Cspo<6Vd{B7{B*V`hDtt7{!%uebx$WueYU9aWeSk_k_kjG0*Ooq zc?Jeewp%R8nI)CCSQ3j;6K}B=<>%)X-(o9H&dATtxy4#sQkj!_i?yIAGdcBT6G&5q z98mi-5Q{^BfdOLrl2uRp=4T410|hCIv)3^0KqCeGtMb!H7pf3`2(~&?tO5aM}^hXw1&k$Xdh?bSD6- C?~C04 literal 0 HcmV?d00001 diff --git a/datas.py b/datas.py new file mode 100644 index 0000000..cb957f7 --- /dev/null +++ b/datas.py @@ -0,0 +1,64 @@ + + +data=[ + { + "city":"吕梁", + "area":100, + "rooms":2, + "school":1, + "style":1, + "price":8000, + }, +{ + "city":"吕梁", + "area":130, + "rooms":2, + "school":1, + "style":1, + "price":7800, + }, +{ + "city":"吕梁", + "area":150, + "rooms":2, + "school":1, + "style":1, + "price":8200, + }, + + +{ + "city":"太原", + "area":100, + "rooms":2, + "school":1, + "style":1, + "price":10000, + }, +{ + "city":"太原", + "area":130, + "rooms":2, + "school":1, + "style":1, + "price":9800, + }, +{ + "city":"太原", + "area":150, + "rooms":2, + "school":1, + "style":1, + "price":8500, + }, +] + +# 各 3000 10 1000 1300 1500 +# 城市 面积 房间数量 学区房 装修 各个元素的权重 a1 a2 a3 a4 a5 +# 总价即总分 : p +# 各个元素*各个元素的权重之和即为分数 +# 城市: x1 例: 县=1 市=2 +# 面积: x2 按平方米计量 +# 房间数量: x3 个数 +# 学区房 : bool 0/1 +# 装修: bool 0/1 是否精装修 \ No newline at end of file diff --git a/reddict.py b/reddict.py new file mode 100644 index 0000000..df34078 --- /dev/null +++ b/reddict.py @@ -0,0 +1,48 @@ + +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["area"]) + + single.append(item["rooms"]) + + single.append(item["school"]) + + single.append(item["style"]) + + + +x.append(single) +y.append(item["price"]) + +x=np.array(x) +y=np.array(y) +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]))) + + +#a=np.array([[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)) #矩阵求逆 + + + -- Gitee From a378b8684037fbbcbbd68e2e513f0d69564cd6cc Mon Sep 17 00:00:00 2001 From: liqingze <50614235@qq.com> Date: Sat, 6 Jul 2024 09:42:24 +0800 Subject: [PATCH 2/2] lqz --- .idea/vcs.xml | 2 ++ 7.5-homework | 1 + reddict.py | 1 - 3 files changed, 3 insertions(+), 1 deletion(-) create mode 160000 7.5-homework diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 2e3f692..d7d9566 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -2,5 +2,7 @@ + + \ No newline at end of file diff --git a/7.5-homework b/7.5-homework new file mode 160000 index 0000000..dd39b07 --- /dev/null +++ b/7.5-homework @@ -0,0 +1 @@ +Subproject commit dd39b0754176fd0f813eb20aa00421566e1f23fe diff --git a/reddict.py b/reddict.py index df34078..5c36ee0 100644 --- a/reddict.py +++ b/reddict.py @@ -6,7 +6,6 @@ y=[] cityMark={"吕梁":1,"太原":2} for item in datas: single=[] - single.append(cityMark[item["city"]]) single.append(item["area"]) -- Gitee