logreg logisticregression(represent each target by its class name in the iris dataset named_target iris target_names[y_trainlogreg fit(x_trainnamed_targetprint("unique classes in training data{}format(logreg classes_)print("predictions{}format(logreg predict(x_test)[: ])argmax_dec_func np argmax(logreg decision_function(x_test)axis= print("argmax of decision function{}format(argmax_dec_func[: ])print("argmax combined with classes_{}formatlogreg classes_[argmax_dec_func][: ])out[ ]unique classes in training data['setosa'versicolor'virginica'predictions['versicolor'setosa'virginica'versicolor'versicolor'setosa'versicolor'virginica'versicolor'versicolor'argmax of decision function[ argmax combined with classes_['versicolor'setosa'virginica'versicolor'versicolor'setosa'versicolor'virginica'versicolor'versicolor'summary and outlook we started this with discussion of model complexitythen discussed generalizationor learning model that is able to perform well on newpreviously unseen data this led us to the concepts of underfittingwhich describes model that cannot capture the variations present in the training dataand overfittingwhich describes model that focuses too much on the training data and is not able to generalize to new data very well we then discussed wide array of machine learning models for classification and regressionwhat their advantages and disadvantages areand how to control model complexity for each of them we saw that for many of the algorithmssetting the right parameters is important for good performance some of the algorithms are also sensitive to how we represent the input dataand in particular to how the features are scaled thereforeblindly applying an algorithm to dataset without understanding the assumptions the model makes and the meanings of the parameter settings will rarely lead to an accurate model this contains lot of information about the algorithmsand it is not necessary for you to remember all of these details for the following howeversome knowledge of the models described here--and which to use in specific situation--is important for successfully applying machine learning in practice here is quick summary of when to use each modelsummary and outlook