Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401]

(no description)

File Size: 332 lines (8 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Apriori:: (17 methods):
  __construct()
  getRules()
  apriori()
  predictSample()
  generateAllRules()
  generateRules()
  powerSet()
  antecedents()
  items()
  frequent()
  candidates()
  confidence()
  support()
  frequency()
  contains()
  subset()
  equals()


Class: Apriori  - X-Ref

__construct(float $support = 0.0, float $confidence = 0.0)   X-Ref
Apriori constructor.


getRules()   X-Ref
Get all association rules which are generated for every k-length frequent item set.

return: mixed[][]

apriori()   X-Ref
Generates frequent item sets.

return: mixed[][][]

predictSample(array $sample)   X-Ref

param: mixed[] $sample
return: mixed[][]

generateAllRules()   X-Ref
Generate rules for each k-length frequent item set.


generateRules(array $frequent)   X-Ref
Generate confident rules for frequent item set.

param: mixed[] $frequent

powerSet(array $sample)   X-Ref
Generates the power set for given item set $sample.

param: mixed[] $sample
return: mixed[][]

antecedents(array $sample)   X-Ref
Generates all proper subsets for given set $sample without the empty set.

param: mixed[] $sample
return: mixed[][]

items()   X-Ref
Calculates frequent k = 1 item sets.

return: mixed[][]

frequent(array $samples)   X-Ref
Returns frequent item sets only.

param: mixed[][] $samples
return: mixed[][]

candidates(array $samples)   X-Ref
Calculates frequent k item sets, where count($samples) == $k - 1.

param: mixed[][] $samples
return: mixed[][]

confidence(array $set, array $subset)   X-Ref
Calculates confidence for $set. Confidence is the relative amount of sets containing $subset which also contain
$set.

param: mixed[] $set
param: mixed[] $subset

support(array $sample)   X-Ref
Calculates support for item set $sample. Support is the relative amount of sets containing $sample in the data
pool.

param: mixed[] $sample

frequency(array $sample)   X-Ref
Counts occurrences of $sample as subset in data pool.

param: mixed[] $sample

contains(array $system, array $set)   X-Ref
Returns true if set is an element of system.

param: mixed[][] $system
param: mixed[]   $set

subset(array $set, array $subset)   X-Ref
Returns true if subset is a (proper) subset of set by its items string representation.

param: mixed[] $set
param: mixed[] $subset

equals(array $set1, array $set2)   X-Ref
Returns true if string representation of items does not differ.

param: mixed[] $set1
param: mixed[] $set2