From dc2016897af48e1323621edf5a0d0e8570534606 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E9=9B=AA=E5=A8=87?= <14647812+baixuejiaolove@user.noreply.gitee.com> Date: Fri, 5 Jul 2024 19:14:44 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BD=E9=9B=AA=E5=A8=87=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 --- pythonProject/.idea/.gitignore | 8 +++++++ .../inspectionProfiles/profiles_settings.xml | 6 ++++++ pythonProject/.idea/misc.xml | 7 ++++++ pythonProject/.idea/modules.xml | 8 +++++++ pythonProject/.idea/pythonProject.iml | 11 ++++++++++ pythonProject/7.4-homework | 1 + .../7.5/__pycache__/datas.cpython-312.pyc | Bin 0 -> 323 bytes pythonProject/7.5/datas.py | 17 +++++++++++++++ pythonProject/7.5/predict.py | 20 ++++++++++++++++++ 9 files changed, 78 insertions(+) create mode 100644 pythonProject/.idea/.gitignore create mode 100644 pythonProject/.idea/inspectionProfiles/profiles_settings.xml create mode 100644 pythonProject/.idea/misc.xml create mode 100644 pythonProject/.idea/modules.xml create mode 100644 pythonProject/.idea/pythonProject.iml create mode 160000 pythonProject/7.4-homework create mode 100644 pythonProject/7.5/__pycache__/datas.cpython-312.pyc create mode 100644 pythonProject/7.5/datas.py create mode 100644 pythonProject/7.5/predict.py diff --git a/pythonProject/.idea/.gitignore b/pythonProject/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/pythonProject/.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/pythonProject/.idea/inspectionProfiles/profiles_settings.xml b/pythonProject/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/pythonProject/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/pythonProject/.idea/misc.xml b/pythonProject/.idea/misc.xml new file mode 100644 index 0000000..bf1e1e8 --- /dev/null +++ b/pythonProject/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/pythonProject/.idea/modules.xml b/pythonProject/.idea/modules.xml new file mode 100644 index 0000000..e15ec35 --- /dev/null +++ b/pythonProject/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/pythonProject/.idea/pythonProject.iml b/pythonProject/.idea/pythonProject.iml new file mode 100644 index 0000000..b0ae122 --- /dev/null +++ b/pythonProject/.idea/pythonProject.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/pythonProject/7.4-homework b/pythonProject/7.4-homework new file mode 160000 index 0000000..4af7a6d --- /dev/null +++ b/pythonProject/7.4-homework @@ -0,0 +1 @@ +Subproject commit 4af7a6d3a47fc28456ed2c3f4427cb54d8391e72 diff --git a/pythonProject/7.5/__pycache__/datas.cpython-312.pyc b/pythonProject/7.5/__pycache__/datas.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..671c1022f68df51136ffc727c4859a0a25d0179d GIT binary patch literal 323 zcmX@j%ge<81UBp2)7Tgp7#@Q-Fu(z2eAWOmrZc24q%fv1r7!~_OA6~8HYlG7CPO4oI zKhPwQbBb+%#0O?ZM#cv`A~$&WZ}9Tn-~*Gqf*-lrSlK`DG4P4q;1vLg@`Fh}A&>;e P2SEXLrbgBxUZ4R0)6rQ^ literal 0 HcmV?d00001 diff --git a/pythonProject/7.5/datas.py b/pythonProject/7.5/datas.py new file mode 100644 index 0000000..a821bf2 --- /dev/null +++ b/pythonProject/7.5/datas.py @@ -0,0 +1,17 @@ +datas=[ + {"city":"吕梁", + "area":100, + "rooms":2, + "school":1, + "style":1, + "price":8000 + }, + {"city": "吕梁", + "area": 100, + "rooms": 2, + "school": 2, + "style": 2, + "price": 8000 + } + +] diff --git a/pythonProject/7.5/predict.py b/pythonProject/7.5/predict.py new file mode 100644 index 0000000..18bb325 --- /dev/null +++ b/pythonProject/7.5/predict.py @@ -0,0 +1,20 @@ +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,120,2,1,2]))) \ No newline at end of file -- Gitee