Python 产生一些误差的贝叶斯估计

Python 产生一些误差的贝叶斯估计,python,h2o,Python,H2o,我想了解BayeSestimator是如何工作的。这是我的代码: 将熊猫作为pd导入 进口水 从h2o.estimators导入h2o贝叶斯估计量 df=pd.DataFrame( { “a”:列表(范围(10)), “b”:列表(范围(10)), “c”:清单(范围(10)) } ) 数据=df.values h2o.init() 列车帧=h2o.h2o帧(数据) nbm=BayeSestimator() y=列车框架柱[-1] nbm.列车(y=y,列车帧=列车帧) 这是我得到的错误: h

我想了解BayeSestimator是如何工作的。这是我的代码:

将熊猫作为pd导入
进口水
从h2o.estimators导入h2o贝叶斯估计量
df=pd.DataFrame(
{
“a”:列表(范围(10)),
“b”:列表(范围(10)),
“c”:清单(范围(10))
}
)
数据=df.values
h2o.init()
列车帧=h2o.h2o帧(数据)
nbm=BayeSestimator()
y=列车框架柱[-1]
nbm.列车(y=y,列车帧=列车帧)
这是我得到的错误:

h2o.exceptions.H2OResponseError: ModelBuilderErrorV3  (water.exceptions.H2OModelBuilderIllegalArgumentException):
    timestamp = 1568829213744
    error_url = '/3/ModelBuilders/naivebayes'
    msg = 'Illegal argument(s) for NaiveBayes model: NaiveBayes_model_python_1568829211691_1.  Details: ERRR on field: _response: Response must be a categorical column'
    dev_msg = 'Illegal argument(s) for NaiveBayes model: NaiveBayes_model_python_1568829211691_1.  Details: ERRR on field: _response: Response must be a categorical column'
    http_status = 412
    values = {'messages': [{'_log_level': 5, '_field_name': '_keep_cross_validation_models', '_message': 'Only for cross-validation.'}, {'_log_level': 5, '_field_name': '_keep_cross_validation_predictions', '_message': 'Only for cross-validation.'}, {'_log_level': 5, '_field_name': '_keep_cross_validation_fold_assignment', '_message': 'Only for cross-validation.'}, {'_log_level': 5, '_field_name': '_fold_assignment', '_message': 'Only for cross-validation.'}, {'_log_level': 5, '_field_name': '_tweedie_power', '_message': 'Only for Tweedie Distribution.'}, {'_log_level': 5, '_field_name': '_tweedie_power', '_message': 'Tweedie power is only used for Tweedie distribution.'}, {'_log_level': 5, '_field_name': '_quantile_alpha', '_message': 'Quantile (alpha) is only used for Quantile regression.'}, {'_log_level': 5, '_field_name': '_max_after_balance_size', '_message': 'Balance classes is false, hide max_after_balance_size'}, {'_log_level': 5, '_field_name': '_balance_classes', '_message': 'Balance classes is only applicable to classification problems.'}, {'_log_level': 5, '_field_name': '_class_sampling_factors', '_message': 'Class sampling factors is only applicable to classification problems.'}, {'_log_level': 5, '_field_name': '_max_after_balance_size', '_message': 'Max after balance size is only applicable to classification problems.'}, {'_log_level': 5, '_field_name': '_max_confusion_matrix_size', '_message': 'Max confusion matrix size is only applicable to classification problems.'}, {'_log_level': 5, '_field_name': '_max_hit_ratio_k', '_message': 'Max K-value for hit ratio is only applicable to multi-class classification problems.'}, {'_log_level': 5, '_field_name': '_max_confusion_matrix_size', '_message': 'Only for multi-class classification problems.'}, {'_log_level': 5, '_field_name': '_max_after_balance_size', '_message': 'Only used with balanced classes'}, {'_log_level': 5, '_field_name': '_class_sampling_factors', '_message': 'Class sampling factors is only applicable if balancing classes.'}, {'_log_level': 1, '_field_name': '_response', '_message': 'Response must be a categorical column'}, {'_log_level': 5, '_field_name': '_balance_classes', '_message': 'Balance classes is not applicable to NaiveBayes.'}, {'_log_level': 5, '_field_name': '_class_sampling_factors', '_message': 'Class sampling factors is not applicable to NaiveBayes.'}, {'_log_level': 5, '_field_name': '_max_after_balance_size', '_message': 'Max after balance size is not applicable to NaiveBayes.'}], 'algo': 'NaiveBayes', 'parameters': {'_train': {'name': 'Key_Frame__upload_9cb9251216ede45dd909d3e9af81477a.hex', 'type': 'Key'}, '_valid': None, '_nfolds': 0, '_keep_cross_validation_models': True, '_keep_cross_validation_predictions': False, '_keep_cross_validation_fold_assignment': False, '_parallelize_cross_validation': True, '_auto_rebalance': True, '_seed': -1, '_fold_assignment': 'AUTO', '_categorical_encoding': 'AUTO', '_max_categorical_levels': 10, '_distribution': 'AUTO', '_tweedie_power': 1.5, '_quantile_alpha': 0.5, '_huber_alpha': 0.9, '_ignored_columns': None, '_ignore_const_cols': True, '_weights_column': None, '_offset_column': None, '_fold_column': None, '_check_constant_response': True, '_is_cv_model': False, '_score_each_iteration': False, '_max_runtime_secs': 0.0, '_stopping_rounds': 0, '_stopping_metric': 'AUTO', '_stopping_tolerance': 0.001, '_response_column': 'C3', '_balance_classes': False, '_max_after_balance_size': 5.0, '_class_sampling_factors': None, '_max_confusion_matrix_size': 20, '_checkpoint': None, '_pretrained_autoencoder': None, '_custom_metric_func': None, '_custom_distribution_func': None, '_export_checkpoints_dir': None, '_laplace': 0.0, '_eps_sdev': 0.0, '_min_sdev': 0.001, '_eps_prob': 0.0, '_min_prob': 0.001, '_compute_metrics': True}, 'error_count': 2}
    exception_msg = 'Illegal argument(s) for NaiveBayes model: NaiveBayes_model_python_1568829211691_1.  Details: ERRR on field: _response: Response must be a categorical column'
    stacktrace =
