Newspaper Classifier

Our news classifier for a course challenge at Politecnico di Torino.

The challenge

Our task was to sort news articles into seven topics. We tried several classifiers and text representations. The final version used TF-IDF and a linear classifier, and placed 3rd out of 200 groups with a public-test macro F1 of 0.741.

Classification Categories

Dataset

~80,000 labeled training articles and 20,000 unlabeled test samples. Each entry includes article text, title, news source, timestamp, and PageRank score.

Key Challenges

Feature Engineering

A ColumnTransformer orchestrated all parallel feature extraction pipelines.

Model Selection

Multiple algorithms were evaluated:

Model Macro F1
Naive Baseline 0.443
Random Forest 0.689
LinearSVC 0.703
SGDClassifier 0.726

SGDClassifier (SVM-style loss) was chosen for its effectiveness with high-dimensional sparse data and computational scalability.

Built with

Language: Python
Libraries: Scikit-learn, Pandas, NumPy
Techniques: TF-IDF Vectorization, SGDClassifier, SVM, GridSearchCV

Results

Source: GitHub