summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorLester Solbakken <lesters@oath.com>2018-06-15 09:25:19 +0200
committerLester Solbakken <lesters@oath.com>2018-06-15 09:25:19 +0200
commit28be51e5511dd4482c22d9a571b0df78063f2b67 (patch)
treed7e67ad2f8dc5fbdf78577ef2387fbc3cf6bcd0e /searchlib
parent9074c9d6db60c9d785f395354aea2284f22d5020 (diff)
Rename feature randomNormalMatch -> randomNormalStable
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/tests/features/prod_features.cpp30
-rw-r--r--searchlib/src/tests/features/prod_features.h2
-rw-r--r--searchlib/src/vespa/searchlib/features/CMakeLists.txt2
-rw-r--r--searchlib/src/vespa/searchlib/features/random_normal_stable_feature.cpp (renamed from searchlib/src/vespa/searchlib/features/random_normal_match_feature.cpp)28
-rw-r--r--searchlib/src/vespa/searchlib/features/random_normal_stable_feature.h (renamed from searchlib/src/vespa/searchlib/features/random_normal_match_feature.h)8
-rw-r--r--searchlib/src/vespa/searchlib/features/setup.cpp4
6 files changed, 37 insertions, 37 deletions
diff --git a/searchlib/src/tests/features/prod_features.cpp b/searchlib/src/tests/features/prod_features.cpp
index 214323ae7c7..0e57f520673 100644
--- a/searchlib/src/tests/features/prod_features.cpp
+++ b/searchlib/src/tests/features/prod_features.cpp
@@ -32,7 +32,7 @@ LOG_SETUP("prod_features_test");
#include <vespa/searchlib/features/querytermcountfeature.h>
#include <vespa/searchlib/features/randomfeature.h>
#include <vespa/searchlib/features/random_normal_feature.h>
-#include <vespa/searchlib/features/random_normal_match_feature.h>
+#include <vespa/searchlib/features/random_normal_stable_feature.h>
#include <vespa/searchlib/features/rankingexpressionfeature.h>
#include <vespa/searchlib/features/setup.h>
#include <vespa/searchlib/features/termfeature.h>
@@ -106,7 +106,7 @@ Test::Main()
TEST_DO(testQueryTermCount()); TEST_FLUSH();
TEST_DO(testRandom()); TEST_FLUSH();
TEST_DO(testRandomNormal()); TEST_FLUSH();
- TEST_DO(testRandomNormalMatch()); TEST_FLUSH();
+ TEST_DO(testRandomNormalStable()); TEST_FLUSH();
TEST_DO(testRankingExpression()); TEST_FLUSH();
TEST_DO(testTerm()); TEST_FLUSH();
TEST_DO(testTermDistance()); TEST_FLUSH();
@@ -1773,44 +1773,44 @@ Test::testRandomNormal() {
}
void
-Test::testRandomNormalMatch() {
+Test::testRandomNormalStable() {
{ // Test blueprint.
- RandomNormalMatchBlueprint pt;
+ RandomNormalStableBlueprint pt;
- EXPECT_TRUE(assertCreateInstance(pt, "randomNormalMatch"));
+ EXPECT_TRUE(assertCreateInstance(pt, "randomNormalStable"));
StringList params, in, out;
FT_SETUP_OK(pt, params, in, out.add("out"));
FT_SETUP_OK(pt, params.add("0.5").add("1.0"), in, out);
FT_SETUP_OK(pt, params.add("val1"), in, out);
- FT_DUMP_EMPTY(_factory, "randomNormalMatch");
+ FT_DUMP_EMPTY(_factory, "randomNormalStable");
}
{ // Test setting of mean and stddev values, and seed
- FtFeatureTest ft1(_factory, "randomNormalMatch(0.0,0.1)");
- FtFeatureTest ft2(_factory, "randomNormalMatch(1.0,0.2)");
- ft1.getIndexEnv().getProperties().add("randomNormalMatch(0.0,0.1).seed", "100");
- ft2.getIndexEnv().getProperties().add("randomNormalMatch(1.0,0.2).seed", "100");
+ FtFeatureTest ft1(_factory, "randomNormalStable(0.0,0.1)");
+ FtFeatureTest ft2(_factory, "randomNormalStable(1.0,0.2)");
+ ft1.getIndexEnv().getProperties().add("randomNormalStable(0.0,0.1).seed", "100");
+ ft2.getIndexEnv().getProperties().add("randomNormalStable(1.0,0.2).seed", "100");
ASSERT_TRUE(ft1.setup());
ASSERT_TRUE(ft2.setup());
RankResult rr;
for (uint32_t i = 0; i < 5; ++i) {
rr.clear();
ASSERT_TRUE(ft1.executeOnly(rr, i + 1));
- ASSERT_TRUE(ft2.execute(((rr.getScore("randomNormalMatch(0.0,0.1)") - 0.0) / 0.1) * 0.2 + 1.0, EPS, i + 1));
+ ASSERT_TRUE(ft2.execute(((rr.getScore("randomNormalStable(0.0,0.1)") - 0.0) / 0.1) * 0.2 + 1.0, EPS, i + 1));
}
}
- { // Test executor (randomNormal.match)
- FtFeatureTest ft1(_factory, "randomNormalMatch");
- FtFeatureTest ft2(_factory, "randomNormalMatch");
+ { // Test executor (randomNormalStable)
+ FtFeatureTest ft1(_factory, "randomNormalStable");
+ FtFeatureTest ft2(_factory, "randomNormalStable");
ASSERT_TRUE(ft1.setup());
ASSERT_TRUE(ft2.setup());
RankResult rr;
for (uint32_t i = 0; i < 5; ++i) {
rr.clear();
ASSERT_TRUE(ft1.executeOnly(rr, i + 1));
- ASSERT_TRUE(ft2.execute(rr.getScore("randomNormalMatch"), EPS, i + 1));
+ ASSERT_TRUE(ft2.execute(rr.getScore("randomNormalStable"), EPS, i + 1));
}
}
}
diff --git a/searchlib/src/tests/features/prod_features.h b/searchlib/src/tests/features/prod_features.h
index dec860917f0..d7bf001bedf 100644
--- a/searchlib/src/tests/features/prod_features.h
+++ b/searchlib/src/tests/features/prod_features.h
@@ -35,7 +35,7 @@ public:
void testQueryTermCount();
void testRandom();
void testRandomNormal();
- void testRandomNormalMatch();
+ void testRandomNormalStable();
void testRankingExpression();
void testTerm();
void testTermDistance();
diff --git a/searchlib/src/vespa/searchlib/features/CMakeLists.txt b/searchlib/src/vespa/searchlib/features/CMakeLists.txt
index 2b92b5ec443..16401a67424 100644
--- a/searchlib/src/vespa/searchlib/features/CMakeLists.txt
+++ b/searchlib/src/vespa/searchlib/features/CMakeLists.txt
@@ -44,7 +44,7 @@ vespa_add_library(searchlib_features OBJECT
queryterm.cpp
querytermcountfeature.cpp
random_normal_feature.cpp
- random_normal_match_feature.cpp
+ random_normal_stable_feature.cpp
randomfeature.cpp
rankingexpressionfeature.cpp
raw_score_feature.cpp
diff --git a/searchlib/src/vespa/searchlib/features/random_normal_match_feature.cpp b/searchlib/src/vespa/searchlib/features/random_normal_stable_feature.cpp
index 586835f6b9a..55b724285d6 100644
--- a/searchlib/src/vespa/searchlib/features/random_normal_match_feature.cpp
+++ b/searchlib/src/vespa/searchlib/features/random_normal_stable_feature.cpp
@@ -1,33 +1,33 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include "random_normal_match_feature.h"
+#include "random_normal_stable_feature.h"
#include "utils.h"
#include <vespa/searchlib/fef/properties.h>
#include <vespa/fastos/time.h>
#include <vespa/log/log.h>
-LOG_SETUP(".features.randomnormalmatchfeature");
+LOG_SETUP(".features.randomnormalstablefeature");
namespace search {
namespace features {
-RandomNormalMatchExecutor::RandomNormalMatchExecutor(uint64_t seed, double mean, double stddev) :
+RandomNormalStableExecutor::RandomNormalStableExecutor(uint64_t seed, double mean, double stddev) :
search::fef::FeatureExecutor(),
_rnd(mean, stddev, true),
_seed(seed)
{
- LOG(debug, "RandomNormalMatchExecutor: seed=%zu, mean=%f, stddev=%f", seed, mean, stddev);
+ LOG(debug, "RandomNormalStableExecutor: seed=%zu, mean=%f, stddev=%f", seed, mean, stddev);
}
void
-RandomNormalMatchExecutor::execute(uint32_t docId)
+RandomNormalStableExecutor::execute(uint32_t docId)
{
_rnd.seed(_seed + docId);
outputs().set_number(0, _rnd.next());
}
-RandomNormalMatchBlueprint::RandomNormalMatchBlueprint() :
- search::fef::Blueprint("randomNormalMatch"),
+RandomNormalStableBlueprint::RandomNormalStableBlueprint() :
+ search::fef::Blueprint("randomNormalStable"),
_seed(0),
_mean(0.0),
_stddev(1.0)
@@ -35,19 +35,19 @@ RandomNormalMatchBlueprint::RandomNormalMatchBlueprint() :
}
void
-RandomNormalMatchBlueprint::visitDumpFeatures(const search::fef::IIndexEnvironment &,
+RandomNormalStableBlueprint::visitDumpFeatures(const search::fef::IIndexEnvironment &,
search::fef::IDumpFeatureVisitor &) const
{
}
search::fef::Blueprint::UP
-RandomNormalMatchBlueprint::createInstance() const
+RandomNormalStableBlueprint::createInstance() const
{
- return search::fef::Blueprint::UP(new RandomNormalMatchBlueprint());
+ return search::fef::Blueprint::UP(new RandomNormalStableBlueprint());
}
bool
-RandomNormalMatchBlueprint::setup(const search::fef::IIndexEnvironment & env,
+RandomNormalStableBlueprint::setup(const search::fef::IIndexEnvironment & env,
const search::fef::ParameterList & params)
{
search::fef::Property p = env.getProperties().lookup(getName(), "seed");
@@ -61,17 +61,17 @@ RandomNormalMatchBlueprint::setup(const search::fef::IIndexEnvironment & env,
_stddev = params[1].asDouble();
}
- describeOutput("out" , "A random value drawn from the Gaussian distribution that is stable for a given match (document and query)");
+ describeOutput("out" , "A random value drawn from the Gaussian distribution that is stable for a given Stable (document and query)");
return true;
}
search::fef::FeatureExecutor &
-RandomNormalMatchBlueprint::createExecutor(const search::fef::IQueryEnvironment &env, vespalib::Stash &stash) const
+RandomNormalStableBlueprint::createExecutor(const search::fef::IQueryEnvironment &env, vespalib::Stash &stash) const
{
uint64_t seed = util::strToNum<uint64_t>
(env.getProperties().lookup(getName(), "seed").get("1024")); // default seed
- return stash.create<RandomNormalMatchExecutor>(seed, _mean, _stddev);
+ return stash.create<RandomNormalStableExecutor>(seed, _mean, _stddev);
}
diff --git a/searchlib/src/vespa/searchlib/features/random_normal_match_feature.h b/searchlib/src/vespa/searchlib/features/random_normal_stable_feature.h
index 66431a3a60c..e0b3232c5a1 100644
--- a/searchlib/src/vespa/searchlib/features/random_normal_match_feature.h
+++ b/searchlib/src/vespa/searchlib/features/random_normal_stable_feature.h
@@ -15,13 +15,13 @@ namespace features {
* two arguments 'mean' and 'stddev'.
* The same hit always returns the same random number.
**/
-class RandomNormalMatchExecutor : public fef::FeatureExecutor {
+class RandomNormalStableExecutor : public fef::FeatureExecutor {
private:
RandomNormal _rnd; // seeded once per match
uint64_t _seed;
public:
- RandomNormalMatchExecutor(uint64_t seed, double mean, double stddev);
+ RandomNormalStableExecutor(uint64_t seed, double mean, double stddev);
void execute(uint32_t docId) override;
};
@@ -29,14 +29,14 @@ public:
/**
* Implements the blueprint for the random normal feature.
*/
-class RandomNormalMatchBlueprint : public fef::Blueprint {
+class RandomNormalStableBlueprint : public fef::Blueprint {
private:
uint64_t _seed;
double _mean;
double _stddev;
public:
- RandomNormalMatchBlueprint();
+ RandomNormalStableBlueprint();
void visitDumpFeatures(const fef::IIndexEnvironment & env, fef::IDumpFeatureVisitor & visitor) const override;
fef::Blueprint::UP createInstance() const override;
diff --git a/searchlib/src/vespa/searchlib/features/setup.cpp b/searchlib/src/vespa/searchlib/features/setup.cpp
index c8e0ffb6f4a..1d3c59f5b3d 100644
--- a/searchlib/src/vespa/searchlib/features/setup.cpp
+++ b/searchlib/src/vespa/searchlib/features/setup.cpp
@@ -38,7 +38,7 @@
#include "querytermcountfeature.h"
#include "randomfeature.h"
#include "random_normal_feature.h"
-#include "random_normal_match_feature.h"
+#include "random_normal_stable_feature.h"
#include "rankingexpressionfeature.h"
#include "raw_score_feature.h"
#include "reverseproximityfeature.h"
@@ -101,7 +101,7 @@ void setup_search_features(fef::IBlueprintRegistry & registry)
registry.addPrototype(Blueprint::SP(new QueryTermCountBlueprint()));
registry.addPrototype(Blueprint::SP(new RandomBlueprint()));
registry.addPrototype(Blueprint::SP(new RandomNormalBlueprint()));
- registry.addPrototype(Blueprint::SP(new RandomNormalMatchBlueprint()));
+ registry.addPrototype(Blueprint::SP(new RandomNormalStableBlueprint()));
registry.addPrototype(Blueprint::SP(new RawScoreBlueprint()));
registry.addPrototype(Blueprint::SP(new SubqueriesBlueprint));
registry.addPrototype(Blueprint::SP(new TensorFromLabelsBlueprint()));