From b046fe8aa7985ff23e76cd8012582255ab8a9f02 Mon Sep 17 00:00:00 2001 From: Adu3328 <2129760640@qq.com> Date: Fri, 5 Jul 2024 20:10:00 +0800 Subject: [PATCH] 7.5zuoye --- pythonProject1 2/.idea/.gitignore | 8 + .../inspectionProfiles/profiles_settings.xml | 6 + pythonProject1 2/.idea/misc.xml | 4 + pythonProject1 2/.idea/modules.xml | 8 + pythonProject1 2/.idea/pythonProject1 2.iml | 15 ++ .../pythonProject1/.idea/.gitignore | 8 + .../inspectionProfiles/Project_Default.xml | 12 ++ .../inspectionProfiles/profiles_settings.xml | 6 + .../pythonProject1/.idea/misc.xml | 7 + .../pythonProject1/.idea/modules.xml | 8 + .../pythonProject1/.idea/pythonProject1.iml | 10 ++ .../7.5/__pycache__/datas.cpython-312.pyc | Bin 0 -> 1141 bytes pythonProject1 2/pythonProject1/7.5/datas.py | 160 ++++++++++++++++++ .../pythonProject1/7.5/predict.py | 33 ++++ pythonProject1 2/pythonProject1/main.py | 16 ++ 15 files changed, 301 insertions(+) create mode 100644 pythonProject1 2/.idea/.gitignore create mode 100644 pythonProject1 2/.idea/inspectionProfiles/profiles_settings.xml create mode 100644 pythonProject1 2/.idea/misc.xml create mode 100644 pythonProject1 2/.idea/modules.xml create mode 100644 pythonProject1 2/.idea/pythonProject1 2.iml create mode 100644 pythonProject1 2/pythonProject1/.idea/.gitignore create mode 100644 pythonProject1 2/pythonProject1/.idea/inspectionProfiles/Project_Default.xml create mode 100644 pythonProject1 2/pythonProject1/.idea/inspectionProfiles/profiles_settings.xml create mode 100644 pythonProject1 2/pythonProject1/.idea/misc.xml create mode 100644 pythonProject1 2/pythonProject1/.idea/modules.xml create mode 100644 pythonProject1 2/pythonProject1/.idea/pythonProject1.iml create mode 100644 pythonProject1 2/pythonProject1/7.5/__pycache__/datas.cpython-312.pyc create mode 100644 pythonProject1 2/pythonProject1/7.5/datas.py create mode 100644 pythonProject1 2/pythonProject1/7.5/predict.py create mode 100644 pythonProject1 2/pythonProject1/main.py diff --git a/pythonProject1 2/.idea/.gitignore b/pythonProject1 2/.idea/.gitignore new file mode 100644 index 0000000..35410ca --- /dev/null +++ b/pythonProject1 2/.idea/.gitignore @@ -0,0 +1,8 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml +# 基于编辑器的 HTTP 客户端请求 +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/pythonProject1 2/.idea/inspectionProfiles/profiles_settings.xml b/pythonProject1 2/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/pythonProject1 2/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/pythonProject1 2/.idea/misc.xml b/pythonProject1 2/.idea/misc.xml new file mode 100644 index 0000000..060d2c5 --- /dev/null +++ b/pythonProject1 2/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/pythonProject1 2/.idea/modules.xml b/pythonProject1 2/.idea/modules.xml new file mode 100644 index 0000000..42673e1 --- /dev/null +++ b/pythonProject1 2/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/pythonProject1 2/.idea/pythonProject1 2.iml b/pythonProject1 2/.idea/pythonProject1 2.iml new file mode 100644 index 0000000..5fdd65b --- /dev/null +++ b/pythonProject1 2/.idea/pythonProject1 2.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/pythonProject1 2/pythonProject1/.idea/.gitignore b/pythonProject1 2/pythonProject1/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/pythonProject1 2/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/pythonProject1 2/pythonProject1/.idea/inspectionProfiles/Project_Default.xml b/pythonProject1 2/pythonProject1/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..4ebeef7 --- /dev/null +++ b/pythonProject1 2/pythonProject1/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,12 @@ + + + + \ No newline at end of file diff --git a/pythonProject1 2/pythonProject1/.idea/inspectionProfiles/profiles_settings.xml b/pythonProject1 2/pythonProject1/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/pythonProject1 2/pythonProject1/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/pythonProject1 2/pythonProject1/.idea/misc.xml b/pythonProject1 2/pythonProject1/.idea/misc.xml new file mode 100644 index 0000000..a50ac5b --- /dev/null +++ b/pythonProject1 2/pythonProject1/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/pythonProject1 2/pythonProject1/.idea/modules.xml b/pythonProject1 2/pythonProject1/.idea/modules.xml new file mode 100644 index 0000000..fdd8fdf --- /dev/null +++ b/pythonProject1 2/pythonProject1/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/pythonProject1 2/pythonProject1/.idea/pythonProject1.iml b/pythonProject1 2/pythonProject1/.idea/pythonProject1.iml new file mode 100644 index 0000000..74d515a --- /dev/null +++ b/pythonProject1 2/pythonProject1/.idea/pythonProject1.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/pythonProject1 2/pythonProject1/7.5/__pycache__/datas.cpython-312.pyc b/pythonProject1 2/pythonProject1/7.5/__pycache__/datas.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..28681deac6c77a261ed3cd37d55b06e6d718ed86 GIT binary patch literal 1141 zcmX@j%ge<81Y2*krv-2`FgylvU_b)O_^iRmz%ZR5g&~D8g(-y@2w75C=dc0!Y*0Qs zl+OX>b3*xCDcoT7JWxI_l+Op{^F#RpP`)6PF9hWaL-`_5z9^J02Ih-nxJLrTJ>n^n zXzr1M>W8>TJVhFfF9YR6+#{YM3+2l}?UP4SuK?sT0U=m@x=<8DrJ|-%DH|}{o-SGW zY|GM@6+q@oCJ+G(LWax<@(c``Y`0jFGfOIOu_P9yCf;H#%FoX&zQtCYoROcObBndO zq%tS<7HdIKW^(GwCXl9MazO1pAXbzDkTng+ddUpp?gw!ffLI4WtW_Y^J4GOC3y8H# z7|7ZOV!aXpvMNEW+rTIVJMZP(na{Rve_0I_d|3k`nn6Shh-d{7Z9pP32V_<|h}!`q z{4^PFv8E)JBo?n^_zdJTe02vB&Q>v@#i>QbG0*1CdAgzhS^K0Im(=3ylKg_0g36MN z{Jemo{H)aE5<>+eG=Ug%J<}Mld3ptvzc_4i^HWN5QtgTqfTn^1tM~$t{J_k}$oN5k zK|taLzt9Z`aZUMZmPo008kBI%og@ literal 0 HcmV?d00001 diff --git a/pythonProject1 2/pythonProject1/7.5/datas.py b/pythonProject1 2/pythonProject1/7.5/datas.py new file mode 100644 index 0000000..2fb1f9c --- /dev/null +++ b/pythonProject1 2/pythonProject1/7.5/datas.py @@ -0,0 +1,160 @@ +# 经验是来源于数据 +# 大数据 爬虫 + +# 模拟太原 和吕梁的房价数据 +# 怎么模拟 城市 面积 户型 是不是学区房 装修的风格 +datas=[ + { + "city":"天津", + "area":120, + "rooms":2, + "school":1, + "style":1, + "price":8080 + }, + { + "city":"天津", + "area":130, + "rooms":2, + "school":1, + "style":1, + "price":7878 + }, + { + "city":"天津", + "area":140, + "rooms":2, + "school":1, + "style":1, + "price":8282 + + }, + # 模拟 + { + "city": "天津", + "area": 150, + "rooms": 3, + "school": 1, + "style": 1, + "price": 8383 + }, + { + "city":"天津", + "area":160, + "rooms":3, + "school":1, + "style":1, + "price":8384 + }, + { + "city":"天津", + "area":170, + "rooms":3, + "school":1, + "style":1, + "price":8686 + }, + +{ + "city": "天津", + "area": 180, + "rooms": 3, + "school": 1, + "style": 1, + "price": 5050 + }, + { + "city":"天津", + "area":190, + "rooms":3, + "school":1, + "style":1, + "price":5354 + }, + { + "city":"天津", + "area":121, + "rooms":3, + "school":1, + "style":1, + "price":6363 + }, + { + "city": "静海", + "area": 120, + "rooms": 2, + "school": 1, + "style": 1, + "price": 8080 + }, + { + "city": "天津", + "area": 123, + "rooms": 2, + "school": 1, + "style": 1, + "price": 7878 + }, + { + "city": "静海", + "area": 124, + "rooms": 2, + "school": 1, + "style": 1, + "price": 8282 + + }, + # 模拟 + { + "city": "天津", + "area": 131, + "rooms": 3, + "school": 1, + "style": 1, + "price": 8383 + }, + { + "city": "静海", + "area": 132, + "rooms": 3, + "school": 1, + "style": 1, + "price": 8383 + }, + { + "city": "静海", + "area": 133, + "rooms": 3, + "school": 1, + "style": 1, + "price": 8686 + }, + + { + "city": "静海", + "area": 134, + "rooms": 3, + "school": 1, + "style": 1, + "price": 8556 + }, + { + "city": "静海", + "area": 135, + "rooms": 3, + "school": 1, + "style": 1, + "price": 8383 + }, + { + "city": "静海", + "area": 136, + "rooms": 3, + "school": 2, + "style": 2, + "price": 8686 + }, + + +] + diff --git a/pythonProject1 2/pythonProject1/7.5/predict.py b/pythonProject1 2/pythonProject1/7.5/predict.py new file mode 100644 index 0000000..062dea7 --- /dev/null +++ b/pythonProject1 2/pythonProject1/7.5/predict.py @@ -0,0 +1,33 @@ +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 +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([2,100,2,1,1]))) +# print(theta) diff --git a/pythonProject1 2/pythonProject1/main.py b/pythonProject1 2/pythonProject1/main.py new file mode 100644 index 0000000..5596b44 --- /dev/null +++ b/pythonProject1 2/pythonProject1/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/ -- Gitee