Programming modern heterogeneous systems is becoming more and more challenging due to their complexity. To simplify software development for such architectures, more advanced compilers are being designed. Such compilers automatically optimize code and hide the complexity of the target heterogeneous architecture from the developer. An example of problems that these compilers need to solve is to decide whether to map (run) a piece of code on CPU or GPU (Graphics Processing Unit). State-of-the-art compilers use accurate optimization heuristics to solve such problems and decide about how to optimize a code automatically. Traditional machine learning and Deep Learning approaches have both been used to build such heuristics. While traditional machine learning is well suited for training on small datasets, it is not well suited for extracting a set of high-quality features, on the other hand, deep learning can automatically extract features, but it needs a large amount of data to get satisfactory results.In this paper, we propose a new machine-learning-based model that allows a compiler to automatically decide whether to map a piece of code to CPU or GPU. Our model uses traditional machine learning and deep learning by exploiting the advantages of each of them. We show that our proposed model, which requires a small amount of data and training time, matches and outperforms state-of-the-art pre-trained deep learning models that require large amounts of data.