h2o生成模型
import h2o
from h2o.automl import H2OAutoML
h2o.init()
path = '/Users/huoshirui/Desktop/xyworking/pythonData/dataClean/tengxun_final.csv'
tengxun_df = h2o.import_file(path)
df = tengxun_df[:, ["target", "tx_score", "tx_new_risk_code1", "tx_new_risk_code2", "tx_new_risk_code3", "tx_new_risk_code4",
"tx_new_risk_code5", "tx_new_risk_code6", "tx_new_risk_code7", "tx_new_risk_code503", "tx_new_risk_sumList",
"tx_new_is_riskList", "tx_score_0", "tx_score_1", "tx_score_2", "tx_score_3"]]
splits = df.split_frame(ratios = [0.7], seed = 666)
train = splits[0]
test = splits[1]
x = train.columns
y = 'target'
x.remove(y)
train[y] = train[y].asfactor()
test[y] = test[y].asfactor()
auto_model = H2OAutoML(max_runtime_secs = 100)
auto_model.train(x = x, y = y,
training_frame = train
)
modelfile = auto_model.download_mojo(path="/Users/huoshirui/Desktop/xyworking/pythonData/dataClean/", get_genmodel_jar=True)
print(