Train the classifier
The dataframe df_trainset
you created in the previous exercise is available. You're now going to use it to train a Logistic Regression Classifier.
Este ejercicio forma parte del curso
Introduction to Spark SQL in Python
Instrucciones del ejercicio
- Import the Logistic Regression Classifier.
- Instantiate the classifier. Set maximum iterations to 100, the regularization parameter to 0.4, and the elastic net parameter to 0.0.
- Train the classifier on the trainset.
- Print the number of training iterations.
Ejercicio interactivo práctico
Prueba este ejercicio completando el código de muestra.
# Import the logistic regression classifier
from ____ import ____
# Instantiate logistic setting elasticnet to 0.0
logistic = ____(maxIter=100, regParam=0.4, ____=0.0)
# Train the logistic classifer on the trainset
df_fitted = ____.____(____)
# Print the number of training iterations
print("Training iterations: ", df_fitted.____.____)