Name: Towards AI Legal Name: Towards AI, Inc. Description: Towards AI is the world's leading artificial intelligence (AI) and technology publication. Read by thought-leaders and decision-makers around the world. Phone Number: +1-650-246-9381 Email: pub@towardsai.net
228 Park Avenue South New York, NY 10003 United States
Website: Publisher: https://towardsai.net/#publisher Diversity Policy: https://towardsai.net/about Ethics Policy: https://towardsai.net/about Masthead: https://towardsai.net/about
Name: Towards AI Legal Name: Towards AI, Inc. Description: Towards AI is the world's leading artificial intelligence (AI) and technology publication. Founders: Roberto Iriondo, , Job Title: Co-founder and Advisor Works for: Towards AI, Inc. Follow Roberto: X, LinkedIn, GitHub, Google Scholar, Towards AI Profile, Medium, ML@CMU, FreeCodeCamp, Crunchbase, Bloomberg, Roberto Iriondo, Generative AI Lab, Generative AI Lab VeloxTrend Ultrarix Capital Partners Denis Piffaretti, Job Title: Co-founder Works for: Towards AI, Inc. Louie Peters, Job Title: Co-founder Works for: Towards AI, Inc. Louis-François Bouchard, Job Title: Co-founder Works for: Towards AI, Inc. Cover:
Towards AI Cover
Logo:
Towards AI Logo
Areas Served: Worldwide Alternate Name: Towards AI, Inc. Alternate Name: Towards AI Co. Alternate Name: towards ai Alternate Name: towardsai Alternate Name: towards.ai Alternate Name: tai Alternate Name: toward ai Alternate Name: toward.ai Alternate Name: Towards AI, Inc. Alternate Name: towardsai.net Alternate Name: pub.towardsai.net
5 stars – based on 497 reviews

Frequently Used, Contextual References

TODO: Remember to copy unique IDs whenever it needs used. i.e., URL: 304b2e42315e

Resources

Our 15 AI experts built the most comprehensive, practical, 90+ lesson courses to master AI Engineering - we have pathways for any experience at Towards AI Academy. Cohorts still open - use COHORT10 for 10% off.

Publication

Building an Advisory Expert System to Find the Best Apartments in Colombo
Artificial Intelligence   Latest   Machine Learning

Building an Advisory Expert System to Find the Best Apartments in Colombo

Last Updated on November 13, 2025 by Editorial Team

Author(s): Abinaya Subramaniam

Originally published on Towards AI.

In today’s fast paced urban lifestyle, finding the perfect apartment in a bustling city like Colombo can be overwhelming. With countless options differing in location, price, developer, amenities, and overall quality, prospective buyers often face a challenging decision making process. To simplify this, I built an Expert System capable of recommending the best apartments based on user preferences.

This blog goes into the creation of our Intelligent Apartment Advisor System, explaining its underlying concepts, architecture, and unique features.

Building an Advisory Expert System to Find the Best Apartments in Colombo
Image by Author

What is an Expert System?

An Expert System (ES) is a computer program that simulates the decision-making and problem solving ability of a human expert. Instead of hardcoding rules for every possible scenario, an ES uses a knowledge base and an inference engine to reason about data and provide intelligent recommendations.

Key characteristics of expert systems include:

  • Knowledge Base: Stores facts and rules about a specific domain.
  • Inference Engine: Applies logical reasoning to match user queries with the knowledge base.
  • Explanation Facility: Provides reasoning behind the recommendations to help users understand the decision.
  • User Interface: Allows users to input preferences and receive personalized advice.
Expert Systems — Image by Author

In our project, the ES is designed to help users find apartments in Colombo by analyzing multiple criteria like location, price, developer, type, bedrooms, amenities, and more.

System Architecture

The Colombo Apartment Advisor System consists of some main modules:

  1. Facts and Knowledge Base (facts.py)
  2. Controller for Data Handling and Explanation (controller.py)
  3. Inference Engine (main.py)
  4. User Interface (st.py)

Let’s explore each component.

1. Facts and Knowledge Base

The knowledge base is the heart of the system. It contains detailed information about apartments in Colombo, represented as facts. Each apartment fact includes:

  • Title and developer
  • Location
  • Price and price range
  • Apartment type (Luxury, Standard, Penthouse, etc.)
  • Number of bedrooms and bathrooms
  • Area in square feet
  • Amenities (swimming pool, gym, parking, garden, etc.)
  • Ratings and completion year
  • Floor number

A snippet of the fact definition looks like this:

class ApartmentFact(Fact):
title = str
location = str
developer = str
price = float
price_range = str
apartment_type = str
bedrooms = int
bathrooms = int
area_sqft = float
amenities = set
rating = float
completion_year = int
floor_number = int

