Skip to content

Repository files navigation

Amazon ML Challenge 2025 - Smart Product Pricing

Team: Gemini

Project Overview

This project aims to solve the Smart Product Pricing Challenge by developing a machine learning solution to predict product prices based on their catalog information, including textual descriptions and images. The goal is to create a model that can holistically analyze product details and suggest an optimal price, minimizing the Symmetric Mean Absolute Percentage Error (SMAPE).


File Descriptions

  • student_resource/main.py: The main script to run the entire pipeline, including data processing, model training, and prediction.
  • student_resource/src/data_processor.py: Contains the DataProcessor class, which handles data loading, cleaning, and feature engineering.
  • student_resource/src/model_trainer.py: Contains the XGBModelTrainer and TorchModelTrainer classes for training the XGBoost and PyTorch models.
  • student_resource/src/predictor.py: Contains the Predictor class, which is used to generate the final submission file.
  • student_resource/dataset/: This directory contains the training and test data.
  • student_resource/downloaded_images/: This directory contains the downloaded product images.
  • submission.csv: The final submission file generated by the pipeline.

Dependencies

To run this project, you need to install the following libraries:

numpy
pandas
tqdm
scikit-learn
torch
torchvision
xgboost
Pillow

You can install them using pip:

pip install numpy pandas tqdm scikit-learn torch torchvision xgboost Pillow

How to Run

To run the complete training and prediction pipeline, execute the following command:

python student_resource/main.py

Command-Line Arguments

You can adjust the hyperparameters for the models by passing command-line arguments.

Argument Type Default Description
--hidden_dim int 256 Hidden dimension for the NN model.
--dropout_rate float 0.5 Dropout rate for the NN model.
--lr float 1e-4 Learning rate for the NN model.
--epochs int 30 Number of epochs to train the NN model.
--patience int 5 Early stopping patience.
--xgb_estimators int 1000 Number of estimators for XGBoost.

For example:

python student_resource/main.py --xgb_estimators 1500 --hidden_dim 512 --lr 1e-3

Project Status

This project has implemented a complete pipeline for predicting product prices. The pipeline includes data processing, feature engineering, model training, and evaluation. Two models, an XGBoost model and a PyTorch-based neural network, have been developed and are combined using an ensemble approach.

Methodology

The solution follows a structured machine learning workflow:

  1. Data Processing: The DataProcessor class in src/data_processor.py handles loading the training and test data.

  2. Feature Engineering:

    • Text Features: The catalog_content is cleaned, and TF-IDF features (unigrams and bigrams) are extracted. The Item Pack Quantity (IPQ) is also extracted as a separate feature.
    • Image Features: A pre-trained ResNet-50 model is used to extract features from the product images.
  3. Modeling:

    • XGBoost: An XGBoost model is trained on the combined features.
    • PyTorch NN: A feed-forward neural network is also trained on the same features.
    • Ensemble: The predictions from both models are combined using a weighted average, with the weights optimized on a validation set.
  4. Prediction: The final predictions are generated, and a submission file is created.

Results

The following SMAPE scores were achieved on the validation set. Please note that these are example scores and may vary based on the training data and hyperparameters.

  • XGBoost Model: ~52.58
  • PyTorch NN Model: ~58.75
  • Ensemble Model (Weighted): ~55.60

Future Improvements

  • More Advanced Feature Engineering: Extracting more specific features from the text, such as brand names, product specifications, or sentiment, could provide a strong signal to the models.
  • Fine-tuning Image Models: Instead of using a fixed feature extractor, fine-tuning the ResNet-50 model (or a more modern architecture like EfficientNet) on the product images could yield more domain-specific and powerful image features.
  • Advanced Text Models: Using transformer-based models like BERT to generate text embeddings could capture a much deeper semantic understanding of the product descriptions compared to TF-IDF.
  • Stacking Ensemble: A more advanced ensembling technique like stacking, where a meta-model is trained on the predictions of the base models, could further improve the final prediction accuracy.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages