  We present a photometric redshift (photo-$z$) estimation technique for
galaxies in the P\lowercase{an}-STARRS1 (PS1) $3\pi $ survey. Specifically, we
train and test a regression and a classification Random-Forest (RF) models
using photometric features (magnitudes, colors and moments of the radiation
intensity) from the optical PS1 data release 2 (PS1-DR2) and from the
AllWISE/unWISE infrared source catalogs. The classification RF model
($RF_{clas}$) has better performance in the local universe ($z\lesssim 0.1$),
while the second one ($RF_{reg}$) is on average better for $0.1 \lesssim
z\lesssim1$. We adopt as labels the spectroscopic redshift of the galaxies from
the Sloan Digital Sky Survey (SDSS) data release 16 (SDSS-DR16). We find that
the combination of AllWISE/unWISE and PS1-DR2 features leads to an average bias
of $\overline{\Delta z_{norm}}=1\times 10^{-3}$, a standard deviation
$\sigma(\Delta z_{norm})=0.0225$, (where $\Delta z_{norm} \equiv
(z_{phot}-z_{spec})/(1+z_{spec})$), and an outlier rate of $P_0=1.48 \%$ in the
test set for the $RF_{clas}$ model. In the low-redshift Universe ($z<0.1$) that
is of primary interest to many astronomical transient studies, our model
produces an error estimate on the inferred magnitude of an object of $\le$1 mag
in 87\% of the test sample.

Astrophysics of Galaxies;High Energy Astrophysical Phenomena