Giter Club home page Giter Club logo

php-decision-tree's Introduction

【ソフト名】決定木作成モジュール 
【著作権者】狩野達也
【制作日】2011/11/18
【種 別】決定木、CART
【連絡先】[email protected]
【動作環境】CentOS 6 
【開発環境】CentOS 6 

―――――――――――――――――――――――――――――――――――――
≪著作権および免責事項≫


―――――――――――――――――――――――――――――――――――――

【はじめに】
このモジュールは、CARTアルゴリズムを使った決定木の作成、
利用を行うためのモジュールです。


【インストール方法】
以下の通り.

・php-decision-tree
$ git clone git://github.com/kokukuma/php-decision-tree.git


【使い方例】
1, モジュールの読み込み
require_once('Make_Decision_Tree.php');


2, データの準備
$data = array();
$data[0]   = array("生死"=>"生還","年齢"=>"35","性別"=>"男","等級"=>"1等");
$data[1]   = array("生死"=>"生還","年齢"=>"12","性別"=>"女","等級"=>"1等");
$data[2]   = array("生死"=>"生還","年齢"=>"35","性別"=>"女","等級"=>"1等");
$data[3]   = array("生死"=>"死亡","年齢"=>"26","性別"=>"男","等級"=>"1等");
$data[4]   = array("生死"=>"生還","年齢"=>"23","性別"=>"女","等級"=>"1等");

目的変数は2値変数のみ、
カテゴリ変数は「2値変数」「多値変数」「連続変数」に対応している。
判別基準としては、以下のようになっている.

・多値変数 : 値の種類が3種類以上、数字のみでない。
・連続変数 : 値の種類が3種類以上、数字のみ
・2値変数 : 上記以外の場合


3, データの読み込み
$dt = new Decision_Tree($data);


4, 決定木の生成 
$tree = $dt->classify('生死','生還','死亡');

第1引数 : 目的変数名
第2引数 : 正とする目的変数の値 
第3引数 : 誤とする目的変数の値


5, 決定木の利用
$target = array("年齢"=>"40","性別"=>"男","等級"=>"2等");
$res = $dt->prognosis($target);

$targetのデータ構造は, 
$dataの1要素から目的変数を除いた形式とする。
返値には、決定木から想定される目的変数の値が返却される。 


―――――――――――――――――――――――――――――――――――――

php-decision-tree's People

Contributors

kokukuma avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.