41 #ifndef SHARK_MODELS_KERNELEXPANSION_H 42 #define SHARK_MODELS_KERNELEXPANSION_H 67 template<
class InputType>
103 {
return "KernelExpansion"; }
129 return m_b.size() != 0;
144 SHARK_CHECK(
hasOffset(),
"[KernelExpansion::offset] invalid call for object without offset term");
148 SHARK_CHECK(
hasOffset(),
"[KernelExpansion::offset] invalid call for object without offset term");
152 SHARK_CHECK(
hasOffset(),
"[KernelExpansion::offset] invalid call for object without offset term");
155 double const&
offset(std::size_t cls)
const{
156 SHARK_CHECK(
hasOffset(),
"[KernelExpansion::offset] invalid call for object without offset term");
177 std::vector<std::size_t> svIndices;
178 for (std::size_t i=0; i != ic; ++i){
180 svIndices.push_back(i);
188 for (std::size_t i=0; i!= svIndices.size(); ++i){
230 return boost::shared_ptr<State>(
new EmptyState());
234 void eval(BatchInputType
const& patterns, BatchOutputType& output)
const{
244 std::size_t batchStart = 0;
251 RealMatrix kernelEvaluations = (*mep_kernel)(
m_basis.
batch(i),patterns);
256 batchStart = batchEnd;
259 void eval(BatchInputType
const& patterns, BatchOutputType& outputs,
State & state)
const{
260 eval(patterns, outputs);
274 archive >> (*mep_kernel);
284 archive << const_cast<KernelType const&>(*mep_kernel);
311 template<
class InputType>
320 : base_type(KernelExpansionType(kernel))
323 : base_type(decisionFunction)
327 {
return "KernelClassifier"; }