You are here

function Recommender::__construct in Recommender API 6.2

1 call to Recommender::__construct()
CooccurrenceRecommender::__construct in ./Recommender.php
1 method overrides Recommender::__construct()
CooccurrenceRecommender::__construct in ./Recommender.php

File

./Recommender.php, line 49

Class

Recommender
The super class for all other Recommender algorithms.

Code

function __construct($appName, $tableName, $fieldMouse, $fieldCheese, $fieldWeight, $options = array()) {

  // remove the watchdog [#672166]

  //watchdog("recommender", "Initializing recommender with class ". get_class($this) ." for application $appName");
  $this->appName = $appName;
  $this->appId = self::convertAppId($appName);
  $this->tableName = $tableName;
  $this->fieldMouse = $fieldMouse;
  $this->fieldCheese = $fieldCheese;
  $this->fieldWeight = $fieldWeight;
  $this->options = $options;
  $this->created = time();
  $this->mouseNum = NULL;

  // init to NULL for late initialization
  $this->cheeseNum = NULL;

  // $this->performance determines whether computation is done in memory/database/java, or maybe undefined
  $this->performance = @$options['performance'];
  if (!isset($this->performance) || $this->performance != 'database' && $this->performance != 'memory' && $this->performance != 'java') {
    $this->performance = 'auto';
  }

  // $this->missing determines how to handle missing data.
  $this->missing = @$options['missing'];
  if (!isset($this->missing) || $this->missing != 'none' && $this->missing != 'zero') {
    $this->missing = 'none';
  }
  $this->duplicate = @$options['duplicate'];
  if (!isset($this->duplicate) || $this->duplicate != 'keep' && $this->duplicate != 'remove') {
    $this->duplicate = 'remove';
  }

  // give a chance to derived classes to do something.
  $this
    ->initialize();
}