การพยากรณ์และประเมินผล

Introduction to Spark SQL in Python

Mark Plutowski

Data Scientist

นำโมเดลไปใช้กับข้อมูลประเมินผล

predicted = df_trained.transform(df_test)
  • คอลัมน์ prediction: double
  • คอลัมน์ probability: vector ความยาวสอง
x = predicted.first
print("Right!" if x.label == int(x.prediction) else "Wrong")
Introduction to Spark SQL in Python

ประเมินความแม่นยำในการจำแนกประเภท

model_stats = model.evaluate(df_eval)
type(model_stats)
pyspark.ml.classification.BinaryLogisticRegressionSummary)
print("\nPerformance: %.2f" % model_stats.areaUnderROC)
Introduction to Spark SQL in Python

ตัวอย่างการจำแนกข้อความ

  • label บวก:

    • ['her', 'him', 'he', 'she', 'them', 'us', 'they', 'himself', 'herself', 'we']
  • จำนวนตัวอย่าง: 5746

  • จำนวนตัวอย่าง: 2873 บวก, 2873 ลบ
  • จำนวนตัวอย่างฝึก: 4607
  • จำนวนตัวอย่างทดสอบ: 1139
  • รอบการฝึก: 21
  • Test AUC: 0.87
Introduction to Spark SQL in Python

พยากรณ์คำท้ายประโยค

  • label บวก: 'it'

  • จำนวนตัวอย่าง: 438

  • จำนวนตัวอย่าง: 219 บวก, 219 ลบ
  • จำนวนตัวอย่างฝึก: 340
  • จำนวนตัวอย่างทดสอบ: 98
  • Test AUC: 0.85
Introduction to Spark SQL in Python

มาฝึกกันเถอะ!

Introduction to Spark SQL in Python

Preparing Video For Download...