SG++-Doxygen-Documentation
|
FileSampleDecorator provides an interface to provide generic manipulations for various kinds of sgpp::datadriven::FileSampleProvider using the decorator pattern. More...
#include <FileSampleDecorator.hpp>
Public Member Functions | |
FileSampleDecorator (FileSampleProvider *const fileSampleProvider) | |
Constructor. More... | |
FileSampleDecorator (const FileSampleDecorator &rhs) | |
FileSampleDecorator (FileSampleDecorator &&rhs)=default | |
Dataset * | getAllSamples () override |
Asks to return all available samples. More... | |
size_t | getDim () const override |
Returns the maximal dimensionality of the data. More... | |
Dataset * | getNextSamples (size_t howMany) override |
Lets the user request a certain amount of samples. More... | |
size_t | getNumSamples () const override |
Returns the number of samples availible or throws if not possible. More... | |
FileSampleDecorator & | operator= (const FileSampleDecorator &rhs) |
FileSampleDecorator & | operator= (FileSampleDecorator &&rhs)=default |
void | readFile (const std::string &fileName, bool hasTargets, size_t readinCutoff=-1, std::vector< size_t > readinColumns=std::vector< size_t >(), std::vector< double > readinClasses=std::vector< double >()) override |
Reads a file's content from a file. More... | |
void | readString (const std::string &input, bool hasTargets, size_t readinCutoff=-1, std::vector< size_t > readinColumns=std::vector< size_t >(), std::vector< double > readinClasses=std::vector< double >()) override |
Reads a file's content. More... | |
~FileSampleDecorator ()=default | |
Public Member Functions inherited from sgpp::datadriven::SampleProvider | |
virtual SampleProvider * | clone () const =0 |
Clone pattern for polymorphic cloning (mainly interresting for copy constructors). More... | |
SampleProvider & | operator= (const SampleProvider &rhs)=default |
SampleProvider & | operator= (SampleProvider &&rhs)=default |
virtual void | reset ()=0 |
Resets the state of the sample provider (e.g. More... | |
SampleProvider ()=default | |
SampleProvider (const SampleProvider &rhs)=default | |
SampleProvider (SampleProvider &&rhs)=default | |
virtual | ~SampleProvider ()=default |
Protected Attributes | |
std::unique_ptr< FileSampleProvider > | fileSampleProvider |
Delegate sgpp::datadriven::FileSampleProvider object. More... | |
FileSampleDecorator provides an interface to provide generic manipulations for various kinds of sgpp::datadriven::FileSampleProvider using the decorator pattern.
Using inheritance and deligation we can manipulate input or output of sgpp::datadriven::FileSampleProvider member functions in a generic fashion e.g. apply decompression of compressed files before passing them to the actual sgpp::datadriven::FileSampleProvider without limiting ourselves to a specific implementation. Instead we use the decorated object's member functions as a black box.
|
explicit |
Constructor.
fileSampleProvider | Pointer to a sgpp::datadriven::FileSampleProvider that will be wrapped as a deligate. The decorator will take ownership of this object and take care of its destruction. |
References fileSampleProvider.
sgpp::datadriven::FileSampleDecorator::FileSampleDecorator | ( | const FileSampleDecorator & | rhs | ) |
References fileSampleProvider.
|
default |
|
default |
|
overridevirtual |
Asks to return all available samples.
This functionality is designed for returning all available samples from an entire file.
Implements sgpp::datadriven::SampleProvider.
References fileSampleProvider.
|
overridevirtual |
Returns the maximal dimensionality of the data.
Implements sgpp::datadriven::SampleProvider.
References fileSampleProvider.
Referenced by python.uq.dists.SGDEdist.SGDEdist::__str__(), and python.uq.dists.KDEDist.KDEDist::getBandwidths().
|
overridevirtual |
Lets the user request a certain amount of samples.
This functionality is is designed for streaming algorithms where data is processed in batches.
howMany | number requested amount of samples. The amount of actually provided samples can be smaller, if there is not sufficient data. |
Implements sgpp::datadriven::SampleProvider.
References fileSampleProvider.
|
overridevirtual |
Returns the number of samples availible or throws if not possible.
Implements sgpp::datadriven::SampleProvider.
References fileSampleProvider.
FileSampleDecorator & sgpp::datadriven::FileSampleDecorator::operator= | ( | const FileSampleDecorator & | rhs | ) |
References fileSampleProvider.
|
default |
|
overridevirtual |
Reads a file's content from a file.
fileName | path to the file |
hasTargets | whether the file has targets (i.e. supervised learning) |
readinCutoff | see FileSampleProvider.hpp |
readinColumns | see FileSampleProvider.hpp |
readinClasses | see FileSampleProvider.hpp |
Implements sgpp::datadriven::FileSampleProvider.
References fileSampleProvider.
|
overridevirtual |
Reads a file's content.
input | the file's content |
hasTargets | whether the file has targets (i.e. supervised learning) |
readinCutoff | see FileSampleProvider.hpp |
readinColumns | see FileSampleProvider.hpp |
readinClasses | see FileSampleProvider.hpp |
Implements sgpp::datadriven::FileSampleProvider.
References fileSampleProvider.
|
protected |
Delegate sgpp::datadriven::FileSampleProvider object.
Calls to the object will be wrapped by the decorator performing pre-processing or post-processing to member functions which will be used by the decorator as a black box, passing through calls which are not overridden.
Referenced by FileSampleDecorator(), getAllSamples(), getDim(), getNextSamples(), getNumSamples(), operator=(), readFile(), and readString().