The Loss function interface definition. More...
#include <loss.h>
Public Member Functions | |
| virtual Loss::UniquePtr | clone () const =0 |
| Perform a deep copy of the Loss and return a unique pointer to the copy. More... | |
| virtual void | deserialize (fuse_core::BinaryInputArchive &)=0 |
| Deserialize data from the provided binary archive into this Loss. More... | |
| virtual void | deserialize (fuse_core::TextInputArchive &)=0 |
| Deserialize data from the provided text archive into this Loss. More... | |
| FUSE_SMART_PTR_ALIASES_ONLY (Loss) | |
| virtual void | initialize (const std::string &name)=0 |
| Perform any required post-construction initialization, such as reading from the parameter server. More... | |
| Loss ()=default | |
| Default constructor. More... | |
| virtual ceres::LossFunction * | lossFunction () const =0 |
| Return a raw pointer to a ceres::LossFunction that implements the loss function. More... | |
| virtual void | print (std::ostream &stream=std::cout) const =0 |
| Print a human-readable description of the loss function to the provided stream. More... | |
| virtual void | serialize (fuse_core::BinaryOutputArchive &) const =0 |
| Serialize this Loss into the provided binary archive. More... | |
| virtual void | serialize (fuse_core::TextOutputArchive &) const =0 |
| Serialize this Loss into the provided text archive. More... | |
| virtual std::string | type () const =0 |
| Returns a unique name for this loss function type. More... | |
| virtual | ~Loss ()=default |
| Destructor. More... | |
Static Public Attributes | |
| static constexpr ceres::Ownership | Ownership |
| The ownership of the ceres::LossFunction* returned by lossFunction() More... | |
Private Member Functions | |
| template<class Archive > | |
| void | serialize (Archive &, const unsigned int) |
| The Boost Serialize method that serializes all of the data members in to/out of the archive. More... | |
Friends | |
| class | boost::serialization::access |
The Loss function interface definition.
This class encapsulates the ceres::LossFunction class, adding the ability to serialize it.
The attributes from all derived ceres::LossFunction classes are private, so we cannot serialize them directly. For that reason we need this fuse_core::Loss to provide additional functionality on top of them.
See http://ceres-solver.org/nnls_modeling.html#lossfunction for a detailed description about loss functions. Basically, a loss function defines the penalty associated with a specific amount error. By default, or if a NULL pointer is provided as the loss function, the penalty will be quadratic. This is the loss function associated with standard least-squares optimization. By providing a different loss function, the penalty for the constraint's error can be altered.
This is generally done to reduce the effect of outlier measurements that made it into the optimization problem. It is always better to remove outliers before they make it into the optimization problem, but no method is perfect. Using robust loss functions can significantly improve the results and stability of the solution in the presence of outlier measurements.
|
default |
Default constructor.
|
virtualdefault |
Destructor.
|
pure virtual |
|
pure virtual |
|
pure virtual |
| fuse_core::Loss::FUSE_SMART_PTR_ALIASES_ONLY | ( | Loss | ) |
|
pure virtual |
Perform any required post-construction initialization, such as reading from the parameter server.
This will be called on each plugin after construction.
| [in] | name | A unique name to initialize this plugin instance, such as from the parameter server. |
|
pure virtual |
Return a raw pointer to a ceres::LossFunction that implements the loss function.
The Ceres interface requires a raw pointer. Ceres will take ownership of the pointer and promises to properly delete the loss function when it is done. Additionally, Fuse promises that the Loss object will outlive any generated loss functions (i.e. the Ceres objects will be destroyed before the Loss Function objects). This guarantee may allow optimizations for the creation of the loss function objects.
|
pure virtual |
Print a human-readable description of the loss function to the provided stream.
| stream | The stream to write to. Defaults to stdout. |
|
inlineprivate |
|
pure virtual |
Serialize this Loss into the provided binary archive.
This can/should be implemented as follows in all derived classes:
| [out] | archive | - The archive to serialize this loss function into |
|
pure virtual |
Serialize this Loss into the provided text archive.
This can/should be implemented as follows in all derived classes:
| [out] | archive | - The archive to serialize this loss function into |
|
pure virtual |
Returns a unique name for this loss function type.
The loss function type string must be unique for each class. As such, the fully-qualified class name is an excellent choice for the type string.
|
staticconstexpr |
The ownership of the ceres::LossFunction* returned by lossFunction()