A Caltech study utilizing machine learning has uncovered significant variations in habit formation duration, finding that it takes an average of six months for individuals to establish a gym habit, whereas healthcare workers can form a hand-washing habit in just a few weeks. Researchers, including Anastasia Buyalskaya and Colin Camerer, analyzed extensive datasets from over 30,000 gym-goers and 3,000 healthcare workers, providing insights into behavior patterns outside traditional lab settings. The study highlights that there is no universal timeframe for habit formation, challenging the prevalent notion that it takes 21 days to form a habit. The findings reveal that past behavior is a strong predictor of future actions, such as the duration since a previous gym visit being crucial for consistency. Machine learning’s ability to track and analyze numerous variables over time allows researchers to identify influential factors without preconceived hypotheses. The research demonstrates the efficacy of machine learning in studying human habits and behaviors, emphasizing its potential in behavioral science. This groundbreaking study was published in the Proceedings of the National Academy of Sciences and funded by several prestigious initiatives at Caltech.