]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/wikilens/CustomPrefs.php
Remove rcs_id
[SourceForge/phpwiki.git] / lib / wikilens / CustomPrefs.php
1 <?php // -*-php-*-
2 // $Id$
3
4 /**
5  * Custom UserPreferences:
6  * A list of name => _UserPreference class pairs.
7  * Rationale: Certain themes should be able to extend the predefined list 
8  * of preferences. Display/editing is done in the theme specific userprefs.tmpl
9  * but storage/sanification/update/... must be extended to the Get/SetPreferences methods.
10  *
11  * This is just at alpha stage, a recommendation to the wikilens group.
12  */
13
14 class _UserPreference_recengine // recommendation engine method
15 extends _UserPreference
16 {
17     var $valid_values = array('php','mysuggest','mymovielens','mycluto');
18     var $default_value = 'php';
19
20     function sanify ($value) {
21         if (!in_array($value, $this->valid_values)) return $this->default_value;
22         else return $value;
23     }
24 };
25
26 class _UserPreference_recalgo // recommendation engine algorithm
27 extends _UserPreference
28 {
29     var $valid_values = array
30         (
31          'itemCos',  // Item-based Top-N recommendation algorithm with cosine-based similarity function
32          'itemProb', // Item-based Top-N recommendation algorithm with probability-based similarity function. 
33                      // This algorithms tends to outperform the rest.
34          'userCos',  // User-based Top-N recommendation algorithm with cosine-based similarity function.
35          'bayes');   // Naïve Bayesian Classifier
36     var $default_value = 'itemProb';
37
38     function sanify ($value) {
39         if (!in_array($value, $this->valid_values)) return $this->default_value;
40         else return $value;
41     }
42 };
43
44 class _UserPreference_recnnbr // recommendation engine key clustering, neighborhood size
45 extends _UserPreference_numeric{};
46
47 $WikiTheme->customUserPreferences
48         (array
49          (
50           'recengine' => new _UserPreference_recengine('php'),
51           'recalgo'   => new _UserPreference_recalgo('itemProb'),
52           //recnnbr: typically 15-30 for item-based, 40-80 for user-based algos
53           'recnnbr'   => new _UserPreference_recnnbr(10,14,80),
54           ));
55
56 // Local Variables:
57 // mode: php
58 // tab-width: 8
59 // c-basic-offset: 4
60 // c-hanging-comment-ender-p: nil
61 // indent-tabs-mode: nil
62 // End:
63 ?>