优化分数

This commit is contained in:
沈健
2025-04-15 18:23:32 +08:00
parent 713e6ce9ba
commit 3c88276173
@@ -91,7 +91,7 @@ def calc_consumption_potential(city):
max_avg_cost_fixed = community_summary_df['avg_cost_fixed'].max()
max_estate_charge_fixed = community_summary_df['estate_charge_fixed'].max()
max_relative_price_ranking = community_summary_df['relative_price_ranking'].max()
community_summary_df['total_price_fixed'] = 1 - np.log(community_summary_df['total_price_fixed'] + 1) / np.log(max_total_price_fixed + 1)
community_summary_df['total_price_fixed'] = np.log1p(community_summary_df['total_price_fixed'])
# 人均消费极大值处理
community_summary_df['avg_cost_fixed'] = np.where(community_summary_df['avg_cost_fixed'] > 250, 250, community_summary_df['avg_cost_fixed'])
@@ -101,8 +101,8 @@ def calc_consumption_potential(city):
community_summary_df['avg_cost_fixed'] = None
pass
#community_summary_df['avg_cost_fixed'] = 1 - np.log(community_summary_df['avg_cost_fixed'] + 1) / np.log(max_avg_cost_fixed + 1)
community_summary_df['estate_charge_fixed'] = 1 - np.log(community_summary_df['estate_charge_fixed'] + 1) / np.log(max_estate_charge_fixed + 1)
community_summary_df['relative_price_ranking'] = 1 - np.log(community_summary_df['relative_price_ranking'] + 1) / np.log(max_relative_price_ranking + 1)
community_summary_df['estate_charge_fixed'] = np.log1p(community_summary_df['estate_charge_fixed'])
community_summary_df['relative_price_ranking'] = np.log1p(community_summary_df['relative_price_ranking'])
community_summary_df['estate_charge_mean'] = community_summary_df.groupby(by=['city'])['estate_charge_fixed'].transform(
np.mean)