diff --git a/pythonProject/.idea/.gitignore b/pythonProject/.idea/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..13566b81b018ad684f3a35fee301741b2734c8f4 --- /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 0000000000000000000000000000000000000000..105ce2da2d6447d11dfe32bfb846c3d5b199fc99 --- /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 0000000000000000000000000000000000000000..bf1e1e8cc4709b430a78fb3c925b3c3757924b0e --- /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 0000000000000000000000000000000000000000..e15ec35fe054f3b2c7c21e3dcca866d6a79ca0ba --- /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 0000000000000000000000000000000000000000..b0ae12274afeb265e7bb04c573ba08abcb372381 --- /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 0000000000000000000000000000000000000000..4af7a6d3a47fc28456ed2c3f4427cb54d8391e72 --- /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 Binary files /dev/null and b/pythonProject/7.5/__pycache__/datas.cpython-312.pyc differ diff --git a/pythonProject/7.5/datas.py b/pythonProject/7.5/datas.py new file mode 100644 index 0000000000000000000000000000000000000000..a821bf2aae1bb4c8766d0197447ad2640f27b35c --- /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 0000000000000000000000000000000000000000..18bb3250045fc2ab5f61cf258fe79550878cea80 --- /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