lgcre

Last updated:

0 purchases

lgcre Image
lgcre Images
Add to Cart

Description:

lgcre

LGCRE (Local Graph Context-based Recommender Engine) #
This is a library that implements a recommender engine for points of interest
(pois) on the device. The library is meant to serve recommendations to a
"person", the device owner, based on building a graph of pois and categories
around the person. Then given a set of pois and their categories, the
Getting Started #
Look at examples/lib/main.dart on how to use the plugin.

// LGCRE Initialization

Map<String,String> options = {
'lgcre.licenseid' : '<license_id>', //<- The license id (Required)
'lgcre.clientid' : '<client_id>', //<- The client id (Required)
'lgcre.loglevel' : 'fine', //<- The log level (fine, off, debug, severe, config, warning)
'lgcre.maxmem' : '64' //<- The max amount of memory to use
};
Lgcre.init(options);

// LGCRE reset data
Lgcre.reset();

// LGCRE add data
// Each data key (pois, categories, link_categories,
// etc...) can be null if no data needs to be added from that type. In
// this example we add data for all types just as an example

Map<String,dynamic> data = new Map<String, dynamic>();
// Add pois to the recommender. For instance, when we know the person has
// visited one poi and we want to represent this by means of a link
// between the person and the poi (see below)
data['pois'] = ["poi1", "poi2", "poi3", "poi4"];

// Add categories to the recommender. For instance, because we know the
// person is interested in a particular category or because we know that a poi
// the user has visited, has a category (see below)
data['categories'] = ["cat1", "cat2", "cat3", "cat4"];

// Add links between categories to the recommender. For instance, when
// we know that two categories are related. Both categories must have been
// previously added before through the categories field, either in this
// call or in a previous call to 'addData' (see above). This field is used
// to build a 'graph of categories'. It is important to make this graf as
// connected as possible since this may greatly affect quality of the results
data['links_categories'] = [
{'category1' : 'cat1',
'category2' : 'cat2'},

{'category1' : 'cat1',
'category2' : 'cat3'},

{'category1' : 'cat2',
'category2' : 'cat4'},
];

// Add links between pois and categories to the recommender. When we know
// that a poi is related in some way to a category. Both pois and
// categories in the links must have been added previously through 'pois'
// and 'categories' field, either on this call or in a previous call to
// 'addData' (see above).
data['links_poi_category'] = [
{'poi' : 'poi1',
'category' : 'cat1'},
{'poi' : 'poi2',
'category' : 'cat2'},
{'poi' : 'poi3',
'category' : 'cat3'},
];

// Add data to the person. 'pois' are pois related to the user, for
// instance, because we know he has liked or visited it. The pois in the
// list must have already been added through the "pois" field, either in
// this call or a previous call to 'addData' (see above). Categories are the
// categories the person is interested in. These categories must be added inthis
// through the 'categories' field or in a previous call to 'addData' (see above)
data['person'] = {
'pois' : ['poi1', 'poi2'],
'categories' : ['cat1', 'cat2'],
};

Lgcre.addData(data);


// LGCRE Run a recommendation query
// To execute a query, build a map between pois and lists of categories as
// follows
Map<String,dynamic> query = new Map<String,dynamic>();
query['pois'] = [
{ 'poi' : 'poi1',
'categories' : ['cat1, cat2']},
{ 'poi' : 'poi2',
'categories' : ['cat1, cat3']},
{ 'poi' : 'poi3',
'categories' : ['cat2, cat4']},
{ 'poi' : 'poi4',
'categories' : ['cat3, cat4']},
];

// The method run
List<ResultEntry>? result = await Lgcre.run(query);
if(result != null)
{
for (ResultEntry entry in result)
{
print(entry.poi+" "+entry.score.toString()+"\n");
}
}


// LGCRE: Releasing resources
Lgcre.release();
copied to clipboard
Android #
You will need to include the proguard rules to your app project. Add the file
example/android/app/proguard-rules.pro to your app project, and include the
following configuartion to
buildTypes {
release {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}

copied to clipboard
Alternatively, you can disable proguard from your project by adding to

buildTypes {
release {
shrinkResources false
minifyEnabled false
useProguard false
}
```

copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.