In this work, we reconstruct cosmic history via supervised learning through three methods: classification and regression trees (CART), multilayer perceptron regression (MLPR), and support vector regression (SVR). For this purpose, we use ages of simulated galaxies based on 32 massive, early-time, passively evolving galaxies in the range 0.12<z<1.85\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$0.12< z < 1.85$$\end{document}, with absolute ages determined. Using this sample, we simulate subsamples of 100, 1000, 2000, 3334 and 6680 points, through the Monte Carlo method and adopting a Gaussian distribution centering on a spatially flat Λ\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\Lambda $$\end{document}CDM as a fiducial model. We found that the SVR method demonstrates the best performance during the process. The MLPR and CART methods also present satisfactory performance, but their mean square errors are greater than those found for the SVR. Using the reconstructed ages, we estimated the matter density parameter and equation of state (EoS), and our analysis found that the SVR with 600 predicted points obtained Ωm=0.329±0.010\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\Omega _m=0.329\pm {}{0.010}$$\end{document} and dark energy EoS parameter ω=-1.054-0.126+0.087\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\omega = -1.054^{+0.087}_{-0.126}$$\end{document}, which are consistent with the values from the literature. We note that we found the most consistent results for the subsample with 2000 points, which returns 600 predicted points and has the best performance, considering its small sample size and high accuracy. We present the reconstructed curves of galaxy ages and the best fits for cosmological parameters.