Machine Learning Based Thermal Analysis Of On-Chip And Chiplet-Based Systems