I don't think you need AI. Like in Italy the total of your loans cannot exceed 1/3rd of your monthly salary, as simple as that.
Does this mean most Italians rent their homes for life and a small fraction purchase their homes in cash?
1/3rd of salary is more than enough to buy you a home. That's enough to get a 200k loan for 30 years while making average salary (1700 net euros).