diff --git a/pythonProject/.idea/.gitignore b/pythonProject/.idea/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..35410cacdc5e87f985c93a96520f5e11a5c822e4 --- /dev/null +++ b/pythonProject/.idea/.gitignore @@ -0,0 +1,8 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml +# 基于编辑器的 HTTP 客户端请求 +/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..2a01189048dd51552f6ba99bf21b7c67f3613c98 --- /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..2c80e1269497d12e018fd6afa29982e56b0fb70d --- /dev/null +++ b/pythonProject/.idea/pythonProject.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/pythonProject/2.py b/pythonProject/2.py new file mode 100644 index 0000000000000000000000000000000000000000..aeee301fbcab7d336d92a69ab1f38213f470fdaa --- /dev/null +++ b/pythonProject/2.py @@ -0,0 +1,8 @@ +import numpy as np + +a=np.array([[1,2,3],[4,5,6],[7,8,9]]) +b=np.array([[1,2,3],[4,5,6],[7,8,9]]) + +print(np.linalg.pinv(a)) #奇异矩阵 逆 +print(a.T) #转置 +print(a.dot(b)) #点乘 \ No newline at end of file diff --git a/pythonProject/__pycache__/datas.cpython-312.pyc b/pythonProject/__pycache__/datas.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..85948dec5d2f81285c359a88b78f2e195cb446d1 Binary files /dev/null and b/pythonProject/__pycache__/datas.cpython-312.pyc differ diff --git a/pythonProject/datas.py b/pythonProject/datas.py new file mode 100644 index 0000000000000000000000000000000000000000..b815f7b4ea3784062d55af2255a1fa93cff11037 --- /dev/null +++ b/pythonProject/datas.py @@ -0,0 +1,154 @@ +#城市 面积 户型 学区房 装修类型:精装1 +datas=[ + #吕梁第一类 + { + "city":"吕梁", + "area":80, + "hx":2, + "xqf":1, + "style":2, + "price":6000 + }, + { + "city": "吕梁", + "area": 80, + "hx": 2, + "xqf": 2, + "style": 2, + "price": 6200 + }, + { + "city": "吕梁", + "area": 80, + "hx": 3, + "xqf": 2, + "style": 2, + "price": 6500 + }, + #吕梁第二类 + { + "city": "吕梁", + "area": 100, + "hx": 2, + "xqf": 2, + "style": 1, + "price": 7000 + }, + { + "city": "吕梁", + "area": 100, + "hx": 2, + "xqf": 1, + "style": 2, + "price": 7600 + }, + { + "city": "吕梁", + "area": 100, + "hx": 3, + "xqf": 2, + "style": 1, + "price": 7300 + }, + #吕梁第三类 + { + "city": "吕梁", + "area": 120, + "hx": 2, + "xqf": 2, + "style": 1, + "price": 9000 + }, + { + "city": "吕梁", + "area": 130, + "hx": 2, + "xqf": 1, + "style": 2, + "price": 9200 + }, + { + "city": "吕梁", + "area": 150, + "hx": 3, + "xqf": 1, + "style": 2, + "price": 10000 + }, + + # 太原第一类 + { + "city": "太原", + "area": 120, + "hx": 2, + "xqf": 2, + "style": 1, + "price": 10100 + }, + { + "city": "太原", + "area": 130, + "hx": 2, + "xqf": 1, + "style": 2, + "price": 10200 + }, + { + "city": "太原", + "area": 150, + "hx": 3, + "xqf": 1, + "style": 2, + "price": 10500 + }, + # 太原第二类 + { + "city": "太原", + "area": 120, + "hx": 2, + "xqf": 2, + "style": 1, + "price": 11000 + }, + { + "city": "太原", + "area": 130, + "hx": 2, + "xqf": 1, + "style": 2, + "price": 10200 + }, + { + "city": "太原", + "area": 150, + "hx": 3, + "xqf": 1, + "style": 2, + "price": 10500 + }, + # 太原第三类 + { + "city": "太原", + "area": 120, + "hx": 2, + "xqf": 2, + "style": 1, + "price": 10400 + }, + { + "city": "太原", + "area": 130, + "hx": 2, + "xqf": 1, + "style": 2, + "price": 12000 + }, + { + "city": "太原", + "area": 150, + "hx": 3, + "xqf": 1, + "style": 2, + "price": 13500 + } +] \ No newline at end of file diff --git a/pythonProject/yc.py b/pythonProject/yc.py new file mode 100644 index 0000000000000000000000000000000000000000..7888aa4b2ef9a38ea297c9bbbde073ca528560a7 --- /dev/null +++ b/pythonProject/yc.py @@ -0,0 +1,23 @@ +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["hx"]) + single.append(item["xqf"]) + 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(X.T).dot(Y) +print(theta) + + +