diff --git "a/\350\275\257\345\267\2452\347\217\255 \345\206\257\345\256\207\347\207\225/.idea/inspectionProfiles/profiles_settings.xml" "b/\350\275\257\345\267\2452\347\217\255 \345\206\257\345\256\207\347\207\225/.idea/inspectionProfiles/profiles_settings.xml" new file mode 100644 index 0000000000000000000000000000000000000000..105ce2da2d6447d11dfe32bfb846c3d5b199fc99 --- /dev/null +++ "b/\350\275\257\345\267\2452\347\217\255 \345\206\257\345\256\207\347\207\225/.idea/inspectionProfiles/profiles_settings.xml" @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git "a/\350\275\257\345\267\2452\347\217\255 \345\206\257\345\256\207\347\207\225/.idea/misc.xml" "b/\350\275\257\345\267\2452\347\217\255 \345\206\257\345\256\207\347\207\225/.idea/misc.xml" new file mode 100644 index 0000000000000000000000000000000000000000..2a01189048dd51552f6ba99bf21b7c67f3613c98 --- /dev/null +++ "b/\350\275\257\345\267\2452\347\217\255 \345\206\257\345\256\207\347\207\225/.idea/misc.xml" @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git "a/\350\275\257\345\267\2452\347\217\255 \345\206\257\345\256\207\347\207\225/.idea/modules.xml" "b/\350\275\257\345\267\2452\347\217\255 \345\206\257\345\256\207\347\207\225/.idea/modules.xml" new file mode 100644 index 0000000000000000000000000000000000000000..e15ec35fe054f3b2c7c21e3dcca866d6a79ca0ba --- /dev/null +++ "b/\350\275\257\345\267\2452\347\217\255 \345\206\257\345\256\207\347\207\225/.idea/modules.xml" @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git "a/\350\275\257\345\267\2452\347\217\255 \345\206\257\345\256\207\347\207\225/.idea/pythonProject.iml" "b/\350\275\257\345\267\2452\347\217\255 \345\206\257\345\256\207\347\207\225/.idea/pythonProject.iml" new file mode 100644 index 0000000000000000000000000000000000000000..2c80e1269497d12e018fd6afa29982e56b0fb70d --- /dev/null +++ "b/\350\275\257\345\267\2452\347\217\255 \345\206\257\345\256\207\347\207\225/.idea/pythonProject.iml" @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git "a/\350\275\257\345\267\2452\347\217\255 \345\206\257\345\256\207\347\207\225/__pycache__/datas.cpython-312.pyc" "b/\350\275\257\345\267\2452\347\217\255 \345\206\257\345\256\207\347\207\225/__pycache__/datas.cpython-312.pyc" new file mode 100644 index 0000000000000000000000000000000000000000..85948dec5d2f81285c359a88b78f2e195cb446d1 Binary files /dev/null and "b/\350\275\257\345\267\2452\347\217\255 \345\206\257\345\256\207\347\207\225/__pycache__/datas.cpython-312.pyc" differ diff --git "a/\350\275\257\345\267\2452\347\217\255 \345\206\257\345\256\207\347\207\225/datas.py" "b/\350\275\257\345\267\2452\347\217\255 \345\206\257\345\256\207\347\207\225/datas.py" new file mode 100644 index 0000000000000000000000000000000000000000..7b52b24aaeffb8ee454870a357acdf3ce7932a57 --- /dev/null +++ "b/\350\275\257\345\267\2452\347\217\255 \345\206\257\345\256\207\347\207\225/datas.py" @@ -0,0 +1,170 @@ +# 经验就是来源于数据 +# 大数据 爬虫 后天 + +# 模拟太原和吕梁的房价数据 + +#怎么模拟 城市 面积 户型 是不是学区房 1 2 装修的风格 1 2 +#预测系统 +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 + } +] + +# 各 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/\350\275\257\345\267\2452\347\217\255 \345\206\257\345\256\207\347\207\225/or.py" "b/\350\275\257\345\267\2452\347\217\255 \345\206\257\345\256\207\347\207\225/or.py" new file mode 100644 index 0000000000000000000000000000000000000000..aeee301fbcab7d336d92a69ab1f38213f470fdaa --- /dev/null +++ "b/\350\275\257\345\267\2452\347\217\255 \345\206\257\345\256\207\347\207\225/or.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/\350\275\257\345\267\2452\347\217\255 \345\206\257\345\256\207\347\207\225/predict.py" "b/\350\275\257\345\267\2452\347\217\255 \345\206\257\345\256\207\347\207\225/predict.py" new file mode 100644 index 0000000000000000000000000000000000000000..7888aa4b2ef9a38ea297c9bbbde073ca528560a7 --- /dev/null +++ "b/\350\275\257\345\267\2452\347\217\255 \345\206\257\345\256\207\347\207\225/predict.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) + + +