From 28626ffbaf2c4a3f8a9f352fbb89d635559ea828 Mon Sep 17 00:00:00 2001 From: xuyuanyua <3260999573@qq.com> Date: Fri, 5 Jul 2024 19:26:13 +0800 Subject: [PATCH] zuoye --- zuoye/pythonProject1/.idea/.gitignore | 8 + .../inspectionProfiles/profiles_settings.xml | 6 + zuoye/pythonProject1/.idea/misc.xml | 7 + zuoye/pythonProject1/.idea/modules.xml | 8 + zuoye/pythonProject1/.idea/pythonProject2.iml | 10 ++ .../__pycache__/datas.cpython-312.pyc | Bin 0 -> 1080 bytes zuoye/pythonProject1/datas.py | 170 ++++++++++++++++++ zuoye/pythonProject1/predict.py | 21 +++ 8 files changed, 230 insertions(+) create mode 100644 zuoye/pythonProject1/.idea/.gitignore create mode 100644 zuoye/pythonProject1/.idea/inspectionProfiles/profiles_settings.xml create mode 100644 zuoye/pythonProject1/.idea/misc.xml create mode 100644 zuoye/pythonProject1/.idea/modules.xml create mode 100644 zuoye/pythonProject1/.idea/pythonProject2.iml create mode 100644 zuoye/pythonProject1/__pycache__/datas.cpython-312.pyc create mode 100644 zuoye/pythonProject1/datas.py create mode 100644 zuoye/pythonProject1/predict.py diff --git a/zuoye/pythonProject1/.idea/.gitignore b/zuoye/pythonProject1/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/zuoye/pythonProject1/.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/zuoye/pythonProject1/.idea/inspectionProfiles/profiles_settings.xml b/zuoye/pythonProject1/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/zuoye/pythonProject1/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/zuoye/pythonProject1/.idea/misc.xml b/zuoye/pythonProject1/.idea/misc.xml new file mode 100644 index 0000000..76656f0 --- /dev/null +++ b/zuoye/pythonProject1/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/zuoye/pythonProject1/.idea/modules.xml b/zuoye/pythonProject1/.idea/modules.xml new file mode 100644 index 0000000..b7e2173 --- /dev/null +++ b/zuoye/pythonProject1/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/zuoye/pythonProject1/.idea/pythonProject2.iml b/zuoye/pythonProject1/.idea/pythonProject2.iml new file mode 100644 index 0000000..b11b4e1 --- /dev/null +++ b/zuoye/pythonProject1/.idea/pythonProject2.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/zuoye/pythonProject1/__pycache__/datas.cpython-312.pyc b/zuoye/pythonProject1/__pycache__/datas.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bc10bbae682fa0808ad270b3b17204df22a22edb GIT binary patch literal 1080 zcmX@j%ge<81W{Mp)0P2Qk3k$5kbp8iYcMh}OlL@8NMTH2N?`^L43J;Xe3zlbs>*q+}1FC0AfvJa>&zS-<4`MziT%I4So-;)NY@T3> z5YRl3i-e(kkoh1!OkM=a7e!Ielp+S@gUn+BLR9rkDKPaSV0lgy^O=EWqN?Xi5eJ!< zE)>O3DWNG@$_5O#rxT_=Th#b61;~8K1R{Vz$dKtE&%mI`c8euBv!wDCOJY%K;w{#q z{QTVFTWrP28Tt7+w^)lyDsxhAu@)3%Ca1p418Fi*1ZtlKGJ_e!)ldeqDnP6VX&`GN zNP-1KG=aoqR2di`4p_44Y2W;p?I6Jr6`*tvh}8g;&inv0A@f2VBZHqN<1N;d#FE6~ zl?U>0g>DFeNkP$%yd11- uAEdBKFtU9R8U7Li5;ypT5J4g!0t}MD=W{WLtEySjnb?^cS&PJgF$(~JE+e4; literal 0 HcmV?d00001 diff --git a/zuoye/pythonProject1/datas.py b/zuoye/pythonProject1/datas.py new file mode 100644 index 0000000..592d5ff --- /dev/null +++ b/zuoye/pythonProject1/datas.py @@ -0,0 +1,170 @@ +datas=[ + { + "city": "吕梁", + "area": 100, + "rooms": 2, + "school": 1, + "style": 1, + "price": 8000, + + }, + + + +{ + "city": "吕梁", + "area": 110, + "rooms": 2, + "school": 1, + "style": 1, + "price": 8500, + + }, +{ + "city": "吕梁", + "area": 150, + "rooms": 3, + "school": 1, + "style": 1, + "price": 9000, + + }, +{ + "city": "吕梁", + "area": 120, + "rooms": 2, + "school": 1, + "style": 2, + "price": 7000, + + }, +{ + "city": "吕梁", + "area": 145, + "rooms": 3, + "school": 1, + "style": 2, + "price": 8000, + + }, +{ + "city": "吕梁", + "area": 150, + "rooms": 4, + "school": 1, + "style": 2, + "price": 9000, + + }, +{ + "city": "吕梁", + "area": 100, + "rooms": 2, + "school": 1, + "style": 3, + "price": 8500, + + }, +{ + "city": "吕梁", + "area": 110, + "rooms": 2, + "school": 1, + "style": 3, + "price": 9000, + + }, +{ + "city": "吕梁", + "area": 130, + "rooms": 4, + "school": 1, + "style": 3, + "price": 9500, + + }, +{ + "city": "太原", + "area": 135, + "rooms": 3, + "school": 2, + "style": 1, + "price": 9300, + + }, +{ + "city": "太原", + "area": 145, + "rooms": 3, + "school": 2, + "style": 1, + "price": 9500, + + }, +{ + "city":"太原", + "area":140, + "rooms": 3, + "school": 2, + "style": 1, + "price":9600, + + }, +{ + "city": "太原", + "area": 135, + "rooms": 3, + "school": 2, + "style": 2, + "price": 9200, + + }, +{ + "city": "太原", + "area": 130, + "rooms": 4, + "school": 2, + "style": 2, + "price": 9500, + + }, +{ + "city": "太原", + "area": 140, + "rooms": 3, + "school": 2, + "style": 2, + "price": 9600, + + }, +{ + "city": "太原", + "area": 140, + "rooms": 4, + "school": 2, + "style": 3, + "price": 9300, + + }, +{ + "city": "太原", + "area": 145, + "rooms": 3, + "school": 1, + "style": 3, + "price": 9500, + + }, +{ + "city": "太原", + "area": 140, + "rooms": 3, + "school": 2, + "style": 3, + "price": 98000, + + }, + +] + + diff --git a/zuoye/pythonProject1/predict.py b/zuoye/pythonProject1/predict.py new file mode 100644 index 0000000..04f6aee --- /dev/null +++ b/zuoye/pythonProject1/predict.py @@ -0,0 +1,21 @@ +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) + +theta = np.linalg.pinv(X.T.dot(X)).dot(X.T).dot(Y) + +print(theta.dot(np.array([1,150,2,1,1]))) -- Gitee