.
.
.
parameters = {'__meta': {'schema_version': 3, 'schema_name': 'NaiveBayesParametersV3', 'schema_type': 'NaiveBayesParameters'}, 'model_id': None, 'training_frame': {'__meta': {'schema_version': 3, 'schema_name': 'FrameKeyV3', 'schema_type': 'Key<Frame>'}, 'name': 'Key_Frame__upload_9cb9251216ede45dd909d3e9af81477a.hex', 'type': 'Key<Frame>', 'URL': '/3/Frames/Key_Frame__upload_9cb9251216ede45dd909d3e9af81477a.hex'}, 'validation_frame': None, 'nfolds': 0, 'keep_cross_validation_models': True, 'keep_cross_validation_predictions': False, 'keep_cross_validation_fold_assignment': False, 'parallelize_cross_validation': True, 'distribution': 'AUTO', 'tweedie_power': 1.5, 'quantile_alpha': 0.5, 'huber_alpha': 0.9, 'response_column': {'__meta': {'schema_version': 3, 'schema_name': 'ColSpecifierV3', 'schema_type': 'VecSpecifier'}, 'column_name': 'C3', 'is_member_of_frames': None}, 'weights_column': None, 'offset_column': None, 'fold_column': None, 'fold_assignment': 'AUTO', 'categorical_encoding': 'AUTO', 'max_categorical_levels': 10, 'ignored_columns': None, 'ignore_const_cols': True, 'score_each_iteration': False, 'checkpoint': None, 'stopping_rounds': 0, 'max_runtime_secs': 0.0, 'stopping_metric': 'AUTO', 'stopping_tolerance': 0.001, 'custom_metric_func': None, 'custom_distribution_func': None, 'export_checkpoints_dir': None, 'balance_classes': False, 'class_sampling_factors': None, 'max_after_balance_size': 5.0, 'max_confusion_matrix_size': 20, 'max_hit_ratio_k': 0, 'laplace': 0.0, 'min_sdev': 0.001, 'eps_sdev': 0.0, 'min_prob': 0.001, 'eps_prob': 0.0, 'compute_metrics': True, 'seed': -1}
    messages = [{'__meta': {'schema_version': 3, 'schema_name': 'ValidationMessageV3', 'schema_type': 'ValidationMessage'}, 'message_type': 'TRACE', 'field_name': 'keep_cross_validation_models', 'message': 'Only for cross-validation.'}, {'__meta': {'schema_version': 3, 'schema_name': 'ValidationMessageV3', 'schema_type': 'ValidationMessage'}, 'message_type': 'TRACE', 'field_name': 'keep_cross_validation_predictions', 'message': 'Only for cross-validation.'}, {'__meta': {'schema_version': 3, 'schema_name': 'ValidationMessageV3', 'schema_type': 'ValidationMessage'}, 'message_type': 'TRACE', 'field_name': 'keep_cross_validation_fold_assignment', 'message': 'Only for cross-validation.'}, {'__meta': {'schema_version': 3, 'schema_name': 'ValidationMessageV3', 'schema_type': 'ValidationMessage'}, 'message_type': 'TRACE', 'field_name': 'fold_assignment', 'message': 'Only for cross-validation.'}, {'__meta': {'schema_version': 3, 'schema_name': 'ValidationMessageV3', 'schema_type': 'ValidationMessage'}, 'message_type': 'TRACE', 'field_name': 'tweedie_power', 'message': 'Only for Tweedie Distribution.'}, {'__meta': {'schema_version': 3, 'schema_name': 'ValidationMessageV3', 'schema_type': 'ValidationMessage'}, 'message_type': 'TRACE', 'field_name': 'tweedie_power', 'message': 'Tweedie power is only used for Tweedie distribution.'}, {'__meta': {'schema_version': 3, 'schema_name': 'ValidationMessageV3', 'schema_type': 'ValidationMessage'}, 'message_type': 'TRACE', 'field_name': 'quantile_alpha', 'message': 'Quantile (alpha) is only used for Quantile regression.'}, {'__meta': {'schema_version': 3, 'schema_name': 'ValidationMessageV3', 'schema_type': 'ValidationMessage'}, 'message_type': 'TRACE', 'field_name': 'max_after_balance_size', 'message': 'Balance classes is false, hide max_after_balance_size'}, {'__meta': {'schema_version': 3, 'schema_name': 'ValidationMessageV3', 'schema_type': 'ValidationMessage'}, 'message_type': 'TRACE', 'field_name': 'balance_classes', 'message': 'Balance classes is only applicable to classification problems.'}, {'__meta': {'schema_version': 3, 'schema_name': 'ValidationMessageV3', 'schema_type': 'ValidationMessage'}, 'message_type': 'TRACE', 'field_name': 'class_sampling_factors', 'message': 'Class sampling factors is only applicable to classification problems.'}, {'__meta': {'schema_version': 3, 'schema_name': 'ValidationMessageV3', 'schema_type': 'ValidationMessage'}, 'message_type': 'TRACE', 'field_name': 'max_after_balance_size', 'message': 'Max after balance size is only applicable to classification problems.'}, {'__meta': {'schema_version': 3, 'schema_name': 'ValidationMessageV3', 'schema_type': 'ValidationMessage'}, 'message_type': 'TRACE', 'field_name': 'max_confusion_matrix_size', 'message': 'Max confusion matrix size is only applicable to classification problems.'}, {'__meta': {'schema_version': 3, 'schema_name': 'ValidationMessageV3', 'schema_type': 'ValidationMessage'}, 'message_type': 'TRACE', 'field_name': 'max_hit_ratio_k', 'message': 'Max K-value for hit ratio is only applicable to multi-class classification problems.'}, {'__meta': {'schema_version': 3, 'schema_name': 'ValidationMessageV3', 'schema_type': 'ValidationMessage'}, 'message_type': 'TRACE', 'field_name': 'max_confusion_matrix_size', 'message': 'Only for multi-class classification problems.'}, {'__meta': {'schema_version': 3, 'schema_name': 'ValidationMessageV3', 'schema_type': 'ValidationMessage'}, 'message_type': 'TRACE', 'field_name': 'max_after_balance_size', 'message': 'Only used with balanced classes'}, {'__meta': {'schema_version': 3, 'schema_name': 'ValidationMessageV3', 'schema_type': 'ValidationMessage'}, 'message_type': 'TRACE', 'field_name': 'class_sampling_factors', 'message': 'Class sampling factors is only applicable if balancing classes.'}, {'__meta': {'schema_version': 3, 'schema_name': 'ValidationMessageV3', 'schema_type': 'ValidationMessage'}, 'message_type': 'ERRR', 'field_name': 'response', 'message': 'Response must be a categorical column'}, {'__meta': {'schema_version': 3, 'schema_name': 'ValidationMessageV3', 'schema_type': 'ValidationMessage'}, 'message_type': 'TRACE', 'field_name': 'balance_classes', 'message': 'Balance classes is not applicable to NaiveBayes.'}, {'__meta': {'schema_version': 3, 'schema_name': 'ValidationMessageV3', 'schema_type': 'ValidationMessage'}, 'message_type': 'TRACE', 'field_name': 'class_sampling_factors', 'message': 'Class sampling factors is not applicable to NaiveBayes.'}, {'__meta': {'schema_version': 3, 'schema_name': 'ValidationMessageV3', 'schema_type': 'ValidationMessage'}, 'message_type': 'TRACE', 'field_name': 'max_after_balance_size', 'message': 'Max after balance size is not applicable to NaiveBayes.'}]
    error_count = 2
