Ames House Price Predictor
This repository hosts a PyTorch neural network model trained to predict house prices in Ames, Iowa, using the Ames 'house_prices' dataset.
Model Architecture
The model is a RegularizedModel which is a Multi-Layer Perceptron (MLP) with Dropout layers for regularization. The architecture is as follows:
RegularizedModel(
(layer1): Linear(in_features=289, out_features=256, bias=True)
(relu1): ReLU()
(layer2): Linear(in_features=256, out_features=128, bias=True)
(relu2): ReLU()
(layer3): Linear(in_features=128, out_features=64, bias=True)
(relu3): ReLU()
(layer4): Linear(in_features=64, out_features=1, bias=True)
(dropout1): Dropout(p=0.5, inplace=False)
(dropout2): Dropout(p=0.5, inplace=False)
(dropout3): Dropout(p=0.5, inplace=False)
)
Training Details
- Epochs: 2000
- Loss Function: Mean Squared Error (MSE)
- Optimizer: Adam (learning rate = 0.001)
Evaluation Metrics
The model was evaluated on a test set (20% of the data) after training.
- Mean Squared Error (MSE): 0.0019
- R-squared (R2): 0.8719
Usage (Example)
import torch
from huggingface_hub import hf_hub_download
# Assuming you have the RegularizedModel class defined as above
# input_features and output_features would be derived from your preprocessed data
input_features = 289 # Example value, replace with actual if different
output_features = 1
model = RegularizedModel(input_features, output_features)
# Download the model weights from Hugging Face Hub
model_path = hf_hub_download(repo_id="ShiroOnigami23/ames-house-price-predictor", filename="regularized_model.pth")
model.load_state_dict(torch.load(model_path))
model.eval()
# Example prediction (replace with your actual preprocessed input)
# dummy_input = torch.randn(1, input_features) # Ensure input is scaled like training data
# with torch.no_grad():
# prediction = model(dummy_input)
# print(f"Predicted price (scaled): {prediction.item()}")
# To inverse transform the prediction to original price scale, you'd use your target_scaler
# original_price = target_scaler.inverse_transform(prediction.numpy())
Repository
- Model File:
regularized_model.pth - Repository ID:
ShiroOnigami23/ames-house-price-predictor - Hugging Face Profile: ShiroOnigami23
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
🙋
Ask for provider support