PythonGenericRegressor.java 文件源码

java
阅读 34 收藏 0 点赞 0 评论 0

项目:StackNet 作者:
/**
* 
* @param filename : the conifiguration file name for required to run xgboost from the command line
* @param datset : the dataset to be used
* @param model : model dump name
* @param columns : Number of columns in the data
*/
 private void create_config_file(String filename , String datset, String model, int columns){

try{  // Catch errors in I/O if necessary.
      // Open a file to write to.

        String saveFile = filename;

        FileWriter writer = new FileWriter(saveFile);
        writer.append("task=train\n");
        writer.append("columns=" + columns+ "\n");                  
        writer.append("model=" +model+ "\n");   
        writer.append("data=" +datset+ "\n");                   
        writer.append("n_jobs=" + this.threads + "\n");
        writer.append("random_state=" +  this.seed + "\n");
        if (this.verbose){
            writer.append("verbose=1" +  "\n");
        }else {
            writer.append("verbose=0" +  "\n");                 
        }           
        writer.close();

    } catch (Exception e) {
        throw new IllegalStateException(" failed to write the config file at: " + filename);
    }    
 }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号