from sklearn model_selection import train_test_split nextwe need to load digit datasetdigits datasets load_digits(nowdefine the feature matrix(xand response vector( )as followsx digits data digits target with the help of next line of codewe can split and into training and testing setsx_trainx_testy_trainy_test train_test_split(xytest_size= random_statenow create an object of logistic regression as followsdigreg linear_model logisticregression(nowwe need to train the model by using the training sets as followsdigreg fit(x_trainy_trainnextmake the predictions on testing set as followsy_pred digreg predict(x_testnext print the accuracy of the model as followsprint("accuracy of logistic regression model is:"metrics accuracy_score(y_testy_pred)* output accuracy of logistic regression model is from the above output we can see the accuracy of our model is around percent