In this paper, I propose a new asset allocation framework to cope with the dynamic nature of the financial market. The investment performance can be much improved by protecting the capital from the market crashes, and such crashes can be pre-identified with high probabilities by regime detection analysis via a specialized unsupervised machine learning technique