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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
<?php // -*-php-*-
rcs_id('$Id: CustomPrefs.php,v 1.1 2004/06/18 14:42:17 rurban Exp $');
/**
* Custom UserPreferences:
* A list of name => _UserPreference class pairs.
* Rationale: Certain themes should be able to extend the predefined list
* of preferences. Display/editing is done in the theme specific userprefs.tmpl
* but storage/sanification/update/... must be extended to the Get/SetPreferences methods.
*
* This is just at alpha stage, a recommendation to the wikilens group.
*/
class _UserPreference_recengine // recommendation engine method
extends _UserPreference
{
var $valid_values = array('php','mysuggest','mymovielens','mycluto');
var $default_value = 'php';
function sanify ($value) {
if (!in_array($value, $this->valid_values)) return $this->default_value;
else return $value;
}
};
class _UserPreference_recalgo // recommendation engine algorithm
extends _UserPreference
{
var $valid_values = array
(
'itemCos', // Item-based Top-N recommendation algorithm with cosine-based similarity function
'itemProb', // Item-based Top-N recommendation algorithm with probability-based similarity function.
// This algorithms tends to outperform the rest.
'userCos', // User-based Top-N recommendation algorithm with cosine-based similarity function.
'bayes'); // Nave Bayesian Classifier
var $default_value = 'itemProb';
function sanify ($value) {
if (!in_array($value, $this->valid_values)) return $this->default_value;
else return $value;
}
};
class _UserPreference_recnnbr // recommendation engine key clustering, neighborhood size
extends _UserPreference_numeric{};
$WikiTheme->customUserPreferences
(array
(
'recengine' => new _UserPreference_recengine('php'),
'recalgo' => new _UserPreference_recalgo('itemProb'),
//recnnbr: typically 15-30 for item-based, 40-80 for user-based algos
'recnnbr' => new _UserPreference_recnnbr(10,14,80),
));
// $Log: CustomPrefs.php,v $
// Revision 1.1 2004/06/18 14:42:17 rurban
// added wikilens libs (not yet merged good enough, some work for DanFr)
//
// Local Variables:
// mode: php
// tab-width: 8
// c-basic-offset: 4
// c-hanging-comment-ender-p: nil
// indent-tabs-mode: nil
// End:
?>
|