diff --git a/work/.idea/.gitignore b/work/.idea/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..13566b81b018ad684f3a35fee301741b2734c8f4 --- /dev/null +++ b/work/.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/work/.idea/inspectionProfiles/profiles_settings.xml b/work/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000000000000000000000000000000000000..105ce2da2d6447d11dfe32bfb846c3d5b199fc99 --- /dev/null +++ b/work/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/work/.idea/misc.xml b/work/.idea/misc.xml new file mode 100644 index 0000000000000000000000000000000000000000..08c484f8e372e97b64f7c46d85dae8c291c79811 --- /dev/null +++ b/work/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/work/.idea/modules.xml b/work/.idea/modules.xml new file mode 100644 index 0000000000000000000000000000000000000000..263cec1c8840b31a68fea054075aff31851bae1f --- /dev/null +++ b/work/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/work/.idea/work.iml b/work/.idea/work.iml new file mode 100644 index 0000000000000000000000000000000000000000..b67588fbce3797471836cbd10ccf3be073783bca --- /dev/null +++ b/work/.idea/work.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/work/datas.py b/work/datas.py new file mode 100644 index 0000000000000000000000000000000000000000..1e0cdf6682a7f10a3adfdf6ccde2c063dd14b655 --- /dev/null +++ b/work/datas.py @@ -0,0 +1,48 @@ + +datas = [ + { + "city":"吕梁" , + "area":100, + "rooms":2, + "school":2, + "style":2, + "price":4300, + }, + + + { + "city":"吕梁" , + "area":120, + "rooms":3, + "school":1, + "style":1, + "price":5000, + }, + + { + "city":"太原", + "area":100, + "rooms":2, + "school":2, + "style":2, + "price":7000, + }, + + { + "city":"太原" , + "area":100, + "rooms":3, + "school":1, + "style":1, + "price":8600, + }, + + { + "city":"太原" , + "area":100, + "rooms":2, + "school":1, + "style":2, + "price":8000, + }, +] \ No newline at end of file diff --git a/work/main.py b/work/main.py new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/work/main.py @@ -0,0 +1 @@ + diff --git a/work/predict.py b/work/predict.py new file mode 100644 index 0000000000000000000000000000000000000000..34fb2746031af84c1d3d9a0ccf5cc8236ba752cc --- /dev/null +++ b/work/predict.py @@ -0,0 +1,21 @@ +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(cityMark[item["area"]]) + single.append(cityMark[item["rooms"]]) + single.append(cityMark[item["school"]]) + single.append(cityMark[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))) + +