1

Rebasing features

This commit is contained in:
Alex Yatskov 2014-09-26 13:17:43 +09:00
parent 27eb1014de
commit 3b7a377161

View File

@ -43,10 +43,15 @@ function combine(dict, params) {
result = add(values, result); result = add(values, result);
} }
var max = 0.0;
for (var key in result) { for (var key in result) {
var value = result[key]; max = Math.max(Math.abs(result[key]), max);
value = Math.min(1.0, Math.max(-1.0, value)); }
result[key] = value;
if (max > 0.0) {
for (var key in result) {
result[key] = result[key] / max;
}
} }
return result; return result;
@ -236,7 +241,7 @@ function execQuery(query, callback) {
var searchResults = findRecords( var searchResults = findRecords(
data, data,
query.searchParams, query.searchParams,
query.minScore * _.keys(query.searchParams).length query.minScore
); );
var graphColumns = {}; var graphColumns = {};
@ -244,7 +249,7 @@ function execQuery(query, callback) {
var searchHints = buildHints( var searchHints = buildHints(
data, data,
query.searchParams, query.searchParams,
query.minScore * _.keys(query.searchParams).length, query.minScore,
keyword, keyword,
query.searchRange, query.searchRange,
query.hintSteps query.hintSteps