Technical advances and decreasing costs of photovoltaic (PV) and battery (B) systems are key drivers for the consumer-prosumer transition in many countries. However, the installation of a photovoltaic-battery (PVB) system is not equally profitable for all consumers. This study systematically assesses how heterogeneity in real-world electricity load profiles affects the optimal system configuration and profitability of PVB systems. To that end, we develop a techno-economic simulation model that optimizes the PVB configuration for given electricity load profiles. The analysis uses real-world energy consumption data from 4190 households and is conducted for current electricity rates and weather conditions in Zurich, Switzerland. To account for future price reductions of PV and PVB systems, we conduct a sensitivity analysis that assesses how different cost scenarios influence optimal system configuration and profitability. Finally, we develop and validate a machine learning algorithm that can predict system profitability based only on a limited set of features and on shorter measurement timeframes of smart-meter data. We find that under the current cost scenario (PV: 2000 €/kWp, B: 1000 €/kWh) and without subsidies, about 40% of the analyzed households reach a positive net present value (NPV) for a PV-system, but only for 0.1% of households is the integration of a battery profitable. Under the most optimistic cost scenario for both technologies (PV: 1000 €/kWp, B: 250 €/kWh), 99.9% of the households benefit from the integration of battery storage into their optimal system configuration, with a mean installed PV power of 4.4 kWp and a mean battery size of 9.6 kWh. In all cost scenarios, system profitability varies considerably between households, even for households with comparable total annual demand, primarily due to the heterogeneity in the load profiles. Thus, being able to identify households for whom the installation is profitable is important. The proposed machine learning algorithm predicts optimal configuration, profitability, self-sufficiency, and self-sufficiency ratios with good accuracy, even when only relatively short timeframes of smart-meter data are available. The results of this study are relevant for households making individual investment decisions as well as for utility companies to more effectively identify and approach relevant customers for the installation of PVB systems. Furthermore, the findings enable policymakers to determine the critical levers for increasing private investments into PVB systems in their region and to predict how future developments like component costs will affect the future diffusion of these systems.