Structural, electronic, and electrochemical studies of WS2 phases using density functional theory and machine learning