-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
input file only accepts xlsx? #1
Comments
require('vendor/autoload.php');
$c45 = new Algorithm\C45();
$input = new Algorithm\C45\DataInput;
$data = array(
array(
"OUTLOOK" => "Sunny",
"TEMPERATURE" => "Hot",
"HUMIDITY" => "High",
"WINDY" => "False",
"PLAY" => "No"
),
array(
"OUTLOOK" => "Sunny",
"TEMPERATURE" => "Hot",
"HUMIDITY" => "High",
"WINDY" => "True",
"PLAY" => "No"
),
array(
"OUTLOOK" => "Cloudy",
"TEMPERATURE" => "Hot",
"HUMIDITY" => "High",
"WINDY" => "False",
"PLAY" => "Yes"
),
array(
"OUTLOOK" => "Rainy",
"TEMPERATURE" => "Mild",
"HUMIDITY" => "High",
"WINDY" => "False",
"PLAY" => "Yes"
),
array(
"OUTLOOK" => "Rainy",
"TEMPERATURE" => "Cool",
"HUMIDITY" => "Normal",
"WINDY" => "False",
"PLAY" => "Yes"
),
array(
"OUTLOOK" => "Rainy",
"TEMPERATURE" => "Cool",
"HUMIDITY" => "Normal",
"WINDY" => "True",
"PLAY" => "No"
),
array(
"OUTLOOK" => "Cloudy",
"TEMPERATURE" => "Cool",
"HUMIDITY" => "Normal",
"WINDY" => "True",
"PLAY" => "Yes"
),
array(
"OUTLOOK" => "Sunny",
"TEMPERATURE" => "Mild",
"HUMIDITY" => "High",
"WINDY" => "False",
"PLAY" => "No"
),
array(
"OUTLOOK" => "Sunny",
"TEMPERATURE" => "Cool",
"HUMIDITY" => "Normal",
"WINDY" => "False",
"PLAY" => "Yes"
),
array(
"OUTLOOK" => "Rainy",
"TEMPERATURE" => "Mild",
"HUMIDITY" => "Normal",
"WINDY" => "False",
"PLAY" => "Yes"
),
array(
"OUTLOOK" => "Sunny",
"TEMPERATURE" => "Mild",
"HUMIDITY" => "Normal",
"WINDY" => "True",
"PLAY" => "Yes"
),
array(
"OUTLOOK" => "Cloudy",
"TEMPERATURE" => "Mild",
"HUMIDITY" => "High",
"WINDY" => "True",
"PLAY" => "Yes"
),
array(
"OUTLOOK" => "Cloudy",
"TEMPERATURE" => "Hot",
"HUMIDITY" => "Normal",
"WINDY" => "False",
"PLAY" => "Yes"
),
array(
"OUTLOOK" => "Rainy",
"TEMPERATURE" => "Mild",
"HUMIDITY" => "High",
"WINDY" => "True",
"PLAY" => "No"
)
);
// Initialize Data
$input->setData($data); // Set data from array
$input->setAttributes(array('OUTLOOK', 'TEMPERATURE', 'HUMIDITY', 'WINDY', 'PLAY')); // Set attributes of data
// Initialize C4.5
$c45->c45 = $input; // Set input data
$c45->setTargetAttribute('PLAY'); // Set target attribute
$initialize = $c45->initialize(); // initialize
// Build Output
$buildTree = $initialize->buildTree(); // Build tree
$arrayTree = $buildTree->toArray(); // Set to array
$stringTree = $buildTree->toString(); // Set to string
echo "<pre>";
print_r ($arrayTree);
echo "</pre>";
echo $stringTree; |
Excellent, thank you. |
I just couldn’t find it in the examples. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think the code should accept input files other then xlsx and should include input of arrays or some kind of metrics for training.
The text was updated successfully, but these errors were encountered: