  Classification of intermediate redshift ($z$ = 0.3--0.8) emission line
galaxies as star-forming galaxies, composite galaxies, active galactic nuclei
(AGN), or low-ionization nuclear emission regions (LINERs) using optical
spectra alone was impossible because the lines used for standard optical
diagnostic diagrams: [NII], H$\alpha$, and [SII] are redshifted out of the
observed wavelength range. In this work, we address this problem using four
supervised machine learning classification algorithms: $k$-nearest neighbors
(KNN), support vector classifier (SVC), random forest (RF), and a multi-layer
perceptron (MLP) neural network. For input features, we use properties that can
be measured from optical galaxy spectra out to $z < 0.8$---[OIII]/H$\beta$,
[OII]/H$\beta$, [OIII] line width, and stellar velocity dispersion---and four
colors ($u-g$, $g-r$, $r-i$, and $i-z$) corrected to $z=0.1$. The labels for
the low redshift emission line galaxy training set are determined using
standard optical diagnostic diagrams. RF has the best area under curve (AUC)
score for classifying all four galaxy types, meaning highest distinguishing
power. Both the AUC scores and accuracies of the other algorithms are ordered
as MLP$>$SVC$>$KNN. The classification accuracies with all eight features (and
the four spectroscopically-determined features only) are 93.4% (92.3%) for
star-forming galaxies, 69.4% (63.7%) for composite galaxies, 71.8% (67.3%) for
AGNs, and 65.7% (60.8%) for LINERs. The stacked spectrum of galaxies of the
same type as determined by optical diagnostic diagrams at low redshift and RF
at intermediate redshift are broadly consistent. Our publicly available code
(https://github.com/zkdtc/MLC_ELGs) and trained models will be instrumental for
classifying emission line galaxies in upcoming wide-field spectroscopic
surveys.
