<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                # 開始使用 XGBoost 這里是一個快速入門的教程, 它展示了讓你快速在示例數據集上進行二元分類任務時的 xgboost 的代碼片段. ## Links to Helpful Other Resources * 請參閱 [_安裝指南_](../build.html) 以了解如何去安裝 xgboost. * 請參閱 [_入門指引_](../how_to/index.html) 以了解有關使用 xgboost 的各種技巧. * 請參閱 [_學習教程_](../tutorials/index.html) 以了解有關特定任務的教程. * 請參閱 [通過例子來學習使用 XGBoost](https://github.com/dmlc/xgboost/tree/master/doc/../demo) 以了解更多代碼示例. ## Python ``` import xgboost as xgb # 讀取數據 dtrain = xgb.DMatrix('demo/data/agaricus.txt.train') dtest = xgb.DMatrix('demo/data/agaricus.txt.test') # 通過 map 指定參數 param = {'max_depth':2, 'eta':1, 'silent':1, 'objective':'binary:logistic' } num_round = 2 bst = xgb.train(param, dtrain, num_round) # 預測 preds = bst.predict(dtest) ``` ## R ``` # 加載數據 data(agaricus.train, package='xgboost') data(agaricus.test, package='xgboost') train <- agaricus.train test <- agaricus.test # 擬合模型 bst <- xgboost(data = train$data, label = train$label, max.depth = 2, eta = 1, nround = 2, nthread = 2, objective = "binary:logistic") # 預測 pred <- predict(bst, test$data) ``` ## Julia ``` using XGBoost # 讀取數據 train_X, train_Y = readlibsvm("demo/data/agaricus.txt.train", (6513, 126)) test_X, test_Y = readlibsvm("demo/data/agaricus.txt.test", (1611, 126)) # 擬合模型 num_round = 2 bst = xgboost(train_X, num_round, label=train_Y, eta=1, max_depth=2) # 預測 pred = predict(bst, test_X) ``` ## Scala ``` import ml.dmlc.xgboost4j.scala.DMatrix import ml.dmlc.xgboost4j.scala.XGBoost object XGBoostScalaExample { def main(args: Array[String]) { // 讀取 xgboost/demo/data 目錄中可用的訓練數據 val trainData = new DMatrix("/path/to/agaricus.txt.train") // 定義參數 val paramMap = List( "eta" -> 0.1, "max_depth" -> 2, "objective" -> "binary:logistic").toMap // 迭代次數 val round = 2 // train the model val model = XGBoost.train(trainData, paramMap, round) // 預測 val predTrain = model.predict(trainData) // 保存模型至文件 model.saveModel("/local/path/to/model") } } ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看