in [ ]from sklearn import linear_model logistic linear_model logisticregression(logistic fit(x_trainy_trainlogisticregression( = class_weight=nonedual=falsefit_intercept=trueintercept_scaling= max_iter= multi_class='ovr'n_jobs= penalty=' 'random_state=nonesolver='liblinear'tol= verbose= warm_start=falseyou can see various hyperparameters and parameters of the model depicted in the preceding output let' now test the accuracy of this model on the test dataset in [ ]print('logistic regression mean accuracy%flogistic score(x_testy_test)logistic regression mean accuracy this is all it takes in scikit-learn to fit model like logistic regression in the first stepwe identified the model that we wanted to use which in our case was linear modelcalled logistic regression then we called the fit method of that object with our training data and its output labels the fit method updates the model object with the learned parameters of the model we then used the score method of the object to determine the accuracy of the fitted model on our test set so the model we developed without any intensive tuning is accurate at predicting handwritten digits this concludes our very basic example of fitting classification model on our dataset note that our dataset was in fully processed and cleaned format you need to ensure your data is in the same way before you proceed to fit any models on it when solving any problem lustering in this sectionyou will learn how we can fit clustering model on another dataset in the example which we will pickwe will use labeled dataset to help us see the results of the clustering model and compare it with actual labels point to remember here is thatusually labeled data is not available in the real worldwhich is why we choose to go for unsupervised methods like clustering we will try to cover two different algorithmsone each from partitioning based clustering and hierarchical clustering the data that we will use for our clustering example will be the very popular wisconsin diagnostic breast cancer datasetwhich we covered in detail in in the section "feature selection and dimensionality reductiondo check out those sections to refresh your memory this dataset has attributes or features and corresponding label for each data point (breast massdepicting if it has cancer (malignantlabel value or no cancer (benignlabel value let' load the data using the following code import numpy as np from sklearn datasets import load_breast_cancer load data data load_breast_cancer( data data data target print( shapedata feature_names( ['mean radius'mean texture'mean perimeter'worst fractal dimension'it is evident that we have total of observations and attributes or features for each observation