Shunt Active Power Filter (SAPF) is widely used for harmonics and reactive power compensation. However, in addition to the harmonics, harmonic resonance also exists in the network, which is prominent in configurations where both SAPF and capacitor bank are present in the distribution network. Resonance is mainly caused due to interaction between line impedances, capacitor banks and modern electronic equipment with capacitive behaviour. Harmonic resonance leads to an increase in harmonic level around the resonance frequency, which further increases the overall THD of the distribution system. As there can be multiple resonance scenarios which may also vary depending on internal switching of capacitor devices, it is difficult for conventional SAPF to address both harmonic resonance and current harmonics. Therefore, to improve the overall power quality, it is important to first identify/detect and then selectively damp the detected harmonic resonance in the distribution network. Detection of resonance with SAPF commonly require external signal injection, additional circuitry and sensors. This paper deals with noninvasive machine learning (ML)-based resonance detection, which only requires voltage harmonics at the point of common coupling (PCC) as input. Hence, it eliminates the need for any modification in existing control strategy, external signal injection and additional sensors. Also, Resonance detection, resonance damping and harmonic compensation is achieved by utilising only two types of sensors i.e., voltage at PCC and load current.