For word-count vector , the fitted logistic model isHolding other counts fixed, one additional occurrence of "dollar" multiplies the fitted spam odds by .
The logistic classifier isThe coefficients maximize the Bernoulli logistic-regression model likelihood over the training emails.
The decision boundary is the hyperplaneAt threshold the classifier predicts spam whenso gives the original classifier. Varying translates the boundary parallel to itself: raising shrinks the region classified as spam and generally trades fewer false positives for more false negatives.
Writing , the log-likelihood isWith 500 observations and 5000 word predictors, the augmented design matrix cannot have full column rank. There are nonzero coefficient directions that leave every unchanged, so any maximizer belongs to an affine family and is not unique. In addition, the high-dimensional features may completely separate the classes, in which case no finite maximizer exists at all.
Principal component analysis centers the word-count vectors, diagonalizes their sample covariance matrix, and projects onto the eigenvectors with the largest eigenvalues. Fitting logistic regression to principal-component scores removes exact collinearity and yields a lower-dimensional design.
Each principal component is an unsupervised linear combination of many words chosen to explain predictor variance; it is not a word selected for association with spam. The dimension can be chosen from a scree plot or cumulative explained variance, but cross-validating the downstream classification loss better targets prediction.
For fixed , differentiating under the constraint givesBecause the columns are orthogonal,The fitted value is therefore , where is the orthogonal projection onto the column space of .
The residual sum of squares is minimized by choosing this column space to be the span of the leading eigenvectors ofThus may be taken to have those orthonormal eigenvectors as columns. Their nonzero scales are immaterial because inverse scaling of the scores leaves unchanged.
Articles by others on the same topic
There are currently no matching articles.