In total, the system currently holds 30 apartments spanning different price ranges, locations, and types. This structured knowledge allows the system to reason and find matches for diverse user preferences.

2. Controller: Converting Facts to Recommendations

The controller module acts as the bridge between the knowledge base and the inference engine. It performs several tasks:

  • Converts facts into user-friendly data structures.
  • Formats prices in readable formats (e.g., Lakhs, Crores).
  • Generates explanations for why a particular apartment was recommended.
  • Calculates confidence score for recommendations.
Interface — Image by Author

For example, if a user prefers a Colombo 6 apartment with a gym and swimming pool, the system explains:

Interface — Image by Author

This explanation facility is crucial as it mirrors human expert reasoning and builds user trust in AI recommendations.

3. Inference Engine: Reasoning and Recommendations

The inference engine is built using the Experta library, a Python library designed for rule-based expert systems. It applies a forward-chaining approach:

  1. Exact Match Rule:
    This rule checks if there are apartments that exactly match all user preferences such as location, developer, price range, number of bedrooms, and floor number.
    If found, the system presents these as perfect matches with detailed explanations.
  2. Alternative Suggestions Rule:
    If no perfect matches exist or the user input is incomplete, this rule calculates a relevance score for each apartment. The score is based on how many user preferences are satisfied, including amenities, rating, price, and floor number.
    The system then ranks apartments by score and recommends the top alternatives.
  3. Popularity Fallback:
    When user preferences are vague or too broad, the system provides popular apartments based on high ratings. This ensures that users always receive meaningful recommendations.

The use of salience in rules ensures that exact matches are prioritized over alternative suggestions, mimicking how a human expert would reason.

Features of the Apartment Advisor Expert System

Our system incorporates several advanced features to enhance user experience:

  1. Multi-Criteria Decision Making:
    Users can specify multiple attributes like location, developer, price range, amenities, and floor preferences.
Interface — Image by Author
  1. Operates on Narrow Domain:
    This allows a person new to this field, be able to use our system without reliability concerns.
  2. Intelligent Explanations:
    Every recommendation includes a clear reasoning, helping users understand why a particular apartment fits their requirements.
  3. Handle Incomplete Information:
    The system intelligently handles vague inputs like “no preference” or “any,” providing meaningful recommendations rather than failing.
  4. Give Level of Assurance for solutions:
    You shall get a confidence score for each of the recommendations given.
  5. Give Alternative Solutions:
    Beyond one best choice, you shall get some more recommendations as well.
Features — Image by Author

Sample Workflow

Here’s how the system works in practice:

  1. User Input:
    The user enters preferences such as:
  • Location: Colombo 3
  • Price Range: High
  • Bedrooms: 3
  • Amenities: Gym, Swimming Pool
  1. System Processing:
    The inference engine checks the knowledge base for exact matches. If found, it presents them.
    If not, it calculates alternative matches using the scoring mechanism.
  2. Recommendation and Explanation:
    The user receives a ranked list of apartments with detailed explanations.

Explore at: https://github.com/Abinaya-Subramaniam/colombo-apartment-expert-system

Future Enhancements

While the current system is robust, future improvements could include:

  • Integration with real-time property listings: Keep the knowledge base updated with current availability.
  • Machine Learning Hybrid: Incorporate predictive models to suggest apartments based on trends and user behavior.
  • Natural Language Input: Allow users to describe preferences in plain English rather than structured inputs.
  • Mobile App Interface: Make the expert system accessible as an interactive app for users on the go.
Comparision — Image by Author

The Colombo Apartment Advisor demonstrates how expert systems can simplify complex decision-making in real estate. By combining a rich knowledge base, a powerful inference engine, and clear explanations, it provides a user-centric, intelligent solution to apartment hunting.

Join thousands of data leaders on the AI newsletter. Join over 80,000 subscribers and keep up to date with the latest developments in AI. From research to projects and ideas. If you are building an AI startup, an AI-related product, or a service, we invite you to consider becoming a sponsor.

Published via Towards AI


Take our 90+ lesson From Beginner to Advanced LLM Developer Certification: From choosing a project to deploying a working product this is the most comprehensive and practical LLM course out there!

Towards AI has published Building LLMs for Production—our 470+ page guide to mastering LLMs with practical projects and expert insights!


Discover Your Dream AI Career at Towards AI Jobs

Towards AI has built a jobs board tailored specifically to Machine Learning and Data Science Jobs and Skills. Our software searches for live AI jobs each hour, labels and categorises them and makes them easily searchable. Explore over 40,000 live jobs today with Towards AI Jobs!

Note: Content contains the views of the contributing authors and not Towards AI.