Abstract In recent years, the prediction of individual behaviour from the fMRI-based functional connectome has become a major focus of research. The motivation behind this research is to find generalizable neuromarkers of cognitive functions. However, insufficient prediction accuracies and long scan time requirements are still unsolved issues. Here we propose a new machine learning algorithm for predicting intelligence scores of healthy human subjects from resting state (rsfMRI) or task-based fMRI (tfMRI). In a cohort of 390 unrelated test subjects of the Human Connectome Project, we found correlations between the observed and the predicted general intelligence of more than 50 percent in tfMRI, and of around 59 percent when results from two tasks are combined. Surprisingly, we found that the tfMRI data were significantly more predictive of intelligence than rsfMRI even though they were acquired at much shorter scan times (approximately 10 minutes versus 1 hour). Existing methods that we investigated in a benchmark comparison underperformed on tfMRI data and produced prediction accuracies well below our results. Our proposed algorithm differs from existing methods in that it achieves dimensionality reduction via ensemble learning and partial least squares regression rather than via brain parcellations or ICA decompositions. In addition, it introduces Ricci-Forman curvature as a novel type of edge weight.