'OLSResults' object has no attribute 'score'
时间: 2023-10-16 21:06:48 浏览: 7
This error message suggests that you are trying to access the 'score' attribute of an object of the class 'OLSResults', but this attribute is not defined in this class.
OLSResults is a class in the statsmodels library that represents the results of an ordinary least squares (OLS) regression analysis. It contains various attributes that store information about the regression model, such as the coefficients, standard errors, and t-values.
If you are trying to obtain a score or some other evaluation metric for your OLS model, you may need to use a different attribute or method of the OLSResults object. Some common methods for evaluating regression models include computing the R-squared value, the mean squared error (MSE), or the mean absolute error (MAE).
To resolve this error, you can check the documentation for the OLSResults class to see what attributes and methods are available, and choose the appropriate one for your analysis.