Beispiel #1
0
<!DOCTYPE HTML>
<html>
<head> 
    <meta http-equiv="content-type" content="text/html; charset=utf-8" /> 
	<title>Apriori Alghoritm</title>
</head>
<body style="font-family: monospace;">
<?php 
include 'class.apriori.php';
$Apriori = new Apriori();
$Apriori->setMaxScan(20);
//Scan 2, 3, ...
$Apriori->setMinSup(2);
//Minimum support 1, 2, 3, ...
$Apriori->setMinConf(75);
//Minimum confidence - Percent 1, 2, ..., 100
$Apriori->setDelimiter(',');
//Delimiter
/*
Use Array:
$dataset   = array();
$dataset[] = array('A', 'B', 'C', 'D'); 
$dataset[] = array('A', 'D', 'C');  
$dataset[] = array('B', 'C'); 
$dataset[] = array('A', 'E', 'C'); 
$Apriori->process($dataset);
*/
$Apriori->process('dataset.txt');
//Frequent Itemsets
echo '<h1>Frequent Itemsets</h1>';
$Apriori->printFreqItemsets();
Beispiel #2
0
<!DOCTYPE HTML>
<html>
<head> 
    <meta http-equiv="content-type" content="text/html; charset=utf-8" /> 
	<title>Apriori Alghoritm</title>
</head>
<body style="font-family: monospace;">
<pre>
<?php 
include 'Apriori.php';
$Apriori = new Apriori();
$Apriori->setMaxScan(3);
$Apriori->setMinSup(2);
$Apriori->setMinConf(100);
$Apriori->setDelimiter(',');
$Apriori->process('fichier.txt');
//Frequent Itemsets
echo '<h1>Frequent Itemsets</h1>';
$Apriori->printFreqItemsets();
echo '<h3>Frequent Itemsets Array</h3>';
print_r($Apriori->getFreqItemsets());
//Association Rules
echo '<h1>Association Rules</h1>';
$Apriori->printAssociationRules();
echo '<h3>Association Rules Array</h3>';
print_r($Apriori->getAssociationRules());
//Sauvegarde dans les fichiers
$Apriori->saveFreqItemsets('freqItemsets.txt');
$Apriori->saveAssociationRules('associationRules.txt');
?>
</pre>
        array_push($dataset, $set);
    }
}
if (isset($_POST['submitParameters'])) {
    $Apriori = new Apriori();
    $Apriori->setMaxScan($_POST['maximumScan']);
    //Scan 2, 3, ...
    $Apriori->setMinSup($_POST['minimumSupport']);
    //Minimum support 1, 2, 3, ...
    $Apriori->setDelimiter(',');
    //Delimiter
    $Apriori->process($dataset);
} else {
    $Apriori = new Apriori();
    //default values
    $Apriori->setMaxScan(100);
    //Scan 2, 3, ...
    $Apriori->setMinSup(3);
    //Minimum support 1, 2, 3, ...
    $Apriori->setMinConf(75);
    //Minimum confidence - Percent 1, 2, ..., 100
    $Apriori->setDelimiter(',');
    //Delimiter
    $Apriori->process($dataset);
}
?>
<pre>
<?php 
// print_r($dataset);
?>
	</pre>