2017-08-22 50 views
0

我能夠保存H2O模式,再裝回,然後顯示它...錯誤加載H2O模型,然後預測

# save the model 
model_path_2 = h2o.save_model(model=my_xgboost_2, path="tmp/mymodel", force=True) 
print (model_path_2) 

>>>/home/dell/Documents/Enigma/tmp/mymodel/XGBoost_model_python_1503367354328_27 

# load the model 
saved_model_2 = h2o.load_model(model_path_2) 

但我不能用它來預測。

saved_model_2.predict(test) 

    >>>xgboost prediction progress: | (failed) 
--------------------------------------------------------------------------- 
OSError         Traceback (most recent call last) 
<ipython-input-100-fa76fd498ee6> in <module>() 
----> 1 saved_model_2.predict(test) 

/home/dell/anaconda3/lib/python3.6/site-packages/h2o/model/model_base.py in predict(self, test_data) 
    130   j = H2OJob(h2o.api("POST /4/Predictions/models/%s/frames/%s" % (self.model_id, test_data.frame_id)), 
    131     self._model_json["algo"] + " prediction") 
--> 132   j.poll() 
    133   return h2o.get_frame(j.dest_key) 
    134 

/home/dell/anaconda3/lib/python3.6/site-packages/h2o/job.py in poll(self, verbose_model_scoring_history) 
    75    if (isinstance(self.job, dict)) and ("stacktrace" in list(self.job)): 
    76     raise EnvironmentError("Job with key {} failed with an exception: {}\nstacktrace: " 
---> 77          "\n{}".format(self.job_key, self.exception, self.job["stacktrace"])) 
    78    else: 
    79     raise EnvironmentError("Job with key %s failed with an exception: %s" % (self.job_key, self.exception)) 

OSError: Job with key $03017f00000132d4ffffffff$_927b7278904ecf169173d48a23de4c10 failed with an exception: java.lang.NullPointerException 
stacktrace: 
java.lang.NullPointerException 

但是,我可以預測模型而不保存它。我在Ubuntu 16.04上使用Python 3.6.1和H2O 3.14.0.1。

回答

1

這是一個known issue與H2O的XGBoost實施,應儘快解決。它不會影響其他H2O型號。

+0

我也觀察到,xgboost的nfolds失敗,當我連續訓練多個模型(用不同的驗證集種子代替交叉驗證)時,模型會給出奇怪的結果(所有度量等於0.5)。這也是一個已知的XGBoost問題? –

+0

上面的問題是保存和加載模型固定在夜間出血的邊緣嗎? –

+0

對於第一個問題,您能否提供一個可重複的示例並提交JIRA票證?這聽起來像一個錯誤。保存/加載問題尚未解決,但它是一個高優先級項目,因此應儘快解決。 –