Diffusion MRI is powerful but limited by long scan times. When optimizing diffusion MRI, most previous methods have either optimized the encoding scheme (i.e., q-space samples) or have optimized the parameter estimation method. In this work, we propose and evaluate a novel approach that jointly optimizes both the encoding scheme and the estimation scheme. This is enabled by combining linear estimation theory with machine learning techniques. Our results show the strong potential of our new approach. Perhaps surprisingly and in contrast to conventional wisdom, we observe that a two-shell sampling scheme appears to be preferred for orientation estimation.