Shark machine learning library
About Shark
News!
Contribute
Credits and copyright
Downloads
Getting Started
Installation
Using the docs
Documentation
Tutorials
Class list
Global functions
FAQ
Showroom
Main Page
Related Pages
Modules
Classes
include
shark
Core
IParameterizable.h
Go to the documentation of this file.
1
//===========================================================================
2
/*!
3
* \file IParameterizable.h
4
*
5
* \brief IParameterizable interface
6
*
7
* \author T. Glasmachers
8
* \date 2010-2011
9
*
10
* \par Copyright (c) 1998-2007:
11
* Institut für Neuroinformatik<BR>
12
* Ruhr-Universität Bochum<BR>
13
* D-44780 Bochum, Germany<BR>
14
* Phone: +49-234-32-25558<BR>
15
* Fax: +49-234-32-14209<BR>
16
* eMail: Shark-admin@neuroinformatik.ruhr-uni-bochum.de<BR>
17
* www: http://www.neuroinformatik.ruhr-uni-bochum.de<BR>
18
* <BR>
19
*
20
*
21
* <BR><HR>
22
* This file is part of Shark. This library is free software;
23
* you can redistribute it and/or modify it under the terms of the
24
* GNU General Public License as published by the Free Software
25
* Foundation; either version 3, or (at your option) any later version.
26
*
27
* This library is distributed in the hope that it will be useful,
28
* but WITHOUT ANY WARRANTY; without even the implied warranty of
29
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30
* GNU General Public License for more details.
31
*
32
* You should have received a copy of the GNU General Public License
33
* along with this library; if not, see <http://www.gnu.org/licenses/>.
34
*
35
*/
36
//===========================================================================
37
38
#ifndef SHARK_CORE_IPARAMETERIZABLE_H
39
#define SHARK_CORE_IPARAMETERIZABLE_H
40
41
42
#include <
shark/LinAlg/Base.h
>
43
44
45
namespace
shark {
46
47
/// \brief Top level interface for everything that holds parameters.
48
///
49
/// This interface is inherited by AbstractModel for unified
50
/// access to the parameters of models, but also by objective
51
/// functions and algorithms with hyper-parameters.
52
class
IParameterizable
{
53
public
:
54
virtual
~IParameterizable
() { }
55
56
/// Return the parameter vector.
57
virtual
RealVector
parameterVector
()
const
58
{
59
return
RealVector();
60
}
61
62
/// Set the parameter vector.
63
virtual
void
setParameterVector
(RealVector
const
& newParameters)
64
{
65
SHARK_ASSERT
(newParameters.size() == 0);
66
}
67
68
/// Return the number of parameters.
69
virtual
std::size_t
numberOfParameters
()
const
{
70
return
parameterVector
().size();
71
}
72
};
73
74
75
}
76
#endif