ComeçarComece de graça

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 exercício faz parte do curso

Introduction to Spark SQL in Python

Ver curso

Instruções do exercício

  • 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.

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# 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.____.____)
Editar e executar o código