  In this work, we perform observational data analysis on Einsteinian cubic
gravity and $f(P)$ gravity to constrain the parameter space of the theories. We
use the 30-point $z-H(z)$ cosmic chronometer data as the observational tool for
our analysis along with the BAO and the CMB peak parameters. The $\chi^2$
statistic is used for the fitting analysis and it is minimized to obtain the
best fit values for the free model parameters. We have used the Markov chain
Monte Carlo algorithm to obtain bounds for the free parameters. To achieve this
we used the publicly available CosmoMC code to put parameter bounds and
subsequently generate contour plots for them with different confidence
intervals. Besides finding the Hubble parameter $H$ in terms of the redshift
$z$ theoretically from our gravity models, we have exercised correlation
coefficients and two machine learning models, namely the linear regression (LR)
and artificial neural network (ANN), for the estimation of $H(z)$. For this
purpose, we have developed a Python package for finding the parameter space and
performing the subsequent statistical analysis and prediction analysis using
machine learning. We compared both our theoretical and estimated values of
$H(z)$ with the observations. It is seen that our theoretical and estimated
models from machine learning performed significantly well when compared with
the observations.
