Modeling nanoconfinement effects using active learning