# Car Price Guesser

## Purpose
This project is a learning exercise for building machine learning models. The goal is to predict the price of a car based on its attributes (e.g., Year, Mileage, Brand, Model, etc.) using a dataset of New York cars.

## Getting Started

This project uses `uv` for dependency management.

### Prerequisites
- Python 3.14+
- `uv` installed

### Installation
1. Clone the repository (if applicable).
2. Install dependencies:
   ```bash
   uv sync
   ```

## Usage

### 1. Train the Model
To train the machine learning model (Linear Regression baseline):
```bash
uv run train_model.py
```
This script will:
- Load the `New_York_cars.csv` dataset.
- Preprocess the data (handle missing values, encode categorical features).
- Train the model.
- Save the trained model to `car_price_model.joblib`.
- Output performance metrics (MSE, R2 Score).

### 2. Make Predictions
You can use the trained model to guess the price of a car.

**Interactive Mode:**
```bash
uv run predict.py
```
Follow the prompts to enter car details.

**Command Line Arguments:**
```bash
uv run predict.py <Year> <Mileage> <Brand>
```
Example:
```bash
uv run predict.py 2020 50000 Toyota
```

**Random Row Verification:**
To pick a random car from the dataset and compare the model's prediction against the actual price:
```bash
uv run predict.py --random
```
