Tekstclassificatie

Introductie tot Spark SQL in Python

Mark Plutowski

Data Scientist

Eindwoordvoorspelling

Introductie tot Spark SQL in Python

Pijl volgorde

Introductie tot Spark SQL in Python

Eindwoord

Introductie tot Spark SQL in Python

Haakje eindwoord

Introductie tot Spark SQL in Python

Shuffle 1

Introductie tot Spark SQL in Python

Shuffle 2

Introductie tot Spark SQL in Python

Liedjes

Introductie tot Spark SQL in Python

Video's

Introductie tot Spark SQL in Python

Data selecteren

df_true = df.where("endword in ('she', 'he', 'hers', 'his', 'her', 'him')")\
            .withColumn('label', lit(1))

df_false = df.where("endword not in ('she', 'he', 'hers', 'his', 'her', 'him')")\
           .withColumn('label', lit(0))
Introductie tot Spark SQL in Python

Positieve en negatieve data combineren

df_examples = df_true.union(df_false)
Introductie tot Spark SQL in Python

Data splitsen in train- en eval-sets

df_train, df_eval = df_examples.randomSplit((0.60, 0.40), 42)
Introductie tot Spark SQL in Python

Trainen

from pyspark.ml.classification import LogisticRegression

logistic = LogisticRegression(maxIter=50, regParam=0.6, elasticNetParam=0.3)
model = logistic.fit(df_train)
print("Training iterations: ", model.summary.totalIterations)
Introductie tot Spark SQL in Python

Laten we oefenen!

Introductie tot Spark SQL in Python

Preparing Video For Download...