Bandgap analysis of transition-metal dichalcogenide and oxide via machine learning approach