h2o.exceptions.H2OResponseError:ModelBuilderError3(water.exceptions.H2OModelBuilderAllegalArgumentException):
时间戳=1568829213744
错误_url='/3/ModelBuilders/naivebayes'
msg='NaiveBayes模型的非法参数:NaiveBayes_model_python_156882; 9211691_1。详细信息:ERRR on field:\u response:response必须是分类列'
dev_msg='NaiveBayes模型的非法参数:NaiveBayes_model_python_156882; 9211691_1。详细信息:ERRR on field:\u response:response必须是分类列'
http_status=412
值={'messages':[{'u log'u level':5','u field'u name':'u keep'u cross'u validation'u models','u message':'仅用于交叉验证。},{'u log'level':5','u field'u name':'u keep'u cross'u validation'u predictions','u message':'仅用于交叉验证。},{“日志级别”:5,“字段名称”:“仅用于交叉验证”,“消息级别”:5,“字段名称”:“仅用于交叉验证”,“消息级别”:5,“字段名称”:“仅用于交叉验证”。},{{{}{}{}{}日志}级别:5,{}}}}}{}字段}}}}}}}}}名称}}}}}}}}}}}}}}}}}}分位数}}}}}}}},{“日志级别”:5,“字段名称”:“余额大小”后的“最大值”,“消息”:“余额类为假,在余额大小后隐藏最大值”},{“日志级别”:5,“字段名称”:“余额大小”后的“最大值”,“消息”:“余额类仅适用于分类问题”。},{“日志级别”:5,“字段名称”:“类采样系数”,“消息”:“类采样系数仅适用于分类问题”。},{“日志级别”:5,“字段名称”:“平衡大小后的最大值”,“平衡大小后的最大值仅适用于分类问题”。},{“日志级别”:5,“字段名称”:“最大混淆矩阵大小”,“消息”:“最大混淆矩阵大小仅适用于分类问题”。},{“日志级别”:5,“字段名称”:“最大命中率k”,“消息:”命中率的最大k值仅适用于多类分类问题。},{“日志级别”:5,“字段名称”:“最大混乱矩阵大小”,“消息”仅适用于多类分类问题。},{“日志级别”:5,“字段名称”:“平衡大小后的最大混乱矩阵大小”,“消息”仅用于平衡类”},{“日志级别”:5,“字段名称”:“类采样系数”,“消息”:“类采样系数仅在平衡类时适用”。},{“日志级别”:1,“字段名称”:“响应”,“消息”:“响应必须是分类列”},{“日志级别”:5,“字段名称”:“平衡类”,“消息”:“平衡类不适用于NaiveBayes”。},{“日志级别”:5,“字段名称”:“采样系数”,“消息”:“类采样系数不适用于NaiveBayes”。},{“日志”级别:5,“字段名称”:“平衡大小后的最大值”,“消息”:平衡大小后的最大值不适用于NaiveBayes.}],“算法”:“NaiveBayes”,“参数”:“{”列:{“名称”:“键帧上传”9CB9251216ED45DD909D3E9AF81477A.hex”,“类型”:“键”},“有效”:无,“\u交叉验证”:0,“\u保持交叉验证\u模型”:真,“\u保持交叉验证\u预测”:假,“\u保持交叉验证\u折叠指定”:假,“\u并行交叉验证”:真,“\u自动再平衡”:真,“\u种子”:-1,“\u折叠指定”:“自动”,“分类编码”:“自动”,“最大分类级别”:10,“\u分布”:“AUTO”和“tweedie-power”:1.5,“分位数”和“alpha”:0.5,“huber-alpha”:0.9,“忽略列”:无,“忽略列”:真,“权重列”:无,“偏移列”:无,“折叠列”:无,“检查常量响应”:真,“是cv模型”:假,“每次迭代得分”:假,“最大运行时”:0.0,“停止”ng_度量“:“自动”、“停止_公差”:0.001、“响应_列”:“C3”、“平衡_类”:False、“平衡_大小后的最大值”:5.0、“采样_系数”:None、“最大值混淆_矩阵_大小”:20、“检查点”:None、“预训练的自动编码器”:None、“自定义_度量_函数”:None、“自定义分布函数”:None、“导出_检查点”:Nonene,“U-laplace”:0.0,“U-eps\U-sdev”:0.0,“U-min\U-sdev”:0.001,“U-eps\U-prob”:0.0,“U-min\U-prob”:0.001,“U-compute\U-metrics”:True},“error\U-count”:2}
exception_msg='NaiveBayes模型的非法参数:NaiveBayes_model_python_156882; u 9211691_1。详细信息:ERRR on field:_response:response必须是分类列'
堆栈跟踪=
.
.
.
参数={uuuuu meta':{'schema_version':3,'schema_name':'NaiveBayesParametersV3','schema_type':'NaiveBayesParameters'},'model_id':None,'training_frame':{'schema_version':3,'schema_name':'FrameKeyV3','schema_type':'Key'},'name':'Key\u Frame\u upload\u 9cb9251216ede45dd909d3e9af81477a.hex','type':'Key','URL':'/3/Frames/Key\u Frame\u upload\u 9cb9251216ede45dd909d3e9af81477a.hex'},“验证框架”:无,'Nfold':0,'keep_cross_validation_models':True,'keep_cross_validation_predictions':False,'keep_cross_validation_fold_assignment':False,'parallelize_cross_validation':True,'distribution':'AUTO','tweedie_power':1.5,'quantile_alpha':0.5,'huber_alpha':0.9,'response_column':{'{'schema_version':3,'schema_name':'ColSpecifierV3','schema_type':'vecsspecifier'},'column_name':'C3','is_member_of_frames':N
train_frame[y] = train_frame[y].asfactor()