1

Fixing feature normalization

This commit is contained in:
Alex Yatskov 2014-09-18 21:00:46 +09:00
parent c5ac0eb8d5
commit 2bced5158a

View File

@ -30,7 +30,7 @@ function normalize(values) {
for (var feature in values) { for (var feature in values) {
var value = values[feature]; var value = values[feature];
result[value] = Math.max(-1.0, Math.min(1.0, value), value); result[feature] = Math.max(-1.0, Math.min(1.0, value), value);
} }
return result; return result;
@ -171,7 +171,14 @@ function addKeyword(query, callback) {
result = normalize(result); result = normalize(result);
var values = [query.keyword, result.food, result.service, result.value, result.atmosphere]; var values = [
query.keyword,
result.food,
result.service,
result.value,
result.atmosphere
];
connection.query('INSERT INTO keywords VALUES(?, ?, ?, ?, ?)', values, function(err) { connection.query('INSERT INTO keywords VALUES(?, ?, ?, ?, ?)', values, function(err) {
callback({ callback({
keyword: query.keyword, keyword: query.keyword,