gpt4 book ai didi

ml.dmlc.xgboost4j.java.XGBoost.loadModel()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-21 04:35:05 24 4
gpt4 key购买 nike

本文整理了Java中ml.dmlc.xgboost4j.java.XGBoost.loadModel()方法的一些代码示例,展示了XGBoost.loadModel()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XGBoost.loadModel()方法的具体详情如下:
包路径:ml.dmlc.xgboost4j.java.XGBoost
类名称:XGBoost
方法名:loadModel

XGBoost.loadModel介绍

[英]Load a new Booster model from a file opened as input stream. The assumption is the input stream only contains one XGBoost Model. This can be used to load existing booster models saved by other xgboost bindings.
[中]从作为输入流打开的文件加载新的增压器模型。假设输入流只包含一个XGBoost模型。这可用于加载其他xgboost绑定保存的现有增压器模型。

代码示例

代码示例来源:origin: org.apache.hivemall/hivemall-xgboost

@Nonnull
private static Booster initXgBooster(@Nonnull final byte[] input) throws HiveException {
  try {
    return XGBoost.loadModel(new ByteArrayInputStream(input));
  } catch (Exception e) {
    throw new HiveException(e);
  }
}

代码示例来源:origin: spotify/zoltar

/**
 * Note: Please use Models from zoltar-models module.
 *
 * <p>Returns a XGBoost model given a URI to the serialized model file.
 */
public static XGBoostModel create(final Model.Id id, final URI modelUri) throws IOException {
 try {
  GompLoader.start();
  final InputStream is = Files.newInputStream(FileSystemExtras.path(modelUri));
  return new AutoValue_XGBoostModel(id, XGBoost.loadModel(is));
 } catch (final XGBoostError xgBoostError) {
  throw new IOException(xgBoostError);
 }
}

代码示例来源:origin: ml.dmlc/xgboost4j-example

Booster booster2 = XGBoost.loadModel("./model/xgb.model");
DMatrix testMat2 = new DMatrix("./model/dtest.buffer");
float[][] predicts2 = booster2.predict(testMat2);

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com