Vorhersagen und bewerten

Einführung in Spark SQL mit Python

Mark Plutowski

Data Scientist

Modell auf Evaluationsdaten anwenden

predicted = df_trained.transform(df_test)
  • Spalte prediction: double
  • Spalte probability: Vektor der Länge zwei
x = predicted.first
print("Right!" if x.label == int(x.prediction) else "Wrong")
Einführung in Spark SQL mit Python

Klassifikationsgüte bewerten

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

Beispiel: Text klassifizieren

  • Positive Labels:

    • ['her', 'him', 'he', 'she', 'them', 'us', 'they', 'himself', 'herself', 'we']
  • Anzahl Beispiele: 5746

  • Anzahl Beispiele: 2873 positiv, 2873 negativ
  • Anzahl Trainingsbeispiele: 4607
  • Anzahl Testbeispiele: 1139
  • Trainingsiterationen: 21
  • Test-AUC: 0.87
Einführung in Spark SQL mit Python

Das Endwort vorhersagen

  • Positives Label: 'it'

  • Anzahl Beispiele: 438

  • Anzahl Beispiele: 219 positiv, 219 negativ
  • Anzahl Trainingsbeispiele: 340
  • Anzahl Testbeispiele: 98
  • Test-AUC: 0.85
Einführung in Spark SQL mit Python

Lass uns üben!

Einführung in Spark SQL mit Python

Preparing Video For Download...