forked from VTwo-Group/Apriori-Algorithm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.php
More file actions
48 lines (40 loc) · 1.19 KB
/
example.php
File metadata and controls
48 lines (40 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<!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();
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());
//Save to file
$Apriori->saveFreqItemsets('freqItemsets.txt');
$Apriori->saveAssociationRules('associationRules.txt');
?>
</body>
</html>