• Acanthocereus tetragonus aqueous extract was evaluated in acidic and neutral media as a corrosion inhibitor. • Forward ANNs were trained with two Aluminum electrochemical evaluations databases. • Larger databases were calculated from Forward ANNs. • Inverse ANNs (IANNs) were trained with the large databases. • Time and concentration of the Acanthocereus tetragonus extract were found from optimal IANNs. An innovative numerical method based on a machine learning approach is presented in order to model the electrochemical behaviour of an Acanthocereus tetragonus aqueous extract on Aluminum in acidic and neutral media. Experimental data of an electrochemical evaluation of Aluminum in HCl (1 M) and NaCl (0.6 M) were used to generate the training set for forward Artificial Neural Networks (ANN). Later, this nonlinear relationship is inverted and refined with the purpose of design and train an inverse ANN that solves the following inverse problem: to find the concentration of a green corrosion inhibitor and the exposure time as a function of pH values, real and imaginary impedance values, and a frequency range of measure between 10,000 and 0.01 Hz.