The widespread integration of inverter-based resources (IBRs) in modern power grids raises concerns about low-frequency oscillations, impacting system stability and reliability globally. The impedance model (IM) of IBRs, typically employed for small-signal stability analysis, presents challenges due to nonlinear dynamics and complex control schemes. First, the IM represents the inverter's linearized dynamic model valid only at a specific operating point, limiting its applicability across broad operational conditions. Second, the limited information provided by vendors about control structures and configurations of commercialized IBRs hinders the accurate analytical derivation of the IM. This paper proposes a data-driven approach using support vector machines (SVM) to create a generalized IM for IBRs in the dq reference frame. By leveraging a small training dataset, the algorithm demonstrates high predictive accuracy across various operating conditions while maintaining computational efficiency. The capability of the proposed SVM-based IM prediction approach is demonstrated across various IBR control configurations, including grid-following and grid-forming inverters, eliminating the need for an extensive training dataset. Comparative assessments with feedforward neural network (FNN) modelling approach confirm the superiority of SVM, particularly in the low-frequency range that is crucial for IBR stability analysis. Finally, the application of the predicted IM is demonstrated for stability analysis in the frequency domain and validated using the electromagnetic transient (EMT) model in the time domain through MATLAB/Simulink simulations.