diff --git a/text/.idea/.gitignore b/text/.idea/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..13566b81b018ad684f3a35fee301741b2734c8f4 --- /dev/null +++ b/text/.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/text/.idea/.name b/text/.idea/.name new file mode 100644 index 0000000000000000000000000000000000000000..35c0710206399406045638d41b50e7148bc8f53f --- /dev/null +++ b/text/.idea/.name @@ -0,0 +1 @@ +reddict.py \ No newline at end of file diff --git a/text/.idea/inspectionProfiles/profiles_settings.xml b/text/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000000000000000000000000000000000000..105ce2da2d6447d11dfe32bfb846c3d5b199fc99 --- /dev/null +++ b/text/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/text/.idea/misc.xml b/text/.idea/misc.xml new file mode 100644 index 0000000000000000000000000000000000000000..2a01189048dd51552f6ba99bf21b7c67f3613c98 --- /dev/null +++ b/text/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/text/.idea/modules.xml b/text/.idea/modules.xml new file mode 100644 index 0000000000000000000000000000000000000000..e15ec35fe054f3b2c7c21e3dcca866d6a79ca0ba --- /dev/null +++ b/text/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/text/.idea/pythonProject.iml b/text/.idea/pythonProject.iml new file mode 100644 index 0000000000000000000000000000000000000000..2c80e1269497d12e018fd6afa29982e56b0fb70d --- /dev/null +++ b/text/.idea/pythonProject.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/text/.idea/vcs.xml b/text/.idea/vcs.xml new file mode 100644 index 0000000000000000000000000000000000000000..6c0b8635858dc7ad44b93df54b762707ce49eefc --- /dev/null +++ b/text/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/text/__pycache__/datas.cpython-312.pyc b/text/__pycache__/datas.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bf3e684343b76adf9cc0b44d12d0ba8cb2aced65 Binary files /dev/null and b/text/__pycache__/datas.cpython-312.pyc differ diff --git a/text/dd.py b/text/dd.py new file mode 100644 index 0000000000000000000000000000000000000000..485c95c546b18f8d19fd2dc1154c13caab25c559 --- /dev/null +++ b/text/dd.py @@ -0,0 +1,64 @@ + + +datas=[ + { + "city":"吕梁", + "area":100, + "rooms":2, + "school":1, + "style":1, + "price":8000, + }, +{ + "city":"吕梁", + "area":130, + "rooms":2, + "school":1, + "style":1, + "price":7800, + }, +{ + "city":"吕梁", + "area":150, + "rooms":2, + "school":1, + "style":1, + "price":8200, + }, + + +{ + "city":"太原", + "area":100, + "rooms":2, + "school":1, + "style":1, + "price":10000, + }, +{ + "city":"太原", + "area":130, + "rooms":2, + "school":1, + "style":1, + "price":9800, + }, +{ + "city":"太原", + "area":150, + "rooms":2, + "school":1, + "style":1, + "price":8500, + }, +] + +# 各 3000 10 1000 1300 1500 +# 城市 面积 房间数量 学区房 装修 各个元素的权重 a1 a2 a3 a4 a5 +# 总价即总分 : p +# 各个元素*各个元素的权重之和即为分数 +# 城市: x1 例: 县=1 市=2 +# 面积: x2 按平方米计量 +# 房间数量: x3 个数 +# 学区房 : bool 0/1 +# 装修: bool 0/1 是否精装修 \ No newline at end of file diff --git a/text/rr.py b/text/rr.py new file mode 100644 index 0000000000000000000000000000000000000000..630fecc2155caab86a826ccdb19d83f94680d070 --- /dev/null +++ b/text/rr.py @@ -0,0 +1,48 @@ + +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) +print(x) +print(y) + + +theta=np.linalg.pinv(x.T.dot(x)).dot(x.T).dot(y) + +print(theta.dot(np.array([2,100,2,1,1]))) + + +#a=np.array([[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)) #矩阵求逆 + + +