Flash Sale: Flat 70% + Addl. 25% Off on all Courses | Use Coupon DS25 in Checkout | Offer Expires In

  Enroll Now

End to End ML Project - Fashion MNIST - Selecting the Model - Cross-Validation - Softmax Regression

We will be performing k-fold cross-validation with 3 folds (cv=3) on the Softmax Regression model, and calculating the mean accuracy, precision, recall and F1 score values for the same.

INSTRUCTIONS

Please follow the below steps:

Please create an instance of LogisticRegression called log_clf by passing to it the parameters - multi_class="multinomial", solver="lbfgs", C=10 and random_state=42

log_clf = LogisticRegression(<<your code comes here>>)

Please call cross_val_score() function by passing following parameters to it - the model (log_clf), the scaled training dataset (X_train_scaled), y_train, cv=3 and scoring="accuracy" - and save the returned value in a variable called log_cv_scores.

Call display_scores() function, by passing to it the log_cv_scores variable, to calculate and display(print) the 'accuracy' score, the mean of the 'accuracy' score and the 'standard deviation' of the 'accuracy' score.

log_cv_scores = cross_val_score(<<your code comes here>>) 
display_scores(log_cv_scores)

Call mean() method on log_cv_scores object to get the mean accuracy score and store this mean accuracy score in a variable log_cv_accuracy.

log_cv_accuracy = log_cv_scores.<<your code comes here>>

Please call cross_val_predict() function by passing following parameters to it - the model (log_clf), the scaled training dataset (X_train_scaled), y_train, cv=3 - and save the returned value in a variable called y_train_pred.

y_train_pred = cross_val_predict(<<your code comes here>>)

Compute the confusion matrix by using confusion_matrix() function

confusion_matrix(y_train, <<your code comes here>>)

Calculate the precision score by the using the precision_score() function

log_cv_precision = precision_score(y_train, <<your code comes here>>, average='weighted')

Calculate the recall score by the using the recall_score() function

log_cv_recall = recall_score(y_train, <<your code comes here>>, average='weighted')

Calculate the F1 score by the using the f1_score() function

log_cv_f1_score = f1_score(y_train, <<your code comes here>>, average='weighted')

Print the above calculated values of log_cv_accuracy, log_cv_precision, log_cv_recall , log_cv_f1_score


No hints are availble for this assesment

Answer is not availble for this assesment


Note - Having trouble with the assessment engine? Follow the steps listed here

Loading comments...