Study of Electronic and Magnetic Properties of Bilayer Graphene Nanoflakes and Bimetallic Chalcogenides Using First-Principles Density Functional Theory and Machine Learning