Logo Lanfrica
  • Home
  • Atlas
  • Insights
  • Docs
  • Sign in

© 2026 Lanfrica. All rights reserved. All copyrights of the resources shown on the Lanfrica website belong to the original copyright holders, unless explicitly stated otherwise.

CyPheer1/morocco-carprice-ai

Domain:

socioeconomic

Record type:

projectsoftware
Creator:
CyP
Host:
Machine Learning car valuation platform for Morocco. Web scraping + XGBoost model achieving 96.17% R² score on 99K+ vehicles from Avito.ma. Built with Python, Streamlit & scikit-learn. # CarPrice AI - Moroccan Car Price Prediction 🚗 > An intelligent machine learning system for predicting used car prices in the Moroccan market using XGBoost algorithm. **Author:** Mohamed El Ouardi **Institution:** ENSAM Morocco **Year:** 2025 --- ## 📋 Table of Contents - Overview - Features - Demo - Installation - Usage - Project Structure - Model Performance - Dataset - Technologies - Contributing - License - Contact --- ## 🎯 Overview **CarPrice AI** is a comprehensive machine learning project that predicts the market value of used cars in Morocco. The system scrapes real data from Avito.ma, performs advanced data cleaning, trains multiple ML models, and deploys the best-performing model (XGBoost) through an interactive web application. ### Why This Project? - **Real Market Data:** 99,506+ cars scraped from Morocco's largest marketplace - **High Accuracy:** 96.17% R² score on test set - **Production Ready:** Fast predictions ( **Note:** If `streamlit run` doesn't work, use: > ```bash > python -m streamlit run app.py > ``` The application will open in your browser at `localhost` --- ## 📖 Usage ### 1. Price Prediction (Web App) Launch the Streamlit application and interact with the interface to get price estimates. ### 2. Model Testing Test the XGBoost model performance: ```bash cd Testing python xgb_test.py ``` **Output:** - R² Score: 96.17% - MAE: 8,876 DH - Sample predictions table ### 3. Algorithm Comparison Compare Linear Regression, Random Forest, and XGBoost: ```bash cd Testing python compare_all_models.py ``` **Results:** | Algorithm | R² Score | RMSE (DH) | MAE (DH) | Time | |-----------|----------|-----------|----------|------| | Linear Regression | 39.13% | 113,533 | 52,688 | 0.03s | | Random Forest | 70.64% | 78,858 | 19,686 | 6.81s | | **XGBoost** | **96.17%** | **28,485** | **8,876** | **1.01s** | ### 4. Model Retraining (Optional) Retrain the model from scratch: ```bash cd "3_train model" python train_model …

Visit

github.com

Licenses

MIT