我正在尝试使用 Statsmodel 运行 tweedie 模型并不断收到以下错误:
AttributeError:“Tweedie”对象没有属性“ndim”
formula = 'pure_premium ~ atfault_model + channel_model_DIR + channel_model_IA + CLded_model + credit_model_52778 + \
credit_model_c6 + package_model_Elite + package_model_LBO + package_model_Plus + package_model_Savers + \
package_model_Savers_Plus + Q("ds_fp_paid_in_full_eligiable-has discount") + ds_fp_paid_in_full_ineligable + \
Q("ds_pn_prior_insurance_eligable-has discount") + ds_pn_prior_insurance_ineligable + \
Q("ds_ip_advanced_purchase_eligiable-has discount") + ds_ip_advanced_purchase_ineligable + \
credit_model_c5 + ds_ad_affinity + ds_ak_alliance + \
ds_ly_loyalty_discount + ds_mo_multipolicy + ds_pf_performance + majorvio_model + \
(driver_age_model*marital_status_model) + minorvio_model + multi_unit_model + \
RATING_CLASS_CODE_MODEL + unit_drv_exp_model + Vintiles + safety_course_model + instructor_course_model + \
(class_model*v_age_model) + (class_model*cc_model) + state_model'
lost_cost_model = smf.ols(formula = formula, data = coll_df
, family = sm.families.Tweedie(link = sm.families.links.log, var_power = 1.5))
每个变量要么是分类变量,要么是浮点数,要么是整数。
我不确定是什么原因造成的。
扬帆大鱼
相关分类