Detecting water contaminants using an electrochemical sensor based on improved Transformer Encoder with Genetic Algorithm