A method based on the adaptive-network-based fuzzy inference system (ANFIS) is presented for computing the narrow aperture dimension of the pyramidal horn. Eight optimization algorithms, least-squares, hybrid learning, Nelder-Mead, genetic, differential evolution, particle swarm, simulated annealing, and clonal selection, are used to optimally determine the design parameters of the ANFIS. The narrow aperture dimension computed by using the ANFIS is used in the optimum gain pyramidal horn design. The computed gains of the designed pyramidal horns are in a very good agreement with the desired gains. When the performances of ANFIS models are compared with each other, the best result is obtained from the ANFIS model trained by the least-squares algorithm.