Classification of active compounds is necessary to trivialize their properties and activities and can be carried out by identifying functional groups and their structures based on the simplified molecular input line entry system (SMILES) code. This study classified active compounds based on the SMILES structure using a combination of the machine learning techniques, extreme learning machine (ELM), and particle swarm optimization (PSO). ELM facilitates learning very quickly and at with high predictive accuracy. The PSO covers the limitations of the ELM, i.e., randomly determining the weight and bias, trial, and error in determining the number of hidden neurons. PSO optimizes the weight, bias, and number of hidden neurons. This study’s results indicate that the classification of active compounds’ function based on the SMILES code can be done by the ELM and PSO-ELM with high accuracy. The PSO-ELM can improve the accuracy performance of the ELM classification by optimizing the weight, bias, and number of hidden neurons automatically. Moreover, the proposed PSO-ELM is better than the PSO-ELM for average accuracy, computation time, and standard deviation. The proposed algorithm has the highest average accuracy compared to the ELM by increasing the accuracy to 2.54%, 6.43%, and 3.85% for 2, 3, and 4 classes, respectively. A comparison with other machine algorithms shows that the proposed is superior.