如何阅读和获取R的C5.0模型

时间:2018-03-27 00:00:19

标签: r machine-learning c5

我已搜索并搜索但无法找到答案。我有一个训练有素的c5_model但我需要做100条路径才能让它达到我想要的水平。但是我一直试图将它从R中的模型中删除。我已经做了一个总结,但是我如何得出决策树。我想使用哪种试验? enter image description here

更新

我通过以下方式构建模型

// just define at the top of the script index.php
$username = ''; 
$username = $_SESSION['username'];

//Initializing variable
$body = ""; //Initialization value; Examples
         //"" When you want to append stuff later
         //0  When you want to add numbers later
//isset()
$body = isset($_POST['body']) ? $_POST['body'] : '';
//empty()
$body = !empty($_POST['body']) ? $_POST['body'] : '';

 if(isset($_POST['bts'])) {

    if (empty($_POST["body"])) {
         echo"You didn't enter anything . <a href= profile.php>Try again</a>";
        } else {
        $body = $_POST["body"];

          $sql = "INSERT INTO posts (username, body ) VALUES ('" . $username . "', '" . $body . "')";

            if(mysqli_query($conn, $sql)){                                  

            echo"<a href= home.php>Post added to your timeline.</a>"; 
            } else{
             echo "<br>error posting . <br> <a href= profile.php>Try again</a> " . 
             mysqli_error($conn);
} 
} 
} else {
echo"Wasn't submitted";
}

这是训练模型的错误方法吗?

1 个答案:

答案 0 :(得分:0)

C5.0的对象有许多元素,如您可以使用?C50::C5.0.default提取的帮助文件中所述。其中一个要素是tree。如果您已将C5.0()的调用输出分配给某个值,例如model,则可以使用$运算符提取其任何元素。例如:

model <- C5.0(<the call you made that generated the model>)
model$tree