Skip to content

ShubhamSinghgit/RoomAI-Algorithm

Repository files navigation

Roommate Matching System

An AI-based roommate suggestion system that uses machine learning to find compatible roommates based on various factors like lifestyle preferences, habits, and personality traits.

Features

  • Matches users based on multiple compatibility factors:
    • Cleanliness level
    • Noise tolerance
    • Sleep schedule
    • Smoking preferences
    • Pet preferences
    • Rent budget
    • Personality type
    • Hobbies and interests
  • Uses cosine similarity for initial matching
  • Applies weighted compatibility scoring for fine-tuning matches
  • Visualizes compatibility results

Installation

  1. Clone this repository
  2. Install the required packages:
pip install -r requirements.txt

Usage

Running the Demo

To see the system in action with sample data:

python roommate_matcher_demo.py

This will:

  1. Generate 100 sample user profiles
  2. Train the roommate matching model
  3. Find compatible roommates for a test user
  4. Display the top 5 matches with detailed compatibility information
  5. Generate a visualization of the top 10 matches

Using the Model in Your Own Application

from roommate_model import RoommateMatchingModel
import pandas as pd

# Load your user data
users_data = pd.read_csv('your_users_data.csv')

# Train the model
model = RoommateMatchingModel()
model.fit(users_data)

# Define a user looking for roommates
user = {
    'age': 25,
    'gender': 'male',
    'cleanliness_level': 4,
    'noise_tolerance': 3,
    'sleep_schedule': 'night_owl',
    'smoking': False,
    'pets': True,
    'rent_budget': 1000,
    'personality_type': 'introvert'
}

# Convert to DataFrame
user_df = pd.DataFrame([user])

# Find matches
matches = model.calculate_compatibility(user_df, users_data)
print(matches.head(10))  # Top 10 matches

Model Details

The roommate matching system uses two main components:

  1. Base Model: Uses scikit-learn's preprocessing pipeline with StandardScaler for numerical features and OneHotEncoder for categorical features, followed by cosine similarity calculation.

  2. Weighted Compatibility: A rule-based system that applies domain-specific logic to weigh different factors based on their importance for roommate compatibility.

Customization

You can customize the model by:

  1. Adjusting the feature weights in the weighted_compatibility function
  2. Adding more features to the user profiles
  3. Implementing different similarity metrics
  4. Customizing the preprocessing pipeline

Data Format

The model expects user data with the following fields:

  • age: numeric
  • gender: categorical (e.g., 'male', 'female', 'non-binary')
  • cleanliness_level: numeric (1-5)
  • noise_tolerance: numeric (1-5)
  • sleep_schedule: categorical ('early_bird', 'night_owl', 'flexible')
  • smoking: boolean
  • pets: boolean
  • rent_budget: numeric
  • personality_type: categorical ('introvert', 'extrovert', 'ambivert')
  • hobbies: list of strings

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published