修改: PriceSystem/sell_price/zhuge0118A.py
This commit is contained in:
@@ -321,6 +321,7 @@ def commonprice(ct, rl, p,weekend):
|
|||||||
return ppp
|
return ppp
|
||||||
|
|
||||||
#搜索周边小区,并且输出周边小区的房价
|
#搜索周边小区,并且输出周边小区的房价
|
||||||
|
#在提取周边小区时,按照距离远近进行排序,距离的定义是曼哈顿距离
|
||||||
@timer
|
@timer
|
||||||
def neighbor(lng, lat, scale, ct, rl, p):
|
def neighbor(lng, lat, scale, ct, rl, p):
|
||||||
|
|
||||||
@@ -354,6 +355,7 @@ def commonprice(ct, rl, p,weekend):
|
|||||||
|
|
||||||
######print('lf',lf[['estate_type2','lng2', 'lat2']])
|
######print('lf',lf[['estate_type2','lng2', 'lat2']])
|
||||||
|
|
||||||
|
#在提取周边小区时需要考虑小区的物业类型
|
||||||
le = lf[lf['estate_type2'] == estype]
|
le = lf[lf['estate_type2'] == estype]
|
||||||
######print(le['name'])
|
######print(le['name'])
|
||||||
|
|
||||||
@@ -387,6 +389,7 @@ def commonprice(ct, rl, p,weekend):
|
|||||||
|
|
||||||
#random.shuffle(dirst1)
|
#random.shuffle(dirst1)
|
||||||
|
|
||||||
|
#提取周边的80个小区
|
||||||
dirst = dirst1[:80]
|
dirst = dirst1[:80]
|
||||||
######print('dirst=',dirst)
|
######print('dirst=',dirst)
|
||||||
|
|
||||||
@@ -411,6 +414,9 @@ def commonprice(ct, rl, p,weekend):
|
|||||||
else:
|
else:
|
||||||
return numpy.array([])
|
return numpy.array([])
|
||||||
|
|
||||||
|
#本函数与上一个函数基本相同,仅仅缺少一行代码,le = lf[lf['estate_type2'] == estype]
|
||||||
|
#读取周边小区价格,不考虑其物业类型,原因是别墅或商住楼周边的同物业类型的小区非常少
|
||||||
|
#故而提取周边小区时不考虑其物业类型
|
||||||
def neighbor_km(lng, lat, scale, ct, rl, p):
|
def neighbor_km(lng, lat, scale, ct, rl, p):
|
||||||
|
|
||||||
###################
|
###################
|
||||||
@@ -617,7 +623,7 @@ def commonprice(ct, rl, p,weekend):
|
|||||||
return other1, dd2.shape[0]
|
return other1, dd2.shape[0]
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
#不考虑物业类型
|
||||||
dd6 = neighbor_km(location['lng2'].iloc[0], location['lat2'].iloc[0], 20, ct, rl, p)
|
dd6 = neighbor_km(location['lng2'].iloc[0], location['lat2'].iloc[0], 20, ct, rl, p)
|
||||||
##print('dd2=',dd2,'@'*60)
|
##print('dd2=',dd2,'@'*60)
|
||||||
if dd6.shape[0] >= 3:
|
if dd6.shape[0] >= 3:
|
||||||
@@ -646,6 +652,7 @@ def commonprice(ct, rl, p,weekend):
|
|||||||
lf = fangjia.find_seaweed(query1, fields1)
|
lf = fangjia.find_seaweed(query1, fields1)
|
||||||
return lf
|
return lf
|
||||||
|
|
||||||
|
#聚类算法
|
||||||
def k_means(pp1):
|
def k_means(pp1):
|
||||||
from sklearn.cluster import KMeans
|
from sklearn.cluster import KMeans
|
||||||
pv = list(pp1)
|
pv = list(pp1)
|
||||||
@@ -1045,7 +1052,7 @@ def commonprice(ct, rl, p,weekend):
|
|||||||
dg22 = middle_operate(junjia_lzf, junjia_anst)
|
dg22 = middle_operate(junjia_lzf, junjia_anst)
|
||||||
return junjia_max(mmax,dg22)
|
return junjia_max(mmax,dg22)
|
||||||
|
|
||||||
|
#由于链家和诸葛找房的数据准确度比较高,增加链家和诸葛找房数据的权重,即放大20倍.
|
||||||
def add_weight(s1):
|
def add_weight(s1):
|
||||||
|
|
||||||
choose_columns=['url','area', 'district_name', 'name', 'p_date', 'region',
|
choose_columns=['url','area', 'district_name', 'name', 'p_date', 'region',
|
||||||
@@ -1079,7 +1086,8 @@ def commonprice(ct, rl, p,weekend):
|
|||||||
return d1
|
return d1
|
||||||
else:
|
else:
|
||||||
return s1
|
return s1
|
||||||
|
#在第三方 均价中安居客的价格和赶集网的价格大概率的相同,在采用第三方均价计算价格时如果
|
||||||
|
#赶集和安居客几乎相同并且和其他数据不同,就drop赶集网 的均价
|
||||||
def drop_ganji(junjia):
|
def drop_ganji(junjia):
|
||||||
a = {'ganji_esf_price', 'anjuke_esf_price'}
|
a = {'ganji_esf_price', 'anjuke_esf_price'}
|
||||||
# #####print('a=',a)
|
# #####print('a=',a)
|
||||||
@@ -1100,16 +1108,18 @@ def commonprice(ct, rl, p,weekend):
|
|||||||
else:
|
else:
|
||||||
return junjia
|
return junjia
|
||||||
lk = p[0]
|
lk = p[0]
|
||||||
|
|
||||||
|
#本小区的经纬度
|
||||||
location = take_location(ct, rl, p)
|
location = take_location(ct, rl, p)
|
||||||
|
|
||||||
######print('location',location)
|
######print('location',location)
|
||||||
|
|
||||||
# ttp=time.time()
|
# ttp=time.time()
|
||||||
|
#本小区的周边价格(向量回归或者聚类)
|
||||||
neighb = no_source_price(ct, rl, location, p)
|
neighb = no_source_price(ct, rl, location, p)
|
||||||
|
|
||||||
# #####print(time.time()-ttp,'m'*20)
|
# #####print(time.time()-ttp,'m'*20)
|
||||||
|
#本小区的第三方均价
|
||||||
junjia = dsfjujia(ct, rl, lk)
|
junjia = dsfjujia(ct, rl, lk)
|
||||||
print('junjia=',junjia)
|
print('junjia=',junjia)
|
||||||
#print('neighb=',neighb)
|
#print('neighb=',neighb)
|
||||||
@@ -1119,6 +1129,8 @@ def commonprice(ct, rl, p,weekend):
|
|||||||
dggg=dsplg(junjia,neighb,1)
|
dggg=dsplg(junjia,neighb,1)
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
#在第三方 均价中安居客的价格和赶集网的价格大概率的相同,在采用第三方均价计算价格时如果
|
||||||
|
#赶集和安居客几乎相同并且和其他数据不同,就drop赶集网 的均价
|
||||||
|
|
||||||
judp=drop_ganji(junjia)
|
judp=drop_ganji(junjia)
|
||||||
dglg = dglg_out1(judp, neighb[0])
|
dglg = dglg_out1(judp, neighb[0])
|
||||||
|
|||||||
Reference in New Issue
Block a user