Cosmological parameter inference using gravitational waves and machine learning