14 template <
class R,
void (*T)(R&,
float, u
int64_t),
class W>
21 template <
class R,
void (*T)(R&, const
float,
float&),
class W>
28 template <
class R,
void (*T)(R&, const
float, const
float&),
class W>
33 const weight& w = weights[(
f.index() + offset)];
34 T(dat, mult *
f.value(), w);
43 template <
class R,
class S,
void (*T)(R&,
float, S),
class W>
50 INTERACTIONS::generate_interactions<R, S, T, false, dummy_func<R>, W>(interactions, permutations, ec, dat, weights);
55 template <
class R,
class S,
void (*T)(R&,
float, S),
class W>
56 inline void foreach_feature(W& weights,
bool ignore_some_linear, std::array<bool, NUM_NAMESPACES>& ignore_linear,
57 std::vector<std::string>& interactions,
bool permutations,
example_predict& ec, R& dat)
60 if (ignore_some_linear)
63 if (!ignore_linear[i.index()])
66 foreach_feature<R, T, W>(weights,
f, dat, offset);
70 for (
features&
f : ec) foreach_feature<R, T, W>(weights,
f, dat, offset);
72 generate_interactions<R, S, T, W>(interactions, permutations, ec, dat, weights);
75 inline void vec_add(
float& p,
const float fx,
const float& fw) { p += fw * fx; }
78 inline float inline_predict(W& weights,
bool ignore_some_linear, std::array<bool, NUM_NAMESPACES>& ignore_linear,
79 std::vector<std::string>& interactions,
bool permutations,
example_predict& ec,
float initial = 0.
f)
81 foreach_feature<float, const float&, vec_add, W>(
82 weights, ignore_some_linear, ignore_linear, interactions, permutations, ec, initial);
the core definition of a set of features.
void dummy_func(R &, const audit_strings *)
float inline_predict(vw &all, example &ec)
void generate_interactions(std::vector< std::string > &interactions, bool permutations, example_predict &ec, R &dat, W &weights)
void vec_add(float &p, const float fx, const float &fw)
iterator over values and indicies
void foreach_feature(vw &all, features &fs, R &dat, uint64_t offset=0, float mult=1.)
std::pair< std::string, std::string > audit_strings