|
@@ -169,12 +169,12 @@ class DataProcess():
|
|
|
temp_data = pd.merge(scored_data, product_medians, on="product_code", how="left")
|
|
temp_data = pd.merge(scored_data, product_medians, on="product_code", how="left")
|
|
|
|
|
|
|
|
# 生成标签 (1: 大于等于中位数, 0: 小于中位数)
|
|
# 生成标签 (1: 大于等于中位数, 0: 小于中位数)
|
|
|
- scored_data["label"] = np.where(
|
|
|
|
|
- scored_data["score"] >= temp_data["median_score"], 1, 0
|
|
|
|
|
|
|
+ temp_data["label"] = np.where(
|
|
|
|
|
+ temp_data["score"] >= temp_data["median_score"], 1, 0
|
|
|
)
|
|
)
|
|
|
- scored_data = scored_data.sort_values("score", ascending=False)
|
|
|
|
|
-
|
|
|
|
|
- scored_data = shuffle(scored_data, random_state=42)
|
|
|
|
|
|
|
+ temp_data = temp_data.sort_values("score", ascending=False)
|
|
|
|
|
+ temp_data.drop(columns=["median_score", "score"], inplace=True)
|
|
|
|
|
+ scored_data = shuffle(temp_data, random_state=42)
|
|
|
return scored_data
|
|
return scored_data
|
|
|
|
|
|
|
|
# def _descartes(self):
|
|
# def _descartes(self):
|