The lecture demonstrates the use of Logistic Regression through the sklearn
Python library. Important steps involve importing sklearn.linear_model.LogisticRegression
.
The fit
function is employed to train the model on feature vectors and their respective labels. This is where weight optimization occurs.
The coef_
property of the trained model object yields the learned weights per feature.
The predict_proba
function is called to use the model with new data (feature vectors) and obtain the probabilities of various labels.
A Python idea, list comprehension, is described and employed as a handy method to construct the list of test feature vectors.
To convert the predicted probabilities from predict_proba
to discrete labels, a threshold is applied. By default, the threshold is usually 0.5.