Studying Complex Phosphorus Systems with Machine Learning