Having the right roommate could be a game changer in a student’s university life by influencing academic achievements, health, and social activities. Roommate assignments are often carried out randomly or sometimes based on arrival time which can often result in suboptimal pairings. To address this, we suggest a machine learning solution that automates roommate assignment based on similarities shared between individuals in on-campus accommodation. The model implements similarity-based roommate matching, using K-Nearest Neighbours algorithm and a hybrid graph model of Louvain and Spectral Cluster-ing, which considers students\' preferences, behaviours and traits to determine compatibility with the K-Nearest Neighbours algorithm performing better and achieving similarity scores of 0.72. The target users for which the outcomes of this study are most useful are universities, their student accommodation departments
Introduction
1. Introduction
Transitioning to college is challenging, especially when moving to a new location. A compatible roommate can enhance social life and mental well-being. However, traditional roommate assignment methods—often random—frequently result in poor matches. This study proposes using machine learning (ML) to create a structured, data-driven roommate matching system based on students’ behavior, lifestyle, and personality traits.
2. Research Gaps
Current roommate-matching systems:
Rely on random or self-selection methods.
Often focus only on personality types or off-campus housing.
Lack machine learning models that consider diverse factors like sleep schedules, social activity, and financial habits.
Suffer from a lack of standard datasets for training.
This study addresses these gaps by:
Creating a synthetic dataset.
Developing two ML-based matching models for on-campus use.
3. Literature Review Highlights
Previous studies (e.g., Gupta et al., Bornare et al., Rahman) used clustering, filtering, and nearest neighbor methods for off-campus roommate pairing.
Zahran et al. (2024) used autoencoders to enhance compatibility predictions.
This study differs by:
Focusing on on-campus housing.
Combining KNN-based similarity matching with graph-based clustering for roommate assignment.
4. Methodology Overview
Data Collection & Preprocessing
Built a synthetic dataset with 24 attributes (expanded to 64 via encoding).
Features included demographics, behavior, and lifestyle preferences.
5. Proposed Models
Model 1: K-Nearest Neighbors (KNN) Incremental Matching
Constructs a similarity graph from student features.
Matches students to their k most similar peers.
Assigns students to rooms in groups (up to 4), updating as new students arrive.
Model 2: Hybrid Louvain-Spectral Clustering
Applies Louvain algorithm for community detection based on similarity graphs.
For larger communities, uses spectral clustering to split into smaller, compatible groups.
Aims to maximize roommate cohesion and modularity of room assignments.
6. Results and Evaluation
Quantitative Results
Metric
KNN-Based Model
Hybrid Louvain-Spectral Model
Matching Accuracy
0.72 (Average similarity score)
Silhouette: 0.0248; DB Index: 1.8446
Room Utilization
72% (rooms at full capacity)
61%
KNN showed higher average similarity and better room utilization.
Louvain-Spectral offered a clustering-based alternative but with lower cohesion in this implementation.
Qualitative Evaluation
Manual inspection confirmed matched students shared similar traits, suggesting real-world usefulness.
As college students, the researchers found the outcomes satisfying and practical.
Conclusion
In this study, we have developed a machine learning driven system for roommate assignment in on-campus housing that uses both traditional similarity-based techniques and advanced graph clustering methods. Our contribution to this field helps solve the prob-lem of roommate compatibility, where students are matched with roommate that they share similarities with.Recall that in the me-thodology section under the working of the hybrid Louvain and spectral algorithm, the process of matching was ran through two algorithms, first Louvain and then Spectral respectively. However, it did not always return assignments of a maximum of four students. In rare cases, assignments went beyond four, the maximum number of students per room decided to be used in this study. For this reason, the KNN algorithm is preferred over the hybrid Louvain and Spectral algorithm.
References
[1] Adeniyi, O.J., Adekola, O.D., Akwaronwu, B.G., Abiodun, A.G., Eweoya, I.O., 2024. Exploring the Link Between Roommate Compatibility and Academic Outcomes: A Systematic Review of Personality-Based Matching Systems. Asian Journal of Computer Science and Technology 13, 29–40. https://doi.org/10.70112/AJCST-2024.13.2.4275
[2] Albuja, A.F., Gaither, S.E., Sanchez, D.T., Nixon, J., 2024. Testing intergroup contact theory through a natural experiment of randomized college roommate as-signments in the United States. J Pers Soc Psychol 127. https://doi.org/10.1037/PSPA0000393
[3] Bornare, A., Dubey, A., Dherange, R., Chiddarwar, S., Deshpande, P., 2023. Troomate—Finding a Perfect Roommate a Literature Survey. Lecture Notes in Networks and Systems 662 LNNS, 3–17. https://doi.org/10.1007/978-981-99-1414-2_1
[4] Cao, Y., Zhou, T., Gao, J., 2024. Heterogeneous peer effects of college roommates on academic performance. Nature Communications 2024 15:1 15, 1–11. https://doi.org/10.1038/s41467-024-49228-7
[5] Gupta, A., Almeida, I., Balaji, H., Tiwari, M., 2022. DORMMATE-A Room-Mate Personality Matching Application. 2022 2nd International Conference on Computer Science, Engineering and Applications, ICCSEA 2022. https://doi.org/10.1109/ICCSEA54677.2022.9936173
[6] McEwan, P.J., Soderberg, K.A., 2006. Roommate effects on grades: Evidence from first-year housing assignments. Res High Educ 47, 347–370. https://doi.org/10.1007/S11162-005-9392-2/METRICS
[7] Peterson, L., 2009. K-nearest neighbor. Scholarpedia 4, 1883. https://doi.org/10.4249/SCHOLARPEDIA.1883
[8] Rahman, S., n.d. Optimal Room and Roommate Matching System Using Nearest Neighbours Algorithm with Cosine Similarity Distribution.
[9] Sharma, A., Kaur, A., n.d. International Conference on Innovative Computing and Communication Hostel’s Room Allocation System: A framework using sin-gle-layer fuzzy logic.
[10] Zahran, K., Amir, A., Elbanhawy, M., Ghanem, I., El-Ghamry, A., Fouad, K.M., Moawad, I.F., 2024. Autoencoder-Enhanced Roommate Recommendation System. NILES 2024 - 6th Novel Intelligent and Leading Emerging Sciences Conference, Proceedings 367–372.
https://doi.org/10.1109/NILES63360.2024.10753185.