model.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:rsmtool 作者: EducationalTestingService 项目源码 文件源码
def model_fit_to_dataframe(fit):
    """
    Take an object containing a statsmodels OLS model fit and extact
    the main model fit metrics into a data frame.

    Parameters
    ----------
    fit : a statsmodels fit object
        Model fit object obtained from a linear model trained using
        `statsmodels.OLS`.

    Returns
    -------
    df_fit : pandas DataFrame
        Data frame with the main model fit metrics.
    """

    df_fit = pd.DataFrame({"N responses": [int(fit.nobs)]})
    df_fit['N features'] = int(fit.df_model)
    df_fit['R2'] = fit.rsquared
    df_fit['R2_adjusted'] = fit.rsquared_adj
    return df_fit
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号