# Hybrid Document Classification for Drone Logistics Research

## Description
This project implements a hybrid algorithm for classifying academic documents related to drone logistics. 
The system combines semantic similarity features from MPNet embeddings with keyword-based features to improve classification accuracy over baseline methods.

## Dataset Information
### Input Files:
1. similarity_results_all_simple.csv - Contains pre-computed similarity scores between documents and core concepts

    - UT: Document identifier

    - Probability_0: Baseline prediction probability from an end-to-end trained MPNet model

    - True_Label: Ground truth classification labels

    - Similarity scores (cosine similarity between text embeddings):

        - summary_core_X: Similarity between article summary and drone-related keywords (X=0,1,2,3)

        - summary_core1_X: Similarity between article summary and logistics-related keywords (X=0,1,2)

        - TI_core_X: Similarity between article title and drone-related keywords (X=0,1,2,3)

        - TI_core1_X: Similarity between article title and logistics-related keywords (X=0,1,2)

2. data.jsonl - JSON Lines file containing document metadata. Each line contains a JSON object with: 
    - UT (document ID)
    - TI (title)
    - AB (abstract)
    - Qwen7B_summary (Qwen7B-generated summary)


### Output Files:
keyword_as_feature_comparison.csv - Complete results with all predictions and probabilities

performance_comparison_keyword_feature.csv - Summary performance metrics for all methods

## Code Information
- Keyword Feature Extraction: 
Extracts domain-specific keyword features from document titles and abstracts

- Feature Engineering
Combines MPNet similarity scores with keyword features using max aggregation

- Classification Methods
Compares five approaches including baseline, Gradient Boosting, and Random Forest

- Evaluation Metrics
Uses cross-validation with standard classification metrics

## Usage Instructions
- Step 1: Prepare Input Files
    - Place similarity_results_all_simple.csv file in the ../embed/ directory

    - Place data.jsonl file in the ../data/ directory


- Step 2: Run the Code
```
python keyword\_feature\_classification.py
```
- Step 3: Analyze Results

The script will:

- Print performance metrics

- Display a comparison table sorted by accuracy

- Save detailed predictions to CSV files



## Requirements
- Python Libraries:
    - pandas>=1.3.0
    - numpy>=1.21.0
    - scikit-learn>=0.24.0

- Installation:
```
pip install pandas numpy scikit-learn
```