QMiner recommendation

node v0.12.18
version: 1.0.0
Recommendation of items using "visitors that view this also viewed..." approach. That is, visitors are recommended items that are most often viewed by other visitors that watched some of the same items. In this example we will use visitor-item data from online lectures website VideoLectures.NET.
Import libraries: the main library qminer and a helper package for the example dataset.
var qm = require('qminer'); var loader = require('qminer-data-loader');
Define the storage schema. We have two stores: one for visitors descrbied by a unique ID and one for lectures described by their title. Visitors and lectures are connected by a join.
var base = new qm.Base({ mode: 'createClean', schema: [{ name: 'Visitors', fields: [{ name: 'ID', type: 'string' }], joins: [{ name: 'lectures', type: 'index', store: 'Lectures', inverse : 'visitors' }] }, { name: 'Lectures', fields: [{ name: 'Title', type: 'string' }], joins: [{ name: 'visitors', type: 'index', store: 'Visitors', inverse: 'lectures'}] }] }); var visitors = base.store('Visitors'); var lectures = base.store('Lectures'); 'defined schema'
Import visit data.
visitors.loadJson('visits.json', 1000); 'Loaded' + visitors.length + 'visitors and' + lectures.length + 'lectures'

no comments

    sign in to comment