Commit 3c2d3779 authored by 宋柯's avatar 宋柯

模型调试

parent eff7b4c2
...@@ -140,9 +140,9 @@ def getItemStaticFeatures(itemStatisticDays, startDay, endDay): ...@@ -140,9 +140,9 @@ def getItemStaticFeatures(itemStatisticDays, startDay, endDay):
drop_columns = ['label', 'label_count'] drop_columns = ['label', 'label_count']
clickStaticFeatures = clickStaticFeatures.drop(*drop_columns) clickStaticFeatures = clickStaticFeatures.drop(*drop_columns)
clickStaticFeatures.show(20, truncate = False) # clickStaticFeatures.show(20, truncate = False)
expStaticFeatures = expStaticFeatures.drop(*drop_columns) expStaticFeatures = expStaticFeatures.drop(*drop_columns)
expStaticFeatures.show(20, truncate = False) # expStaticFeatures.show(20, truncate = False)
return clickStaticFeatures, expStaticFeatures return clickStaticFeatures, expStaticFeatures
...@@ -838,7 +838,7 @@ def get_item_es_feature_df(): ...@@ -838,7 +838,7 @@ def get_item_es_feature_df():
_source = res['_source'] _source = res['_source']
data = parseSource(_source) data = parseSource(_source)
datas.append(data) datas.append(data)
print("card size:",len(datas)) print("card size: ",len(datas))
itemColumns = ['card_id', ITEM_PREFIX + NUMERIC_PREFIX + 'discount', itemColumns = ['card_id', ITEM_PREFIX + NUMERIC_PREFIX + 'discount',
ITEM_PREFIX + NUMERIC_PREFIX + 'case_count', ITEM_PREFIX + NUMERIC_PREFIX + 'sales_count', ITEM_PREFIX + NUMERIC_PREFIX + 'case_count', ITEM_PREFIX + NUMERIC_PREFIX + 'sales_count',
...@@ -855,7 +855,7 @@ def get_item_es_feature_df(): ...@@ -855,7 +855,7 @@ def get_item_es_feature_df():
itemEsFeatureDF = spark.createDataFrame(itemEsFeatureDF) itemEsFeatureDF = spark.createDataFrame(itemEsFeatureDF)
itemEsFeatureDF.printSchema() itemEsFeatureDF.printSchema()
itemEsFeatureDF.show(10, truncate=False) # itemEsFeatureDF.show(10, truncate=False)
return itemEsFeatureDF return itemEsFeatureDF
...@@ -953,6 +953,7 @@ if __name__ == '__main__': ...@@ -953,6 +953,7 @@ if __name__ == '__main__':
.join(clickStaticFeatures, on = ["card_id", "partition_date"], how = 'left')\ .join(clickStaticFeatures, on = ["card_id", "partition_date"], how = 'left')\
.join(expStaticFeatures, on = ["card_id", "partition_date"], how = 'left')\ .join(expStaticFeatures, on = ["card_id", "partition_date"], how = 'left')\
.join(itemEsFeatureDF, on = ["card_id"], how = 'left') .join(itemEsFeatureDF, on = ["card_id"], how = 'left')
samples = samples.withColumnRenamed("card_id", ITEM_PREFIX + CATEGORY_PREFIX + "card_id")\ samples = samples.withColumnRenamed("card_id", ITEM_PREFIX + CATEGORY_PREFIX + "card_id")\
.withColumnRenamed("device_id", USER_PREFIX + CATEGORY_PREFIX + "device_id") \ .withColumnRenamed("device_id", USER_PREFIX + CATEGORY_PREFIX + "device_id") \
.withColumnRenamed("os", USER_PREFIX + CATEGORY_PREFIX + "os") \ .withColumnRenamed("os", USER_PREFIX + CATEGORY_PREFIX + "os") \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment