Skip to content
This repository has been archived by the owner on May 30, 2022. It is now read-only.

Commit

Permalink
load data from db
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Rabenhorst committed Mar 12, 2015
1 parent 0209df7 commit 8294c27
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,21 @@ exports.loadCSVData = function (context, done) {
.on('end', function () { done(); });
};

exports.loadTestData = function (context, done) {
console.log('loadTestData');
context.data = {};
context.testData.forEach(function (testdata) {
var zone = testdata.zone;
context.data[zone] = context.data[zone] || [];
var record = {};
testdata.data[0].beacons.forEach(function (beacon) {
record[beacon.major + '-' + beacon.minor] = beacon.rssi;
});
context.data[zone].push(record);
});
done();
};

exports.writeTrainData = function (context, done) {
context.tempTrainFile = 'temp.train';
var train = context.model ? false : true;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "svm-tools",
"version": "1.0.0",
"description": "Tools to generate SVM Models",
"main": "index.js",
"main": "lib/util.js",
"bin": {
"svm-gen": "svm-gen.js",
"svm-test": "svm-test.js"
Expand Down

0 comments on commit 8294c27

Please sign in to comment.