Learning Interaction Variables and Kernels from Observations of Agent-Based Systems