shark_globals

Several mathematical, linear-algebra, or other functions within Shark are not part of any particular class. They are collected here in the doxygen group "shark_globals". More...

Namespaces

 shark
 AbstractMultiObjectiveOptimizer.
 

Classes

class  shark::Multiply
 Transformation function multiplying the elements in a dataset by a scalar or component-wise by values stores in a vector. More...
 
class  shark::Divide
 Transformation function dividing the elements in a dataset by a scalar or component-wise by values stores in a vector. More...
 
class  shark::Shift
 Transformation function adding a vector or a scalar to the elements in a dataset. More...
 
class  shark::Truncate
 Transformation function truncating elements in a dataset. More...
 
class  shark::TruncateAndRescale
 Transformation function first truncating and then rescaling elements in a dataset. More...
 
class  shark::blas::Blocking< Matrix >
 partitions the matrix in 4 blocks defined by one splitting point (i,j). More...
 

Typedefs

typedef detail::SharedContainer< Type > shark::Data< Type >::Container
 
typedef batch_type & shark::Data< Type >::batch_reference
 
typedef batch_type const & shark::Data< Type >::const_batch_reference
 
typedef Batch< element_type >::reference shark::Data< Type >::element_reference
 
typedef Batch< element_type >::const_reference shark::Data< Type >::const_element_reference
 
typedef std::vector< std::size_t > shark::Data< Type >::IndexSet
 
typedef boost::iterator_range< typename Container::element_iterator > shark::Data< Type >::element_range
 
typedef boost::iterator_range< typename Container::const_element_iterator > shark::Data< Type >::const_element_range
 
typedef boost::iterator_range< typename Container::iterator > shark::Data< Type >::batch_range
 
typedef boost::iterator_range< typename Container::const_iterator > shark::Data< Type >::const_batch_range
 
typedef element_type shark::UnlabeledData< InputT >::InputType
 
typedef detail::SharedContainer< InputT > shark::UnlabeledData< InputT >::InputContainer
 
typedef InputT shark::LabeledData< InputT, LabelT >::InputType
 
typedef LabelT shark::LabeledData< InputT, LabelT >::LabelType
 
typedef UnlabeledData< InputT > shark::LabeledData< InputT, LabelT >::InputContainer
 
typedef Data< LabelT > shark::LabeledData< InputT, LabelT >::LabelContainer
 
typedef InputContainer::IndexSet shark::LabeledData< InputT, LabelT >::IndexSet
 
typedef PairRangeType< element_type, typename InputContainer::element_range, typename LabelContainer::element_range >::type shark::LabeledData< InputT, LabelT >::element_range
 
typedef PairRangeType< element_type, typename InputContainer::const_element_range, typename LabelContainer::const_element_range >::type shark::LabeledData< InputT, LabelT >::const_element_range
 
typedef PairRangeType< batch_type, typename InputContainer::batch_range, typename LabelContainer::batch_range >::type shark::LabeledData< InputT, LabelT >::batch_range
 
typedef PairRangeType< batch_type, typename InputContainer::const_batch_range, typename LabelContainer::const_batch_range >::type shark::LabeledData< InputT, LabelT >::const_batch_range
 
typedef boost::range_reference< batch_range >::type shark::LabeledData< InputT, LabelT >::batch_reference
 
typedef boost::range_reference< const_batch_range >::type shark::LabeledData< InputT, LabelT >::const_batch_reference
 
typedef boost::range_reference< element_range >::type shark::LabeledData< InputT, LabelT >::element_reference
 
typedef boost::range_reference< const_element_range >::type shark::LabeledData< InputT, LabelT >::const_element_reference
 

Functions

template<class T >
shark::maxExpInput ()
 Maximum allowed input value for exp. More...
 
template<class T >
shark::minExpInput ()
 Minimum value for exp(x) allowed so that it is not 0. More...
 
template<class T >
boost::enable_if< boost::is_arithmetic< T >, T >::type shark::sqr (const T &x)
 Calculates x^2. More...
 
template<class T >
shark::cube (const T &x)
 Calculates x^3. More...
 
template<class T >
boost::enable_if< boost::is_arithmetic< T >, T >::type shark::sigmoid (T x)
 Logistic function/logistic function. More...
 
template<class T >
shark::safeExp (T x)
 Thresholded exp function, over- and underflow safe. More...
 
template<class T >
shark::safeLog (T x)
 Thresholded log function, over- and underflow safe. More...
 
template<class T >
boost::enable_if< boost::is_arithmetic< T >, T >::type shark::softPlus (T x)
 Numerically stable version of the function log(1+exp(x)). More...
 
double shark::softPlus (double x)
 Numerically stable version of the function log(1+exp(x)). calculated with float precision to save some time. More...
 
template<class T >
shark::copySign (T x, T y)
 
double shark::trigamma (double x)
 Calculates the trigamma function -the derivative of the digamma function. More...
 
double shark::tetragamma (double x)
 Calculates the tetragamma function - the derivative of the trigamma function. More...
 
 shark::Data< Type >::BOOST_STATIC_CONSTANT (std::size_t, DefaultBatchSize=256)
 Defines the default batch size of the Container. More...
 
const_element_range shark::Data< Type >::elements () const
 Returns the range of elements. More...
 
element_range shark::Data< Type >::elements ()
 Returns therange of elements. More...
 
const_batch_range shark::Data< Type >::batches () const
 Returns the range of batches. More...
 
batch_range shark::Data< Type >::batches ()
 Returns the range of batches. More...
 
std::size_t shark::Data< Type >::numberOfBatches () const
 Returns the number of batches of the set. More...
 
std::size_t shark::Data< Type >::numberOfElements () const
 Returns the total number of elements. More...
 
bool shark::Data< Type >::empty () const
 Check whether the set is empty. More...
 
element_reference shark::Data< Type >::element (std::size_t i)
 
const_element_reference shark::Data< Type >::element (std::size_t i) const
 
batch_reference shark::Data< Type >::batch (std::size_t i)
 
const_batch_reference shark::Data< Type >::batch (std::size_t i) const
 
 shark::Data< Type >::Data ()
 Constructor which constructs an empty set. More...
 
 shark::Data< Type >::Data (std::size_t numBatches)
 Construct a dataset with empty batches. More...
 
 shark::Data< Type >::Data (Data const &container, std::vector< std::size_t > batchSizes)
 Construct a dataset with different batch sizes as a copy of another dataset. More...
 
 shark::Data< Type >::Data (std::size_t size, element_type const &element, std::size_t batchSize=DefaultBatchSize)
 Construction with size and a single element. More...
 
void shark::Data< Type >::read (InArchive &archive)
 Read the component from the supplied archive. More...
 
void shark::Data< Type >::write (OutArchive &archive) const
 Write the component to the supplied archive. More...
 
virtual void shark::Data< Type >::makeIndependent ()
 This method makes the vector independent of all siblings and parents. More...
 
void shark::Data< Type >::splitBatch (std::size_t batch, std::size_t elementIndex)
 
self_type shark::Data< Type >::splice (std::size_t batch)
 Splits the container into two independent parts. The front part remains in the container, the back part is returned. More...
 
void shark::Data< Type >::append (self_type const &other)
 Appends the contents of another data object to the end. More...
 
void shark::Data< Type >::push_back (const_batch_reference batch)
 
template<class Range >
void shark::Data< Type >::repartition (Range const &batchSizes)
 Reorders the batch structure in the container to that indicated by the batchSizes vector. More...
 
std::vector< std::size_t > shark::Data< Type >::getPartitioning () const
 Creates a vector with the batch sizes of every batch. More...
 
void shark::Data< Type >::indexedSubset (IndexSet const &indices, self_type &subset) const
 Fill in the subset defined by the list of indices. More...
 
void shark::Data< Type >::indexedSubset (IndexSet const &indices, self_type &subset, self_type &complement) const
 Fill in the subset defined by the list of indices as well as its complement. More...
 
 shark::UnlabeledData< InputT >::UnlabeledData ()
 Constructor. More...
 
 shark::UnlabeledData< InputT >::UnlabeledData (Data< InputT > const &points)
 Construction from data. More...
 
 shark::UnlabeledData< InputT >::UnlabeledData (std::size_t size, element_type const &element, std::size_t batchSize=base_type::DefaultBatchSize)
 Construction with size and a single element. More...
 
 shark::UnlabeledData< InputT >::UnlabeledData (std::size_t numBatches)
 Create an empty set with just the correct number of batches. More...
 
 shark::UnlabeledData< InputT >::UnlabeledData (UnlabeledData const &container, std::vector< std::size_t > batchSizes)
 Construct a dataset with different batch sizes. it is a copy of the other dataset. More...
 
self_type shark::UnlabeledData< InputT >::operator= (Data< InputT > const &data)
 we allow assignment from Data. More...
 
self_typeshark::UnlabeledData< InputT >::inputs ()
 Access to the base_type class as "inputs". More...
 
self_type const & shark::UnlabeledData< InputT >::inputs () const
 Access to the base_type class as "inputs". More...
 
self_type shark::UnlabeledData< InputT >::splice (std::size_t batch)
 Splits the container in two independent parts. The left part remains in the container, the right is stored as return type. More...
 
virtual void shark::UnlabeledData< InputT >::shuffle ()
 shuffles all elements in the entire dataset (that is, also across the batches) More...
 
 shark::LabeledData< InputT, LabelT >::BOOST_STATIC_CONSTANT (std::size_t, DefaultBatchSize=InputContainer::DefaultBatchSize)
 
const_element_range shark::LabeledData< InputT, LabelT >::elements () const
 Returns the range of elements. More...
 
element_range shark::LabeledData< InputT, LabelT >::elements ()
 Returns therange of elements. More...
 
const_batch_range shark::LabeledData< InputT, LabelT >::batches () const
 Returns the range of batches. More...
 
batch_range shark::LabeledData< InputT, LabelT >::batches ()
 Returns the range of batches. More...
 
std::size_t shark::LabeledData< InputT, LabelT >::numberOfBatches () const
 Returns the number of batches of the set. More...
 
std::size_t shark::LabeledData< InputT, LabelT >::numberOfElements () const
 Returns the total number of elements. More...
 
bool shark::LabeledData< InputT, LabelT >::empty () const
 Check whether the set is empty. More...
 
InputContainer const & shark::LabeledData< InputT, LabelT >::inputs () const
 Access to inputs as a separate container. More...
 
InputContainershark::LabeledData< InputT, LabelT >::inputs ()
 Access to inputs as a separate container. More...
 
LabelContainer const & shark::LabeledData< InputT, LabelT >::labels () const
 Access to labels as a separate container. More...
 
LabelContainershark::LabeledData< InputT, LabelT >::labels ()
 Access to labels as a separate container. More...
 
 shark::LabeledData< InputT, LabelT >::LabeledData ()
 Empty data set. More...
 
 shark::LabeledData< InputT, LabelT >::LabeledData (std::size_t numBatches)
 Create an empty set with just the correct number of batches. More...
 
 shark::LabeledData< InputT, LabelT >::LabeledData (std::size_t size, element_type const &element, std::size_t batchSize=DefaultBatchSize)
 
 shark::LabeledData< InputT, LabelT >::LabeledData (Data< InputType > const &inputs, Data< LabelType > const &labels)
 Construction from data. More...
 
element_reference shark::LabeledData< InputT, LabelT >::element (std::size_t i)
 
const_element_reference shark::LabeledData< InputT, LabelT >::element (std::size_t i) const
 
batch_reference shark::LabeledData< InputT, LabelT >::batch (std::size_t i)
 
const_batch_reference shark::LabeledData< InputT, LabelT >::batch (std::size_t i) const
 
void shark::LabeledData< InputT, LabelT >::read (InArchive &archive)
 from ISerializable More...
 
void shark::LabeledData< InputT, LabelT >::write (OutArchive &archive) const
 from ISerializable More...
 
virtual void shark::LabeledData< InputT, LabelT >::makeIndependent ()
 This method makes the vector independent of all siblings and parents. More...
 
virtual void shark::LabeledData< InputT, LabelT >::shuffle ()
 shuffles all elements in the entire dataset (that is, also across the batches) More...
 
void shark::LabeledData< InputT, LabelT >::splitBatch (std::size_t batch, std::size_t elementIndex)
 
self_type shark::LabeledData< InputT, LabelT >::splice (std::size_t batch)
 Splits the container into two independent parts. The left part remains in the container, the right is stored as return type. More...
 
void shark::LabeledData< InputT, LabelT >::append (self_type const &other)
 Appends the contents of another data object to the end. More...
 
void shark::LabeledData< InputT, LabelT >::push_back (typename Batch< InputType >::type const &inputs, typename Batch< LabelType >::type const &labels)
 
void shark::LabeledData< InputT, LabelT >::push_back (const_batch_reference batch)
 
template<class Range >
void shark::LabeledData< InputT, LabelT >::repartition (Range const &batchSizes)
 Reorders the batch structure in the container to that indicated by the batchSizes vector. More...
 
std::vector< std::size_t > shark::LabeledData< InputT, LabelT >::getPartitioning () const
 Creates a vector with the batch sizes of every batch. More...
 
void shark::LabeledData< InputT, LabelT >::indexedSubset (IndexSet const &indices, self_type &subset) const
 Fill in the subset defined by the list of indices. More...
 
void shark::LabeledData< InputT, LabelT >::indexedSubset (IndexSet const &indices, self_type &subset, self_type &complement) const
 Fill in the subset defined by the list of indices as well as its complement. More...
 
template<class Range >
Data< typename boost::range_value< Range >::type > shark::createDataFromRange (Range const &inputs, std::size_t maximumBatchSize=0)
 creates a data object from a range of elements More...
 
template<class Range >
UnlabeledData< typename boost::range_value< Range >::type > shark::createUnlabeledDataFromRange (Range const &inputs, std::size_t maximumBatchSize=0)
 creates a data object from a range of elements More...
 
template<class Range1 , class Range2 >
LabeledData< typename boost::range_value< Range1 >::type, typename boost::range_value< Range2 >::type > shark::createLabeledDataFromRange (Range1 const &inputs, Range2 const &labels, std::size_t batchSize=0)
 creates a labeled data object from two ranges, representing inputs and labels More...
 
template<class T , class U >
std::ostream & shark::operator<< (std::ostream &stream, const LabeledData< T, U > &d)
 brief Outstream of elements for labeled data. More...
 
unsigned int shark::numberOfClasses (Data< unsigned int > const &labels)
 Return the number of classes of a set of class labels with unsigned int label encoding. More...
 
std::vector< std::size_t > shark::classSizes (Data< unsigned int > const &labels)
 Returns the number of members of each class in the dataset. More...
 
template<class InputType >
std::size_t shark::dataDimension (Data< InputType > const &dataset)
 Return the dimensionality of a dataset. More...
 
template<class InputType , class LabelType >
std::size_t shark::inputDimension (LabeledData< InputType, LabelType > const &dataset)
 Return the input dimensionality of a labeled dataset. More...
 
template<class InputType , class LabelType >
std::size_t shark::labelDimension (LabeledData< InputType, LabelType > const &dataset)
 Return the label/output dimensionality of a labeled dataset. More...
 
template<class InputType >
std::size_t shark::numberOfClasses (LabeledData< InputType, unsigned int > const &dataset)
 Return the number of classes (highest label value +1) of a classification dataset with unsigned int label encoding. More...
 
template<class InputType , class LabelType >
std::vector< std::size_t > shark::classSizes (LabeledData< InputType, LabelType > const &dataset)
 Returns the number of members of each class in the dataset. More...
 
template<class DatasetT >
DatasetT shark::indexedSubset (DatasetT const &dataset, typename DatasetT::IndexSet const &indices)
 
template<class DatasetT >
DatasetT shark::rangeSubset (DatasetT const &dataset, std::size_t start, std::size_t end)
 Fill in the subset of batches [start,...,size+start[. More...
 
template<class DatasetT >
DatasetT shark::rangeSubset (DatasetT const &dataset, std::size_t size)
 Fill in the subset of batches [0,...,size[. More...
 
template<class T , class Functor >
boost::lazy_disable_if< CanBeCalled< Functor, typename Data< T >::batch_type >, TransformedData< Functor, T >>::type shark::transform (Data< T > const &data, Functor f)
 Transforms a dataset using a Functor f and returns the transformed result. More...
 
template<class T , class Functor >
boost::lazy_enable_if< CanBeCalled< Functor, typename Data< T >::batch_type >, TransformedData< Functor, T >>::type shark::transform (Data< T > const &data, Functor const &f)
 Transforms a dataset using a Functor f and returns the transformed result. More...
 
template<class I , class L , class Functor >
LabeledData< typename detail::TransformedDataElement< Functor, I >::type, L > shark::transformInputs (LabeledData< I, L > const &data, Functor const &f)
 Transforms the inputs of a dataset and return the transformed result. More...
 
template<class I , class L , class Functor >
LabeledData< I, typename detail::TransformedDataElement< Functor, L >::type > shark::transformLabels (LabeledData< I, L > const &data, Functor const &f)
 Transforms the labels of a dataset and returns the transformed result. More...
 
template<class FeatureSet >
Data< RealVector > shark::selectFeatures (Data< RealVector > const &data, FeatureSet const &features)
 Creates a copy o a dataset selecting only a certain set of features. More...
 
template<class T , class FeatureSet >
LabeledData< RealVector, T > shark::selectInputFeatures (LabeledData< RealVector, T > const &data, FeatureSet const &features)
 
template<class DatasetT >
DatasetT shark::splitAtElement (DatasetT &data, std::size_t elementIndex)
 Removes the last part of a given dataset and returns a new split containing the removed elements. More...
 
template<class I >
void shark::repartitionByClass (LabeledData< I, unsigned int > &data, std::size_t batchSize=LabeledData< I, unsigned int >::DefaultBatchSize)
 reorders the dataset such, that points are grouped by labels More...
 
template<class I >
LabeledData< I, unsigned int > shark::binarySubProblem (LabeledData< I, unsigned int >const &data, unsigned int zeroClass, unsigned int oneClass)
 
template<class I >
LabeledData< I, unsigned int > shark::oneVersusRestProblem (LabeledData< I, unsigned int >const &data, unsigned int oneClass)
 Construct a binary (two-class) one-versus-rest problem from a multi-class problem. More...
 
 shark::Multiply::Multiply (double factor)
 
 shark::Multiply::Multiply (const RealVector factor)
 
RealVector shark::Multiply::operator() (RealVector input) const
 
 shark::Divide::Divide (double factor)
 
 shark::Divide::Divide (const RealVector factor)
 
RealVector shark::Divide::operator() (RealVector input) const
 
 shark::Shift::Shift (double offset)
 
 shark::Shift::Shift (const RealVector offset)
 
RealVector shark::Shift::operator() (RealVector input) const
 
 shark::Truncate::Truncate (double minValue, double maxValue)
 
 shark::Truncate::Truncate (const RealVector minv, const RealVector maxv)
 
RealVector shark::Truncate::operator() (RealVector input) const
 
 shark::TruncateAndRescale::TruncateAndRescale (double minCutValue, double maxCutValue, double minValue=0., double maxValue=1.)
 
 shark::TruncateAndRescale::TruncateAndRescale (const RealVector minv, const RealVector maxv, double minValue=0., double maxValue=1.)
 
RealVector shark::TruncateAndRescale::operator() (RealVector input) const
 
template<typename RowType >
RowType shark::getColumn (const Data< RowType > &data, std::size_t columnID)
 
template<typename RowType >
void shark::setColumn (Data< RowType > &data, std::size_t columnID, RowType newColumn)
 

Variables

static const double shark::SQRT_2_PI = boost::math::constants::root_two_pi<double>()
 Constant for sqrt( 2 * pi ). More...
 
Container shark::Data< Type >::m_data
 data More...
 
InputContainer shark::LabeledData< InputT, LabelT >::m_data
 
LabelContainer shark::LabeledData< InputT, LabelT >::m_label
 point data More...
 

Friends

template<class InputT , class LabelT >
class shark::Data< Type >::LabeledData
 
template<class T >
bool shark::Data< Type >::operator== (const Data< T > &op1, const Data< T > &op2)
 
void shark::Data< Type >::swap (Data &a, Data &b)
 
void shark::LabeledData< InputT, LabelT >::swap (LabeledData &a, LabeledData &b)
 
enum  shark::LabelPosition { shark::FIRST_COLUMN, shark::LAST_COLUMN }
 Position of the label in a CSV file. More...
 
SHARK_EXPORT_SYMBOL void shark::csvStringToData (Data< FloatVector > &data, std::string const &contents, char separator=',', char comment='#', std::size_t maximumBatchSize=Data< RealVector >::DefaultBatchSize)
 Import unlabeled vectors from a read-in character-separated value file. More...
 
SHARK_EXPORT_SYMBOL void shark::csvStringToData (Data< RealVector > &data, std::string const &contents, char separator=',', char comment='#', std::size_t maximumBatchSize=Data< RealVector >::DefaultBatchSize)
 Import unlabeled vectors from a read-in character-separated value file. More...
 
SHARK_EXPORT_SYMBOL void shark::csvStringToData (Data< unsigned int > &data, std::string const &contents, char separator=',', char comment='#', std::size_t maximumBatchSize=Data< unsigned int >::DefaultBatchSize)
 Import "csv" from string consisting only of a single unsigned int per row. More...
 
SHARK_EXPORT_SYMBOL void shark::csvStringToData (Data< int > &data, std::string const &contents, char separator=',', char comment='#', std::size_t maximumBatchSize=Data< int >::DefaultBatchSize)
 Import "csv" from string consisting only of a single int per row. More...
 
SHARK_EXPORT_SYMBOL void shark::csvStringToData (Data< float > &data, std::string const &contents, char separator=',', char comment='#', std::size_t maximumBatchSize=Data< double >::DefaultBatchSize)
 Import "csv" from string consisting only of a single double per row. More...
 
SHARK_EXPORT_SYMBOL void shark::csvStringToData (Data< double > &data, std::string const &contents, char separator=',', char comment='#', std::size_t maximumBatchSize=Data< double >::DefaultBatchSize)
 Import "csv" from string consisting only of a single double per row. More...
 
SHARK_EXPORT_SYMBOL void shark::csvStringToData (LabeledData< RealVector, unsigned int > &dataset, std::string const &contents, LabelPosition lp, char separator=',', char comment='#', std::size_t maximumBatchSize=LabeledData< RealVector, unsigned int >::DefaultBatchSize)
 Import labeled data from a character-separated value file. More...
 
SHARK_EXPORT_SYMBOL void shark::csvStringToData (LabeledData< FloatVector, unsigned int > &dataset, std::string const &contents, LabelPosition lp, char separator=',', char comment='#', std::size_t maximumBatchSize=LabeledData< RealVector, unsigned int >::DefaultBatchSize)
 Import labeled data from a character-separated value file. More...
 
SHARK_EXPORT_SYMBOL void shark::csvStringToData (LabeledData< RealVector, RealVector > &dataset, std::string const &contents, LabelPosition lp, std::size_t numberOfOutputs=1, char separator=',', char comment='#', std::size_t maximumBatchSize=LabeledData< RealVector, RealVector >::DefaultBatchSize)
 Import regression data from a read-in character-separated value file. More...
 
SHARK_EXPORT_SYMBOL void shark::csvStringToData (LabeledData< FloatVector, FloatVector > &dataset, std::string const &contents, LabelPosition lp, std::size_t numberOfOutputs=1, char separator=',', char comment='#', std::size_t maximumBatchSize=LabeledData< RealVector, RealVector >::DefaultBatchSize)
 Import regression data from a read-in character-separated value file. More...
 
template<class T >
void shark::importCSV (Data< T > &data, std::string fn, char separator=',', char comment='#', std::size_t maximumBatchSize=Data< T >::DefaultBatchSize, std::size_t titleLines=0)
 Import a Dataset from a csv file. More...
 
template<class T >
void shark::importCSV (LabeledData< blas::vector< T >, unsigned int > &data, std::string fn, LabelPosition lp, char separator=',', char comment='#', std::size_t maximumBatchSize=LabeledData< RealVector, unsigned int >::DefaultBatchSize)
 Import a labeled Dataset from a csv file. More...
 
template<class T >
void shark::importCSV (LabeledData< blas::vector< T >, blas::vector< T > > &data, std::string fn, LabelPosition lp, std::size_t numberOfOutputs=1, char separator=',', char comment='#', std::size_t maximumBatchSize=LabeledData< RealVector, RealVector >::DefaultBatchSize)
 Import a labeled Dataset from a csv file. More...
 
template<typename Type >
void shark::exportCSV (Data< Type > const &set, std::string fn, char separator=',', bool sci=true, unsigned int width=0)
 Format unlabeled data into a character-separated value file. More...
 
template<typename InputType , typename LabelType >
void shark::exportCSV (LabeledData< InputType, LabelType > const &dataset, std::string fn, LabelPosition lp, char separator=',', bool sci=true, unsigned int width=0)
 Format labeled data into a character-separated value file. More...
 
template<class I , class L >
CVFolds< LabeledData< I, L > > shark::createCVIID (LabeledData< I, L > &set, std::size_t numberOfPartitions, std::size_t batchSize=Data< I >::DefaultBatchSize)
 Create a partition for cross validation. More...
 
template<class I , class L >
CVFolds< LabeledData< I, L > > shark::createCVSameSize (LabeledData< I, L > &set, std::size_t numberOfPartitions, std::size_t batchSize=LabeledData< I, L >::DefaultBatchSize)
 Create a partition for cross validation. More...
 
template<class I >
CVFolds< LabeledData< I, unsigned int > > shark::createCVSameSizeBalanced (LabeledData< I, unsigned int > &set, std::size_t numberOfPartitions, std::size_t batchSize=Data< I >::DefaultBatchSize, RecreationIndices *cv_indices=NULL)
 Create a partition for cross validation. More...
 
template<class I , class L >
CVFolds< LabeledData< I, L > > shark::createCVBatch (LabeledData< I, L > const &set, std::size_t numberOfPartitions)
 Create a partition for cross validation without changing the dataset. More...
 
template<class I , class L >
CVFolds< LabeledData< I, L > > shark::createCVIndexed (LabeledData< I, L > &set, std::size_t numberOfPartitions, std::vector< std::size_t > indices, std::size_t batchSize=Data< I >::DefaultBatchSize)
 Create a partition for cross validation from indices. More...
 
template<class I , class L >
CVFolds< LabeledData< I, L > > shark::createCVFullyIndexed (LabeledData< I, L > &set, std::size_t numberOfPartitions, RecreationIndices indices, std::size_t batchSize=Data< I >::DefaultBatchSize)
 Create a partition for cross validation from indices for both ordering and partitioning. More...
 
template<class T >
std::ostream & shark::operator<< (std::ostream &stream, const Data< T > &d)
 Outstream of elements. More...
 
enum  shark::KernelMatrixNormalizationType {
  shark::NONE, shark::MULTIPLICATIVE_TRACE_ONE, shark::MULTIPLICATIVE_TRACE_N, shark::MULTIPLICATIVE_VARIANCE_ONE,
  shark::CENTER_ONLY, shark::CENTER_AND_MULTIPLICATIVE_TRACE_ONE
}
 
template<typename InputType , typename LabelType >
void shark::exportKernelMatrix (LabeledData< InputType, LabelType > const &dataset, AbstractKernelFunction< InputType > &kernel, std::ostream &out, KernelMatrixNormalizationType normalizer=NONE, bool scientific=false, unsigned int fieldwidth=0)
 Write a kernel Gram matrix to stream. More...
 
template<typename InputType , typename LabelType >
void shark::exportKernelMatrix (LabeledData< InputType, LabelType > const &dataset, AbstractKernelFunction< InputType > &kernel, std::string fn, KernelMatrixNormalizationType normalizer=NONE, bool sci=false, unsigned int width=0)
 Write a kernel Gram matrix to file. More...
 
template<typename InputType , typename LabelType >
void shark::export_kernel_matrix (LabeledData< InputType, LabelType > const &dataset, AbstractKernelFunction< InputType > &kernel, std::ostream &out, KernelMatrixNormalizationType normalizer=NONE, bool scientific=false, unsigned int fieldwidth=0)
 
template<typename InputType , typename LabelType >
void shark::export_kernel_matrix (LabeledData< InputType, LabelType > const &dataset, AbstractKernelFunction< InputType > &kernel, std::string fn, KernelMatrixNormalizationType normalizer=NONE, bool sci=false, unsigned int width=0)
 
void shark::import_libsvm (LabeledData< RealVector, unsigned int > &dataset, std::istream &stream, unsigned int highestIndex=0, std::size_t batchSize=LabeledData< RealVector, unsigned int >::DefaultBatchSize)
 Import data from a LIBSVM file. More...
 
void shark::import_libsvm (LabeledData< CompressedRealVector, unsigned int > &dataset, std::istream &stream, unsigned int highestIndex=0, std::size_t batchSize=LabeledData< RealVector, unsigned int >::DefaultBatchSize)
 Import data from a LIBSVM file. More...
 
void shark::import_libsvm (LabeledData< RealVector, unsigned int > &dataset, std::string fn, unsigned int highestIndex=0, std::size_t batchSize=LabeledData< RealVector, unsigned int >::DefaultBatchSize)
 Import data from a LIBSVM file. More...
 
void shark::import_libsvm (LabeledData< CompressedRealVector, unsigned int > &dataset, std::string fn, unsigned int highestIndex=0, std::size_t batchSize=LabeledData< RealVector, unsigned int >::DefaultBatchSize)
 Import data from a LIBSVM file. More...
 
template<typename InputType >
void shark::export_libsvm (LabeledData< InputType, unsigned int > &dataset, const std::string &fn, bool dense=false, bool oneMinusOne=true, bool sortLabels=false, bool append=false)
 Export data to LIBSVM format. More...
 
SHARK_EXPORT_SYMBOL void shark::importSparseData (LabeledData< RealVector, unsigned int > &dataset, std::istream &stream, unsigned int highestIndex=0, std::size_t batchSize=LabeledData< RealVector, unsigned int >::DefaultBatchSize)
 Import data from a sparse data (libSVM) file. More...
 
SHARK_EXPORT_SYMBOL void shark::importSparseData (LabeledData< CompressedRealVector, unsigned int > &dataset, std::istream &stream, unsigned int highestIndex=0, std::size_t batchSize=LabeledData< RealVector, unsigned int >::DefaultBatchSize)
 Import data from a sparse data (libSVM) file. More...
 
SHARK_EXPORT_SYMBOL void shark::importSparseData (LabeledData< RealVector, unsigned int > &dataset, std::string fn, unsigned int highestIndex=0, std::size_t batchSize=LabeledData< RealVector, unsigned int >::DefaultBatchSize)
 Import data from a sparse data (libSVM) file. More...
 
SHARK_EXPORT_SYMBOL void shark::importSparseData (LabeledData< CompressedRealVector, unsigned int > &dataset, std::string fn, unsigned int highestIndex=0, std::size_t batchSize=LabeledData< RealVector, unsigned int >::DefaultBatchSize)
 Import data from a sparse data (libSVM) file. More...
 
template<typename InputType >
void shark::exportSparseData (LabeledData< InputType, unsigned int > &dataset, const std::string &fn, bool dense=false, bool oneMinusOne=true, bool sortLabels=false, bool append=false)
 Export data to sparse data (libSVM) format. More...
 
template<class MatrixT , class MatrixL >
void shark::blas::choleskyDecomposition (matrix_expression< MatrixT > const &A, matrix_expression< MatrixL > &L)
 Lower triangular Cholesky decomposition. More...
 
template<class Matrix , class Vector >
void shark::blas::choleskyUpdate (matrix_expression< Matrix > &L, vector_expression< Vector > const &v, double alpha, double beta)
 Updates a covariance factor by a rank one update. More...
 
template<class MatrixL >
std::size_t shark::blas::pivotingCholeskyDecompositionInPlace (shark::blas::matrix_expression< MatrixL > &Lref, PermutationMatrix &P)
 Lower triangular Cholesky decomposition with full pivoting performed in place. More...
 
template<class MatrixA , class MatrixL >
std::size_t shark::blas::pivotingCholeskyDecomposition (matrix_expression< MatrixA > const &A, PermutationMatrix &P, matrix_expression< MatrixL > &L)
 Lower triangular Cholesky decomposition with full pivoting. More...
 
template<class MatrixT , class MatrixU , class VectorT >
void shark::blas::eigensymm (matrix_expression< MatrixT > const &A, matrix_expression< MatrixU > &eigenVectors, vector_expression< VectorT > &eigenValues)
 Used as frontend for eigensymm for calculating the eigenvalues and the normalized eigenvectors of a symmetric matrix 'A' using the Givens and Householder reduction. Each time this frontend is called additional memory is allocated for intermediate results. More...
 
template<class Source >
detail::ADLVector< Source & > shark::blas::init (vector_container< Source > &source)
 Starting-point for the initialization sequence. More...
 
template<class Source >
detail::ADLVector< const Source & > shark::blas::init (const vector_container< Source > &source)
 Starting-point for the initialization sequence. More...
 
template<class Source >
detail::ADLVector< vector_range< Source > > shark::blas::init (const vector_range< Source > &source)
 Starting-point for the initialization sequence when used for splitting the vector. More...
 
template<class Source >
detail::ADLVector< matrix_row< Source > > shark::blas::init (const matrix_row< Source > &source)
 Specialization for matrix rows. More...
 
template<class Matrix >
detail::MatrixExpression< const Matrix > shark::blas::toVector (const matrix_expression< Matrix > &matrix)
 Linearizes a matrix as a set of row vectors and treats them as a set of vectors for initialization. More...
 
template<class Matrix >
detail::MatrixExpression< Matrix > shark::blas::toVector (matrix_expression< Matrix > &matrix)
 Linearizes a matrix as a set of row vectors and treats them as a set of vectors for initialization. More...
 
template<class T >
detail::ParameterizableExpression< const T > shark::blas::parameters (const T &object)
 Uses the parameters of a parameterizable object for initialization. More...
 
template<class T >
detail::ParameterizableExpression< T > shark::blas::parameters (T &object)
 Uses the parameters of a parameterizable object for initialization. More...
 
template<class T >
detail::InitializerRange< typename T::const_iterator, detail::VectorExpression< const typename T::value_type & > > shark::blas::vectorSet (const T &range)
 Uses a range of vectors for initialization. More...
 
template<class T >
detail::InitializerRange< typename T::iterator, detail::VectorExpression< typename T::value_type & > > shark::blas::vectorSet (T &range)
 Uses a range of vectors for splitting and initialization. More...
 
template<class T >
detail::InitializerRange< typename T::const_iterator, detail::MatrixExpression< const typename T::value_type > > shark::blas::matrixSet (const T &range)
 Uses a range of vectors for initialization. More...
 
template<class T >
detail::InitializerRange< typename T::iterator, detail::MatrixExpression< typename T::value_type > > shark::blas::matrixSet (T &range)
 Uses a range of vectors for splitting and initialization. More...
 
template<class T >
detail::InitializerRange< typename T::const_iterator, detail::ParameterizableExpression< const typename T::value_type > > shark::blas::parameterSet (const T &range)
 Uses a range of parametrizable objects for initialization. More...
 
template<class T >
detail::InitializerRange< typename T::iterator, detail::ParameterizableExpression< typename T::value_type > > shark::blas::parameterSet (T &range)
 Uses a range of parametrizable objects for splitting and initialization. More...
 
template<class VectorT , class VectorU , class WeightT >
VectorT::value_type shark::blas::diagonalMahalanobisDistanceSqr (vector_expression< VectorT > const &op1, vector_expression< VectorU > const &op2, vector_expression< WeightT > const &weights)
 Normalized Euclidian squared distance (squared diagonal Mahalanobis) between two vectors. More...
 
template<class VectorT , class VectorU >
VectorT::value_type shark::blas::distanceSqr (vector_expression< VectorT > const &op1, vector_expression< VectorU > const &op2)
 Squared distance between two vectors. More...
 
template<class MatrixT , class VectorU , class VectorR >
void shark::blas::distanceSqr (matrix_expression< MatrixT > const &operands, vector_expression< VectorU > const &op2, vector_expression< VectorR > &distances)
 Squared distance between a vector and a set of vectors and stores the result in the vector of distances. More...
 
template<class MatrixT , class VectorU >
vector< typename MatrixT::value_type > shark::blas::distanceSqr (matrix_expression< MatrixT > const &operands, vector_expression< VectorU > const &op2)
 Squared distance between a vector and a set of vectors. More...
 
template<class MatrixT , class VectorU >
vector< typename MatrixT::value_type > shark::blas::distanceSqr (vector_expression< VectorU > const &op1, matrix_expression< MatrixT > const &operands)
 Squared distance between a vector and a set of vectors. More...
 
template<class MatrixT , class MatrixU >
matrix< typename MatrixT::value_type > shark::blas::distanceSqr (matrix_expression< MatrixT > const &X, matrix_expression< MatrixU > const &Y)
 Squared distance between the vectors of two sets of vectors. More...
 
template<class VectorT , class VectorU >
VectorT::value_type shark::blas::distance (vector_expression< VectorT > const &op1, vector_expression< VectorU > const &op2)
 Calculates distance between two vectors. More...
 
template<class VectorT , class VectorU , class WeightT >
VectorT::value_type shark::blas::diagonalMahalanobisDistance (vector_expression< VectorT > const &op1, vector_expression< VectorU > const &op2, vector_expression< WeightT > const &weights)
 Normalized euclidian distance (diagonal Mahalanobis) between two vectors. More...
 
template<class X , class R >
X::value_type shark::blas::createHouseholderReflection (vector_expression< X > const &x, vector_expression< R > &reflection)
 Generates a Householder reflection from a vector to use with applyHouseholderLeft/Right. More...
 
template<class Mat , class R , class T >
void shark::blas::applyHouseholderOnTheRight (matrix_expression< Mat > &matrix, vector_expression< R > const &reflection, T beta)
 
template<class Mat , class R , class T >
void shark::blas::applyHouseholderOnTheLeft (matrix_expression< Mat > &matrix, vector_expression< R > const &reflection, T const &beta)
 rotates a matrix using a householder reflection More...
 
template<class Mat , class R , class T >
void shark::blas::applyHouseholderOnTheLeft (temporary_proxy< Mat > matrix, vector_expression< R > const &reflection, T const &beta)
 rotates a matrix using a householder reflection More...
 
template<class MatrixT , typename RngType >
void shark::blas::randomRotationMatrix (matrix_container< MatrixT > &matrixC, RngType &rng)
 Initializes a matrix such that it forms a random rotation matrix. More...
 
template<class MatrixT >
void shark::blas::randomRotationMatrix (matrix_container< MatrixT > &matrixC)
 Initializes a matrix such that it forms a random rotation. More...
 
template<typename RngType >
RealMatrix shark::blas::randomRotationMatrix (size_t size, RngType &rng)
 Creates a random rotation matrix with a certain size using the random number generator rng. More...
 
RealMatrix shark::blas::randomRotationMatrix (size_t size)
 Creates a random rotation matrix with a certain size using the global random number gneerator. More...
 
template<class MatrixT , class Mat >
std::size_t shark::blas::pivotingRQ (blas::matrix_expression< MatrixT > const &matrixA, blas::matrix_container< Mat > &matrixR, blas::matrix_container< Mat > &matrixQ, blas::permutation_matrix &permutation)
 Determines the RQ Decomposition of the matrix A using pivoting returning the housholder transformation instead of Q. More...
 
template<class MatrixT , class MatrixU >
std::size_t shark::blas::pivotingRQHouseholder (blas::matrix_expression< MatrixT > const &matrixA, blas::matrix_container< MatrixU > &matrixR, blas::matrix_container< MatrixU > &householderV, blas::permutation_matrix &permutation)
 Determines the RQ Decomposition of the matrix A using pivoting. More...
 
template<class MatT , class VecT >
void shark::blas::solveSystemInPlace (matrix_expression< MatT > const &A, vector_expression< VecT > &b)
 In-Place System of linear equations solver. More...
 
template<class MatT , class Vec1T , class Vec2T >
void shark::blas::solveSystem (const matrix_expression< MatT > &A, vector_expression< Vec1T > &x, const vector_expression< Vec2T > &b)
 System of linear equations solver. More...
 
template<class MatT , class Mat2T >
void shark::blas::solveSystemInPlace (matrix_expression< MatT > const &A, matrix_expression< Mat2T > &B)
 In-Place system of linear equations solver. More...
 
template<class MatT , class Mat1T , class Mat2T >
void shark::blas::solveSystem (const matrix_expression< MatT > &A, matrix_expression< Mat1T > &X, const matrix_expression< Mat2T > &B)
 System of linear equations solver. More...
 
template<class System , class MatT , class VecT >
void shark::blas::solveSymmPosDefSystemInPlace (matrix_expression< MatT > const &A, vector_expression< VecT > &b)
 System of symmetric linear equations solver. The result is stored in b. More...
 
template<class System , class MatT , class Mat1T >
void shark::blas::solveSymmPosDefSystemInPlace (matrix_expression< MatT > const &A, matrix_expression< Mat1T > &B)
 System of symmetric linear equations solver. More...
 
template<class System , class MatT , class Vec1T , class Vec2T >
void shark::blas::solveSymmPosDefSystem (matrix_expression< MatT > const &A, vector_expression< Vec1T > &x, vector_expression< Vec2T > const &b)
 System of symmetric linear equations solver. More...
 
template<class System , class MatT , class Mat1T , class Mat2T >
void shark::blas::solveSymmPosDefSystem (matrix_expression< MatT > const &A, matrix_expression< Mat1T > &X, matrix_expression< Mat2T > const &B)
 System of symmetric linear equations solver. More...
 
template<class System , class MatT , class VecT >
void shark::blas::solveSymmSemiDefiniteSystemInPlace (matrix_expression< MatT > const &A, vector_expression< VecT > &b)
 Solves a square system of linear equations without full rank. More...
 
template<class System , class Mat1T , class Mat2T >
void shark::blas::solveSymmSemiDefiniteSystemInPlace (matrix_expression< Mat1T > const &A, matrix_expression< Mat2T > &B)
 Solves multiple square system of linear equations without full rank. More...
 
template<class System , class MatT , class VecT >
void shark::blas::generalSolveSystemInPlace (matrix_expression< MatT > const &A, vector_expression< VecT > &b)
 Solves a non-square system of linear equations. More...
 
template<class System , class MatA , class MatB >
void shark::blas::generalSolveSystemInPlace (matrix_expression< MatA > const &A, matrix_expression< MatB > &B)
 Solves multiple non-square systems of linear equations. More...
 
template<class MatT , class VecT , class VecT2 >
void shark::blas::approxsolveSymmPosDefSystem (matrix_expression< MatT > const &A, vector_expression< VecT > &x, vector_expression< VecT2 > const &b, double epsilon=1.e-10, bool initialSolution=false, unsigned int maxIterations=0)
 Approximates the solution of a linear system of equation Ax=b. More...
 
template<class MatT , class VecT >
void shark::blas::approxsolveSymmPosDefSystemInPlace (matrix_expression< MatT > const &A, vector_expression< VecT > &b, double epsilon=1.e-10, unsigned int maxIterations=0)
 Approximates the solution of a linear system of equation Ax=b, storing the solution in b. More...
 
template<class MatrixT , class MatrixU , class VectorT >
void shark::blas::svd (const MatrixT &amatA, MatrixU &umatA, MatrixU &vmatA, VectorT &wvecA, unsigned maxIterations=200, bool ignoreThreshold=true)
 
template<class InputType , class OutputType >
void shark::initRandomNormal (AbstractModel< InputType, OutputType > &model, double s)
 Initialize model parameters normally distributed. More...
 
template<class InputType , class OutputType >
void shark::initRandomUniform (AbstractModel< InputType, OutputType > &model, double l, double h)
 Initialize model parameters uniformly at random. More...
 

Detailed Description

Several mathematical, linear-algebra, or other functions within Shark are not part of any particular class. They are collected here in the doxygen group "shark_globals".

Typedef Documentation

§ batch_range [1/2]

template<class Type>
typedef boost::iterator_range<typename Container::iterator> shark::Data< Type >::batch_range

Definition at line 174 of file Dataset.h.

§ batch_range [2/2]

template<class InputT, class LabelT>
typedef PairRangeType< batch_type, typename InputContainer::batch_range, typename LabelContainer::batch_range >::type shark::LabeledData< InputT, LabelT >::batch_range

Definition at line 498 of file Dataset.h.

§ batch_reference [1/2]

template<class Type>
typedef batch_type& shark::Data< Type >::batch_reference

Definition at line 158 of file Dataset.h.

§ batch_reference [2/2]

template<class InputT, class LabelT>
typedef boost::range_reference<batch_range>::type shark::LabeledData< InputT, LabelT >::batch_reference

Definition at line 506 of file Dataset.h.

§ const_batch_range [1/2]

template<class Type>
typedef boost::iterator_range<typename Container::const_iterator> shark::Data< Type >::const_batch_range

Definition at line 175 of file Dataset.h.

§ const_batch_range [2/2]

template<class InputT, class LabelT>
typedef PairRangeType< batch_type, typename InputContainer::const_batch_range, typename LabelContainer::const_batch_range >::type shark::LabeledData< InputT, LabelT >::const_batch_range

Definition at line 503 of file Dataset.h.

§ const_batch_reference [1/2]

template<class Type>
typedef batch_type const& shark::Data< Type >::const_batch_reference

Definition at line 159 of file Dataset.h.

§ const_batch_reference [2/2]

template<class InputT, class LabelT>
typedef boost::range_reference<const_batch_range>::type shark::LabeledData< InputT, LabelT >::const_batch_reference

Definition at line 507 of file Dataset.h.

§ const_element_range [1/2]

template<class Type>
typedef boost::iterator_range<typename Container::const_element_iterator> shark::Data< Type >::const_element_range

Definition at line 173 of file Dataset.h.

§ const_element_range [2/2]

template<class InputT, class LabelT>
typedef PairRangeType< element_type, typename InputContainer::const_element_range, typename LabelContainer::const_element_range >::type shark::LabeledData< InputT, LabelT >::const_element_range

Definition at line 493 of file Dataset.h.

§ const_element_reference [1/2]

template<class Type>
typedef Batch<element_type>::const_reference shark::Data< Type >::const_element_reference

Definition at line 163 of file Dataset.h.

§ const_element_reference [2/2]

template<class InputT, class LabelT>
typedef boost::range_reference<const_element_range>::type shark::LabeledData< InputT, LabelT >::const_element_reference

Definition at line 509 of file Dataset.h.

§ Container

template<class Type>
typedef detail::SharedContainer<Type> shark::Data< Type >::Container
protected

Definition at line 147 of file Dataset.h.

§ element_range [1/2]

template<class Type>
typedef boost::iterator_range<typename Container::element_iterator> shark::Data< Type >::element_range

Definition at line 172 of file Dataset.h.

§ element_range [2/2]

template<class InputT, class LabelT>
typedef PairRangeType< element_type, typename InputContainer::element_range, typename LabelContainer::element_range >::type shark::LabeledData< InputT, LabelT >::element_range

Definition at line 488 of file Dataset.h.

§ element_reference [1/2]

template<class Type>
typedef Batch<element_type>::reference shark::Data< Type >::element_reference

Definition at line 162 of file Dataset.h.

§ element_reference [2/2]

template<class InputT, class LabelT>
typedef boost::range_reference<element_range>::type shark::LabeledData< InputT, LabelT >::element_reference

Definition at line 508 of file Dataset.h.

§ IndexSet [1/2]

template<class Type>
typedef std::vector<std::size_t> shark::Data< Type >::IndexSet

Definition at line 165 of file Dataset.h.

§ IndexSet [2/2]

template<class InputT, class LabelT>
typedef InputContainer::IndexSet shark::LabeledData< InputT, LabelT >::IndexSet

Definition at line 468 of file Dataset.h.

§ InputContainer [1/2]

template<class InputT>
typedef detail::SharedContainer<InputT> shark::UnlabeledData< InputT >::InputContainer

Definition at line 371 of file Dataset.h.

§ InputContainer [2/2]

template<class InputT, class LabelT>
typedef UnlabeledData<InputT> shark::LabeledData< InputT, LabelT >::InputContainer

Definition at line 466 of file Dataset.h.

§ InputType [1/2]

template<class InputT>
typedef element_type shark::UnlabeledData< InputT >::InputType

Definition at line 370 of file Dataset.h.

§ InputType [2/2]

template<class InputT, class LabelT>
typedef InputT shark::LabeledData< InputT, LabelT >::InputType

Definition at line 464 of file Dataset.h.

§ LabelContainer

template<class InputT, class LabelT>
typedef Data<LabelT> shark::LabeledData< InputT, LabelT >::LabelContainer

Definition at line 467 of file Dataset.h.

§ LabelType

template<class InputT, class LabelT>
typedef LabelT shark::LabeledData< InputT, LabelT >::LabelType

Definition at line 465 of file Dataset.h.

Enumeration Type Documentation

§ KernelMatrixNormalizationType

Enumerator
NONE 
MULTIPLICATIVE_TRACE_ONE 
MULTIPLICATIVE_TRACE_N 
MULTIPLICATIVE_VARIANCE_ONE 
CENTER_ONLY 
CENTER_AND_MULTIPLICATIVE_TRACE_ONE 

Definition at line 57 of file ExportKernelMatrix.h.

§ LabelPosition

Position of the label in a CSV file.

This type describes the position of the label in a record of a CSV file. The label can be positioned either in the first or the last column, or there can be no label present at all.
Enumerator
FIRST_COLUMN 
LAST_COLUMN 

Definition at line 75 of file Csv.h.

Function Documentation

§ append() [1/2]

template<class Type>
void shark::Data< Type >::append ( self_type const &  other)
inline

Appends the contents of another data object to the end.

The batches are not copied but now referenced from both datasets. Thus changing the appended dataset might change this one as well.

Definition at line 298 of file Dataset.h.

§ append() [2/2]

template<class InputT, class LabelT>
void shark::LabeledData< InputT, LabelT >::append ( self_type const &  other)
inline

Appends the contents of another data object to the end.

The batches are not copied but now referenced from both datasets. Thus changing the appended dataset might change this one as well.

Definition at line 670 of file Dataset.h.

§ applyHouseholderOnTheLeft() [1/2]

template<class Mat , class R , class T >
void shark::blas::applyHouseholderOnTheLeft ( matrix_expression< Mat > &  matrix,
vector_expression< R > const &  reflection,
T const &  beta 
)

rotates a matrix using a householder reflection

calculates (1-beta*xx^T)*A

Definition at line 112 of file rotations.h.

References beta, shark::blas::noalias(), shark::blas::outer_prod(), shark::blas::prod(), shark::size(), SIZE_CHECK, and shark::blas::trans().

Referenced by shark::blas::applyHouseholderOnTheLeft(), and shark::blas::randomRotationMatrix().

§ applyHouseholderOnTheLeft() [2/2]

template<class Mat , class R , class T >
void shark::blas::applyHouseholderOnTheLeft ( temporary_proxy< Mat >  matrix,
vector_expression< R > const &  reflection,
T const &  beta 
)

rotates a matrix using a householder reflection

calculates (1-beta*xx^T)*A

Definition at line 137 of file rotations.h.

References shark::blas::applyHouseholderOnTheLeft().

§ applyHouseholderOnTheRight()

template<class Mat , class R , class T >
void shark::blas::applyHouseholderOnTheRight ( matrix_expression< Mat > &  matrix,
vector_expression< R > const &  reflection,
beta 
)

§ approxsolveSymmPosDefSystem()

template<class MatT , class VecT , class VecT2 >
void shark::blas::approxsolveSymmPosDefSystem ( matrix_expression< MatT > const &  A,
vector_expression< VecT > &  x,
vector_expression< VecT2 > const &  b,
double  epsilon = 1.e-10,
bool  initialSolution = false,
unsigned int  maxIterations = 0 
)

Approximates the solution of a linear system of equation Ax=b.

Most often there is no need for the exact solution of a system of linear equations. Instead only a good approximation needs to be found. In this case an iterative method can be used which stops when a suitable exact solution is found. For a lot of systems this already happens after a very low number of iterations. Every iteration has complexity O(n^2) and after n iterations the exact solution is found. However if this solution is needed, the other methods, as for example solveSymmPosDefSystem are more suitable.

This algorithm does not require A to have full rank, however it must be positive semi-definite.

This algorithm stops after the maximum number of iterations is exceeded or after the max-norm of the residual \( r_k= -Ax_k+b\) is smaller than epsilon.

The initial solution argument governs whether x already stores a possible starting point. If this is true, it is checked whether it is better than starting from 0 (i.e. the max-norm of the initial residual is smaller than -b).

Parameters
Athe positive semi-definite n x n-Matrix
xthe solution vector
bthe right hand side
epsilonstopping criterium for the residual
maxIterationsthe maximum number of iterations
initialSolutionif this is true, x stores an initial guess of the solution

Definition at line 303 of file solveSystem.h.

References beta, shark::blas::inner_prod(), shark::blas::noalias(), shark::blas::norm_inf(), shark::blas::prod(), shark::size(), SIZE_CHECK, and shark::swap().

Referenced by shark::blas::approxsolveSymmPosDefSystemInPlace().

§ approxsolveSymmPosDefSystemInPlace()

template<class MatT , class VecT >
void shark::blas::approxsolveSymmPosDefSystemInPlace ( matrix_expression< MatT > const &  A,
vector_expression< VecT > &  b,
double  epsilon = 1.e-10,
unsigned int  maxIterations = 0 
)

Approximates the solution of a linear system of equation Ax=b, storing the solution in b.

Most often there is no need for the exact solution of a system of linear equations. Instead only a good approximation needs to be found. In this case an iterative method can be used which stops when a suitable exact solution is found. For a lot of systems this already happens after a very low number of iterations. Every iteration has complexity O(n^2) and after n iterations the exact solution is found. However if this solution is needed, the other methods, as for xample solveSymmPosDefSystem are more suitable.

This algorithm stops after the maximum number of iterations is exceeded or after the max-norm of the residual \( r_k= Ax_k-b\) is smaller than epsilon. The reuslt is stored in b afterwars

Parameters
Athe positive semi-definite n x n-Matrix
bthe right hand side which also stores the final solution
epsilonstopping criterium for the residual
maxIterationsthe maximum number of iterations

Definition at line 372 of file solveSystem.h.

References shark::blas::approxsolveSymmPosDefSystem(), shark::size(), SIZE_CHECK, and shark::swap().

§ batch() [1/4]

§ batch() [2/4]

template<class Type>
const_batch_reference shark::Data< Type >::batch ( std::size_t  i) const
inline

Definition at line 234 of file Dataset.h.

§ batch() [3/4]

§ batch() [4/4]

template<class InputT, class LabelT>
const_batch_reference shark::LabeledData< InputT, LabelT >::batch ( std::size_t  i) const
inline

Definition at line 623 of file Dataset.h.

§ batches() [1/4]

template<class Type>
const_batch_range shark::Data< Type >::batches ( ) const
inline

Returns the range of batches.

It is compatible to boost::range and STL and can be used whenever an algorithm requires element access via begin()/end() in which case data.elements() provides the correct interface

Definition at line 197 of file Dataset.h.

Referenced by shark::createDataFromRange(), shark::ExactGradient< RBMType >::evalDerivative(), main(), shark::negativeLogLikelihoodFromLogPartition(), and shark::transform().

§ batches() [2/4]

template<class Type>
batch_range shark::Data< Type >::batches ( )
inline

Returns the range of batches.

It is compatible to boost::range and STL and can be used whenever an algorithm requires element access via begin()/end() in which case data.elements() provides the correct interface

Definition at line 204 of file Dataset.h.

§ batches() [3/4]

template<class InputT, class LabelT>
const_batch_range shark::LabeledData< InputT, LabelT >::batches ( ) const
inline

Returns the range of batches.

It is compatible to boost::range and STL and can be used whenever an algorithm requires element access via begin()/end() in which case data.elements() provides the correct interface

Definition at line 530 of file Dataset.h.

§ batches() [4/4]

template<class InputT, class LabelT>
batch_range shark::LabeledData< InputT, LabelT >::batches ( )
inline

Returns the range of batches.

It is compatible to boost::range and STL and can be used whenever an algorithm requires element access via begin()/end() in which case data.elements() provides the correct interface

Definition at line 537 of file Dataset.h.

§ binarySubProblem()

template<class I >
LabeledData<I,unsigned int> shark::binarySubProblem ( LabeledData< I, unsigned int >const &  data,
unsigned int  zeroClass,
unsigned int  oneClass 
)

§ BOOST_STATIC_CONSTANT() [1/2]

template<class Type>
shark::Data< Type >::BOOST_STATIC_CONSTANT ( std::size_t  ,
DefaultBatchSize  = 256 
)

Defines the default batch size of the Container.

Zero means: unlimited

§ BOOST_STATIC_CONSTANT() [2/2]

template<class InputT, class LabelT>
shark::LabeledData< InputT, LabelT >::BOOST_STATIC_CONSTANT ( std::size_t  ,
DefaultBatchSize  = InputContainer::DefaultBatchSize 
)

§ choleskyDecomposition()

template<class MatrixT , class MatrixL >
void shark::blas::choleskyDecomposition ( matrix_expression< MatrixT > const &  A,
matrix_expression< MatrixL > &  L 
)

Lower triangular Cholesky decomposition.

Given an \( m \times m \) symmetric positive definite matrix \(A\), compute the lower triangular matrix \(L\) such that \(A = LL^T \). An exception is thrown if the matrix is not positive definite. If you suspect the matrix to be positive semi-definite, use pivotingCholeskyDecomposition instead

Parameters
A\( m \times m \) matrix, which must be symmetric and positive definite
L\( m \times m \) matrix, which stores the Cholesky factor
Returns
none

Definition at line 65 of file Cholesky.h.

References SHARKEXCEPTION, and SIZE_CHECK.

Referenced by shark::NegativeGaussianProcessEvidence< InputType, OutputType, LabelType >::eval(), shark::NegativeGaussianProcessEvidence< InputType, OutputType, LabelType >::evalDerivative(), and shark::MultiVariateNormalDistributionCholesky::setCovarianceMatrix().

§ choleskyUpdate()

template<class Matrix , class Vector >
void shark::blas::choleskyUpdate ( matrix_expression< Matrix > &  L,
vector_expression< Vector > const &  v,
double  alpha,
double  beta 
)

Updates a covariance factor by a rank one update.

Let \( A=LL^T \) be a matrix with its lower cholesky factor. Assume we want to update A using a simple rank-one update \( A = \alpha A+ \beta vv^T \). This invalidates L and it needs to be recomputed which is O(n^3). instead we can update the factorisation directly by performing a similar, albeit more complex algorithm on L, which can be done in O(L^2).

Alpha is not required to be positive, but if it is not negative, one has to be carefull that the update would keep A positive definite. Otherwise the decomposition does not exist anymore and an exception is thrown.

Parameters
Lthe lower cholesky factor to be updated
vthe update vector
alphathe scaling factor, must be positive.
betathe update factor. it Can be positive or negative

Definition at line 101 of file Cholesky.h.

References shark::blas::column(), shark::blas::noalias(), shark::blas::pivotingCholeskyDecompositionInPlace(), SHARKEXCEPTION, and shark::blas::subrange().

Referenced by shark::MultiVariateNormalDistributionCholesky::rankOneUpdate().

§ classSizes() [1/2]

§ classSizes() [2/2]

template<class InputType , class LabelType >
std::vector<std::size_t> shark::classSizes ( LabeledData< InputType, LabelType > const &  dataset)
inline

Returns the number of members of each class in the dataset.

Definition at line 875 of file Dataset.h.

References shark::classSizes(), and shark::LabeledData< InputT, LabelT >::labels().

§ copySign()

template<class T >
T shark::copySign ( x,
y 
)

brief lets x have the same sign as y.

This is the famous well known copysign function from fortran.

Definition at line 175 of file Math.h.

§ createCVBatch()

template<class I , class L >
CVFolds<LabeledData<I,L> > shark::createCVBatch ( LabeledData< I, L > const &  set,
std::size_t  numberOfPartitions 
)

Create a partition for cross validation without changing the dataset.

This method behaves similar to createCVIID with the difference that batches are not reordered. Thus the batches are only rearranged randomly in folds, but the dataset itself is not changed.

Parameters
numberOfPartitionsnumber of partitions to create
setthe input data from which to draw the partitions

Definition at line 346 of file CVDatasetTools.h.

References shark::shuffle(), shark::CVFolds< DatasetTypeT >::size(), and shark::uni().

§ createCVFullyIndexed()

template<class I , class L >
CVFolds<LabeledData<I,L> > shark::createCVFullyIndexed ( LabeledData< I, L > &  set,
std::size_t  numberOfPartitions,
RecreationIndices  indices,
std::size_t  batchSize = Data<I>::DefaultBatchSize 
)

Create a partition for cross validation from indices for both ordering and partitioning.

Create a partition from indices. There is one index vector assigning an order to the samples, and another one assigning each sample to a validation partition. That is, given a dataset set, and at the i-th processing step, this function puts the order_indices[i]-th sample into the partition_indices[i]-th partition. The order_indices part of the above procedure matters if both an inner and outer partition are to be recreated: for the inner partition to be recreated, too, the outer partition must be recreated in the same order, not just partitioned into the same splits.

Parameters
setpartitions will be subsets of this set
numberOfPartitionsnumber of partitions to create
indicesstores location index in the first and partition index in the second vector
batchSizemaximum batch size

Definition at line 447 of file CVDatasetTools.h.

References shark::LabeledData< InputT, LabelT >::batch(), shark::CVFolds< DatasetTypeT >::size(), SIZE_CHECK, shark::subBatch(), and shark::swap().

§ createCVIID()

template<class I , class L >
CVFolds<LabeledData<I,L> > shark::createCVIID ( LabeledData< I, L > &  set,
std::size_t  numberOfPartitions,
std::size_t  batchSize = Data<I>::DefaultBatchSize 
)

Create a partition for cross validation.

The subset each training examples belongs to is drawn independently and uniformly distributed. For every partition, all but one subset form the training set, while the remaining one is used for validation. The partitions can be accessed using getCVPartitionName

Parameters
setthe input data for which the new partitions are created
numberOfPartitionsnumber of partitions to create
batchSizemaximum batch size

Definition at line 259 of file CVDatasetTools.h.

References shark::createCVIndexed(), and shark::discrete().

Referenced by main(), and run_one_trial().

§ createCVIndexed()

template<class I , class L >
CVFolds<LabeledData<I,L> > shark::createCVIndexed ( LabeledData< I, L > &  set,
std::size_t  numberOfPartitions,
std::vector< std::size_t >  indices,
std::size_t  batchSize = Data<I>::DefaultBatchSize 
)

Create a partition for cross validation from indices.

Create a partition from indices. The indices vector for each sample states of what validation partition that sample should become a member. In other words, the index maps a sample to a validation partition, meaning that it will become a part of the training partition for all other folds.

Parameters
setpartitions will be subsets of this set
numberOfPartitionsnumber of partitions to create
indicespartition indices of the examples in [0, ..., numberOfPartitions[.
batchSizemaximum batch size

Definition at line 386 of file CVDatasetTools.h.

References shark::LabeledData< InputT, LabelT >::batch(), shark::CVFolds< DatasetTypeT >::size(), SIZE_CHECK, shark::subBatch(), and shark::swap().

Referenced by shark::createCVIID(), and main().

§ createCVSameSize()

template<class I , class L >
CVFolds<LabeledData<I,L> > shark::createCVSameSize ( LabeledData< I, L > &  set,
std::size_t  numberOfPartitions,
std::size_t  batchSize = LabeledData<I,L>::DefaultBatchSize 
)

Create a partition for cross validation.

Every subset contains (approximately) the same number of elements. For every partition, all but one subset form the training set, while the remaining one is used for validation. The partitions can be accessed using getCVPartitionName

Parameters
numberOfPartitionsnumber of partitions to create
setthe input data from which to draw the partitions
batchSizemaximum batch size

Definition at line 280 of file CVDatasetTools.h.

Referenced by main().

§ createCVSameSizeBalanced()

template<class I >
CVFolds<LabeledData<I,unsigned int> > shark::createCVSameSizeBalanced ( LabeledData< I, unsigned int > &  set,
std::size_t  numberOfPartitions,
std::size_t  batchSize = Data<I>::DefaultBatchSize,
RecreationIndices cv_indices = NULL 
)

Create a partition for cross validation.

Every subset contains (approximately) the same number of elements. For every partition, all but one subset form the training set, while the remaining one is used for validation.

Parameters
numberOfPartitionsnumber of partitions to create
setthe input data from which to draw the partitions
batchSizemaximum batch size
cv_indicesif not NULL [default]: for each element, store the fold it is assigned to; this can be used to later/externally recreate the fold via createCVIndexed

Definition at line 317 of file CVDatasetTools.h.

References shark::numberOfClasses(), and shark::DataView< DatasetType >::size().

Referenced by main().

§ createDataFromRange()

template<class Range >
Data<typename boost::range_value<Range>::type> shark::createDataFromRange ( Range const &  inputs,
std::size_t  maximumBatchSize = 0 
)

§ createHouseholderReflection()

template<class X , class R >
X::value_type shark::blas::createHouseholderReflection ( vector_expression< X > const &  x,
vector_expression< R > &  reflection 
)

Generates a Householder reflection from a vector to use with applyHouseholderLeft/Right.

Given a Vector x=(x0,x1,...,xn), finds a reflection with the property (c, 0,0,...0) = (I-beta v v^t)x and v = (x0-c,x1,x2,...,xn)

Definition at line 52 of file rotations.h.

References beta, shark::blas::noalias(), shark::blas::norm_2(), shark::size(), and SIZE_CHECK.

§ createLabeledDataFromRange()

template<class Range1 , class Range2 >
LabeledData< typename boost::range_value<Range1>::type, typename boost::range_value<Range2>::type> shark::createLabeledDataFromRange ( Range1 const &  inputs,
Range2 const &  labels,
std::size_t  batchSize = 0 
)

creates a labeled data object from two ranges, representing inputs and labels

Definition at line 800 of file Dataset.h.

References shark::createDataFromRange(), SHARK_CHECK, and shark::size().

Referenced by shark::ProjectBudgetMaintenanceStrategy< RealVector >::addToModel(), shark::createLabeledDataFromRange(), createProblem(), main(), and xorProblem().

§ createUnlabeledDataFromRange()

template<class Range >
UnlabeledData<typename boost::range_value<Range>::type> shark::createUnlabeledDataFromRange ( Range const &  inputs,
std::size_t  maximumBatchSize = 0 
)

creates a data object from a range of elements

Definition at line 792 of file Dataset.h.

References shark::createDataFromRange().

Referenced by shark::createUnlabeledDataFromRange().

§ csvStringToData() [1/10]

SHARK_EXPORT_SYMBOL void shark::csvStringToData ( Data< FloatVector > &  data,
std::string const &  contents,
char  separator = ',',
char  comment = '#',
std::size_t  maximumBatchSize = Data< RealVector >::DefaultBatchSize 
)

Import unlabeled vectors from a read-in character-separated value file.

Parameters
dataContainer storing the loaded data
contentsThe read in csv-file
separatorOptional separator between entries, typically a comma, spaces ar automatically ignored
commentTrailing character indicating comment line. By dfault it is '#'
maximumBatchSizeSize of batches in the dataset

Referenced by shark::importCSV().

§ csvStringToData() [2/10]

SHARK_EXPORT_SYMBOL void shark::csvStringToData ( Data< RealVector > &  data,
std::string const &  contents,
char  separator = ',',
char  comment = '#',
std::size_t  maximumBatchSize = Data< RealVector >::DefaultBatchSize 
)

Import unlabeled vectors from a read-in character-separated value file.

Parameters
dataContainer storing the loaded data
contentsThe read in csv-file
separatorOptional separator between entries, typically a comma, spaces ar automatically ignored
commentTrailing character indicating comment line. By dfault it is '#'
maximumBatchSizeSize of batches in the dataset

§ csvStringToData() [3/10]

SHARK_EXPORT_SYMBOL void shark::csvStringToData ( Data< unsigned int > &  data,
std::string const &  contents,
char  separator = ',',
char  comment = '#',
std::size_t  maximumBatchSize = Data< unsigned int >::DefaultBatchSize 
)

Import "csv" from string consisting only of a single unsigned int per row.

Parameters
dataContainer storing the loaded data
contentsThe read in csv-file
separatorOptional separator between entries, typically a comma, spaces ar automatically ignored
commentTrailing characters indicating comment line. By default it is "#"
maximumBatchSizeSize of batches in the dataset

§ csvStringToData() [4/10]

SHARK_EXPORT_SYMBOL void shark::csvStringToData ( Data< int > &  data,
std::string const &  contents,
char  separator = ',',
char  comment = '#',
std::size_t  maximumBatchSize = Data< int >::DefaultBatchSize 
)

Import "csv" from string consisting only of a single int per row.

Parameters
dataContainer storing the loaded data
contentsThe read in csv-file
separatorOptional separator between entries, typically a comma, spaces ar automatically ignored
commentTrailing characters indicating comment line. By default it is "#"
maximumBatchSizeSize of batches in the dataset

§ csvStringToData() [5/10]

SHARK_EXPORT_SYMBOL void shark::csvStringToData ( Data< float > &  data,
std::string const &  contents,
char  separator = ',',
char  comment = '#',
std::size_t  maximumBatchSize = Data< double >::DefaultBatchSize 
)

Import "csv" from string consisting only of a single double per row.

Parameters
dataContainer storing the loaded data
contentsThe read in csv-file
separatorOptional separator between entries, typically a comma, spaces ar automatically ignored
commentTrailing characters indicating comment line. By default it is "#"
maximumBatchSizeSize of batches in the dataset

§ csvStringToData() [6/10]

SHARK_EXPORT_SYMBOL void shark::csvStringToData ( Data< double > &  data,
std::string const &  contents,
char  separator = ',',
char  comment = '#',
std::size_t  maximumBatchSize = Data< double >::DefaultBatchSize 
)

Import "csv" from string consisting only of a single double per row.

Parameters
dataContainer storing the loaded data
contentsThe read in csv-file
separatorOptional separator between entries, typically a comma, spaces ar automatically ignored
commentTrailing characters indicating comment line. By default it is "#"
maximumBatchSizeSize of batches in the dataset

§ csvStringToData() [7/10]

SHARK_EXPORT_SYMBOL void shark::csvStringToData ( LabeledData< RealVector, unsigned int > &  dataset,
std::string const &  contents,
LabelPosition  lp,
char  separator = ',',
char  comment = '#',
std::size_t  maximumBatchSize = LabeledData< RealVector, unsigned int >::DefaultBatchSize 
)

Import labeled data from a character-separated value file.

Parameters
datasetContainer storing the loaded data
contentsthe read-in file contents.
lpPosition of the label in the record, either first or last column
separatorOptional separator between entries, typically a comma, spaces ar automatically ignored
commentCharacter for indicating a comment, by default '#'
maximumBatchSizemaximum size of a batch in the dataset after import

§ csvStringToData() [8/10]

SHARK_EXPORT_SYMBOL void shark::csvStringToData ( LabeledData< FloatVector, unsigned int > &  dataset,
std::string const &  contents,
LabelPosition  lp,
char  separator = ',',
char  comment = '#',
std::size_t  maximumBatchSize = LabeledData< RealVector, unsigned int >::DefaultBatchSize 
)

Import labeled data from a character-separated value file.

Parameters
datasetContainer storing the loaded data
contentsthe read-in file contents.
lpPosition of the label in the record, either first or last column
separatorOptional separator between entries, typically a comma, spaces ar automatically ignored
commentCharacter for indicating a comment, by default '#'
maximumBatchSizemaximum size of a batch in the dataset after import

§ csvStringToData() [9/10]

SHARK_EXPORT_SYMBOL void shark::csvStringToData ( LabeledData< RealVector, RealVector > &  dataset,
std::string const &  contents,
LabelPosition  lp,
std::size_t  numberOfOutputs = 1,
char  separator = ',',
char  comment = '#',
std::size_t  maximumBatchSize = LabeledData< RealVector, RealVector >::DefaultBatchSize 
)

Import regression data from a read-in character-separated value file.

Parameters
datasetContainer storing the loaded data
contentsThe read in csv-file
lpPosition of the label in the record, either first or last column
separatorSeparator between entries, typically a comma or a space
commentCharacter for indicating a comment, by default empty
numberOfOutputsDimensionality of label/output
maximumBatchSizemaximum size of a batch in the dataset after import

§ csvStringToData() [10/10]

SHARK_EXPORT_SYMBOL void shark::csvStringToData ( LabeledData< FloatVector, FloatVector > &  dataset,
std::string const &  contents,
LabelPosition  lp,
std::size_t  numberOfOutputs = 1,
char  separator = ',',
char  comment = '#',
std::size_t  maximumBatchSize = LabeledData< RealVector, RealVector >::DefaultBatchSize 
)

Import regression data from a read-in character-separated value file.

Parameters
datasetContainer storing the loaded data
contentsThe read in csv-file
lpPosition of the label in the record, either first or last column
separatorSeparator between entries, typically a comma or a space
commentCharacter for indicating a comment, by default empty
numberOfOutputsDimensionality of label/output
maximumBatchSizemaximum size of a batch in the dataset after import

§ cube()

template<class T >
T shark::cube ( const T &  x)
inline

Calculates x^3.

Definition at line 86 of file Math.h.

Referenced by shark::tetragamma().

§ Data() [1/4]

template<class Type>
shark::Data< Type >::Data ( )
inline

Constructor which constructs an empty set.

Definition at line 241 of file Dataset.h.

§ Data() [2/4]

template<class Type>
shark::Data< Type >::Data ( std::size_t  numBatches)
inlineexplicit

Construct a dataset with empty batches.

Definition at line 244 of file Dataset.h.

§ Data() [3/4]

template<class Type>
shark::Data< Type >::Data ( Data< Type > const &  container,
std::vector< std::size_t >  batchSizes 
)
inlineexplicit

Construct a dataset with different batch sizes as a copy of another dataset.

Definition at line 248 of file Dataset.h.

§ Data() [4/4]

template<class Type>
shark::Data< Type >::Data ( std::size_t  size,
element_type const &  element,
std::size_t  batchSize = DefaultBatchSize 
)
inlineexplicit

Construction with size and a single element.

Optionally the desired batch Size can be set

Parameters
sizethe new size of the container
elementthe blueprint element from which to create the Container
batchSizethe size of the batches. if this is 0, the size is unlimited

Definition at line 259 of file Dataset.h.

§ dataDimension()

§ diagonalMahalanobisDistance()

template<class VectorT , class VectorU , class WeightT >
VectorT::value_type shark::blas::diagonalMahalanobisDistance ( vector_expression< VectorT > const &  op1,
vector_expression< VectorU > const &  op2,
vector_expression< WeightT > const &  weights 
)

Normalized euclidian distance (diagonal Mahalanobis) between two vectors.

Contrary to some conventions, dimension-wise weights are considered instead of std. deviations: \( d(v) = \left( \sum_i w_i (x_i-z_i)^2 \right)^{1/2} \) nb: the weights themselves are not squared, but multiplied onto the squared components

Definition at line 418 of file Metrics.h.

References shark::blas::diagonalMahalanobisDistanceSqr(), shark::size(), and SIZE_CHECK.

§ diagonalMahalanobisDistanceSqr()

template<class VectorT , class VectorU , class WeightT >
VectorT::value_type shark::blas::diagonalMahalanobisDistanceSqr ( vector_expression< VectorT > const &  op1,
vector_expression< VectorU > const &  op2,
vector_expression< WeightT > const &  weights 
)

Normalized Euclidian squared distance (squared diagonal Mahalanobis) between two vectors.

NOTE: The weights themselves are not squared, but multiplied onto the squared components.

Definition at line 287 of file Metrics.h.

References shark::size(), and SIZE_CHECK.

Referenced by shark::blas::diagonalMahalanobisDistance(), shark::blas::diagonalMahalanobisNorm(), and shark::blas::distanceSqr().

§ distance()

§ distanceSqr() [1/5]

§ distanceSqr() [2/5]

template<class MatrixT , class VectorU , class VectorR >
void shark::blas::distanceSqr ( matrix_expression< MatrixT > const &  operands,
vector_expression< VectorU > const &  op2,
vector_expression< VectorR > &  distances 
)

Squared distance between a vector and a set of vectors and stores the result in the vector of distances.

The squared distance between the vector and every row-vector of the matrix is calculated. This can be implemented much more efficiently.

Definition at line 323 of file Metrics.h.

References shark::size(), and SIZE_CHECK.

§ distanceSqr() [3/5]

template<class MatrixT , class VectorU >
vector<typename MatrixT::value_type> shark::blas::distanceSqr ( matrix_expression< MatrixT > const &  operands,
vector_expression< VectorU > const &  op2 
)

Squared distance between a vector and a set of vectors.

The squared distance between the vector and every row-vector of the matrix is calculated. This can be implemented much more efficiently.

Definition at line 342 of file Metrics.h.

References shark::blas::distanceSqr(), shark::size(), and SIZE_CHECK.

§ distanceSqr() [4/5]

template<class MatrixT , class VectorU >
vector<typename MatrixT::value_type> shark::blas::distanceSqr ( vector_expression< VectorU > const &  op1,
matrix_expression< MatrixT > const &  operands 
)

Squared distance between a vector and a set of vectors.

The squared distance between the vector and every row-vector of the matrix is calculated. This can be implemented much more efficiently.

Definition at line 359 of file Metrics.h.

References shark::blas::distanceSqr(), shark::size(), and SIZE_CHECK.

§ distanceSqr() [5/5]

template<class MatrixT , class MatrixU >
matrix<typename MatrixT::value_type> shark::blas::distanceSqr ( matrix_expression< MatrixT > const &  X,
matrix_expression< MatrixU > const &  Y 
)

Squared distance between the vectors of two sets of vectors.

The squared distance between every row-vector of the first matrix x and every row-vector of the second matrix y is calculated. This can be implemented much more efficiently. The results are returned as a matrix, where the element in the i-th row and the j-th column is distanceSqr(x_i,y_j).

Definition at line 379 of file Metrics.h.

References SIZE_CHECK.

§ Divide() [1/2]

shark::Divide::Divide ( double  factor)
inline
Parameters
factorAll components of all vectors in the dataset are divided by this number

Definition at line 1144 of file Dataset.h.

§ Divide() [2/2]

shark::Divide::Divide ( const RealVector  factor)
inline
Parameters
factorFor all elements in the dataset, the i-th component is divided by the i-th component of this vector

Definition at line 1146 of file Dataset.h.

§ eigensymm()

template<class MatrixT , class MatrixU , class VectorT >
void shark::blas::eigensymm ( matrix_expression< MatrixT > const &  A,
matrix_expression< MatrixU > &  eigenVectors,
vector_expression< VectorT > &  eigenValues 
)

Used as frontend for eigensymm for calculating the eigenvalues and the normalized eigenvectors of a symmetric matrix 'A' using the Givens and Householder reduction. Each time this frontend is called additional memory is allocated for intermediate results.

Parameters
A\( n \times n \) matrix, which must be symmetric, so only the bottom triangular matrix must contain values.
eigenVectors\( n \times n \) matrix with the calculated normalized eigenvectors, each column contains an eigenvector.
eigenValuesn-dimensional vector with the calculated eigenvalues in descending order.
Returns
none.
Exceptions
SharkException

Definition at line 63 of file eigenvalues.h.

References SIZE_CHECK, and shark::blas::kernels::syev().

Referenced by shark::NormalizeComponentsZCA::train(), and shark::MultiVariateNormalDistribution::update().

§ element() [1/4]

template<class Type>
element_reference shark::Data< Type >::element ( std::size_t  i)
inline

§ element() [2/4]

template<class Type>
const_element_reference shark::Data< Type >::element ( std::size_t  i) const
inline

Definition at line 226 of file Dataset.h.

§ element() [3/4]

§ element() [4/4]

template<class InputT, class LabelT>
const_element_reference shark::LabeledData< InputT, LabelT >::element ( std::size_t  i) const
inline

Definition at line 615 of file Dataset.h.

§ elements() [1/4]

§ elements() [2/4]

template<class Type>
element_range shark::Data< Type >::elements ( )
inline

Returns therange of elements.

It is compatible to boost::range and STL and can be used whenever an algorithm requires element access via begin()/end() in which case data.elements() provides the correct interface

Definition at line 189 of file Dataset.h.

§ elements() [3/4]

template<class InputT, class LabelT>
const_element_range shark::LabeledData< InputT, LabelT >::elements ( ) const
inline

Returns the range of elements.

It is compatible to boost::range and STL and can be used whenever an algorithm requires element access via begin()/end() in which case data.elements() provides the correct interface

Definition at line 515 of file Dataset.h.

Referenced by shark::NBClassifierTrainer< InputType, OutputType >::getDistTrainerContainer(), shark::JaakkolaHeuristic::JaakkolaHeuristic(), main(), and shark::KernelMeanClassifier< InputType >::train().

§ elements() [4/4]

template<class InputT, class LabelT>
element_range shark::LabeledData< InputT, LabelT >::elements ( )
inline

Returns therange of elements.

It is compatible to boost::range and STL and can be used whenever an algorithm requires element access via begin()/end() in which case data.elements() provides the correct interface

Definition at line 522 of file Dataset.h.

§ empty() [1/2]

template<class Type>
bool shark::Data< Type >::empty ( ) const
inline

Check whether the set is empty.

Definition at line 218 of file Dataset.h.

§ empty() [2/2]

template<class InputT, class LabelT>
bool shark::LabeledData< InputT, LabelT >::empty ( ) const
inline

§ export_kernel_matrix() [1/2]

template<typename InputType , typename LabelType >
void shark::export_kernel_matrix ( LabeledData< InputType, LabelType > const &  dataset,
AbstractKernelFunction< InputType > &  kernel,
std::ostream &  out,
KernelMatrixNormalizationType  normalizer = NONE,
bool  scientific = false,
unsigned int  fieldwidth = 0 
)

Definition at line 299 of file ExportKernelMatrix.h.

References shark::exportKernelMatrix().

§ export_kernel_matrix() [2/2]

template<typename InputType , typename LabelType >
void shark::export_kernel_matrix ( LabeledData< InputType, LabelType > const &  dataset,
AbstractKernelFunction< InputType > &  kernel,
std::string  fn,
KernelMatrixNormalizationType  normalizer = NONE,
bool  sci = false,
unsigned int  width = 0 
)

Definition at line 314 of file ExportKernelMatrix.h.

References shark::exportKernelMatrix().

§ export_libsvm()

template<typename InputType >
void shark::export_libsvm ( LabeledData< InputType, unsigned int > &  dataset,
const std::string &  fn,
bool  dense = false,
bool  oneMinusOne = true,
bool  sortLabels = false,
bool  append = false 
)
inline

Export data to LIBSVM format.

Deprecated:
use exportSparseData instead
Parameters
datasetContainer storing the data
fnOutput file
denseFlag for using dense output format
oneMinusOneFlag for applying the transformation y<-2y-1 to binary labels
sortLabelsFlag for sorting data points according to labels
appendFlag for appending to the output file instead of overwriting it

Definition at line 127 of file Libsvm.h.

References shark::exportSparseData().

§ exportCSV() [1/2]

template<typename Type >
void shark::exportCSV ( Data< Type > const &  set,
std::string  fn,
char  separator = ',',
bool  sci = true,
unsigned int  width = 0 
)

Format unlabeled data into a character-separated value file.

Parameters
setContainer to be exported
fnThe file to be written to
separatorSeparator between entries, typically a comma or a space
scishould the output be in scientific notation?
widthargument to std::setw when writing the output

Definition at line 474 of file Csv.h.

References shark::exportCSV().

§ exportCSV() [2/2]

template<typename InputType , typename LabelType >
void shark::exportCSV ( LabeledData< InputType, LabelType > const &  dataset,
std::string  fn,
LabelPosition  lp,
char  separator = ',',
bool  sci = true,
unsigned int  width = 0 
)

Format labeled data into a character-separated value file.

Parameters
datasetContainer to be exported
fnThe file to be written to
lpPosition of the label in the record, either first or last column
separatorSeparator between entries, typically a comma or a space
scishould the output be in scientific notation?
widthargument to std::setw when writing the output

Definition at line 495 of file Csv.h.

Referenced by shark::exportCSV().

§ exportKernelMatrix() [1/2]

template<typename InputType , typename LabelType >
void shark::exportKernelMatrix ( LabeledData< InputType, LabelType > const &  dataset,
AbstractKernelFunction< InputType > &  kernel,
std::ostream &  out,
KernelMatrixNormalizationType  normalizer = NONE,
bool  scientific = false,
unsigned int  fieldwidth = 0 
)

Write a kernel Gram matrix to stream.

Parameters
datasetdata basis for the Gram matrix
kernelpointer to kernel function to be used
outThe stream to be written to
normalizerwhat kind of normalization to apply. see enum declaration for details.
scientificshould the output be in scientific notation?
fieldwidthfield width for pretty printing

Definition at line 76 of file ExportKernelMatrix.h.

References shark::CENTER_AND_MULTIPLICATIVE_TRACE_ONE, shark::CENTER_ONLY, shark::Data< Type >::elements(), shark::AbstractKernelFunction< InputTypeT >::eval(), shark::ScaledKernel< InputType >::factor(), shark::LabeledData< InputT, LabelT >::inputs(), shark::LabeledData< InputT, LabelT >::labels(), shark::mean(), shark::MULTIPLICATIVE_TRACE_N, shark::MULTIPLICATIVE_TRACE_ONE, shark::MULTIPLICATIVE_VARIANCE_ONE, shark::NONE, SHARK_ASSERT, SHARKEXCEPTION, shark::size(), shark::DataView< DatasetType >::size(), SIZE_CHECK, shark::blas::trace(), and shark::NormalizeKernelUnitVariance< InputType >::train().

Referenced by shark::export_kernel_matrix(), and shark::exportKernelMatrix().

§ exportKernelMatrix() [2/2]

template<typename InputType , typename LabelType >
void shark::exportKernelMatrix ( LabeledData< InputType, LabelType > const &  dataset,
AbstractKernelFunction< InputType > &  kernel,
std::string  fn,
KernelMatrixNormalizationType  normalizer = NONE,
bool  sci = false,
unsigned int  width = 0 
)

Write a kernel Gram matrix to file.

Parameters
datasetdata basis for the Gram matrix
kernelpointer to kernel function to be used
fnThe filename of the file to be written to
normalizerwhat kind of normalization to apply. see enum declaration for details.
scishould the output be in scientific notation?
widthfield width for pretty printing

Definition at line 275 of file ExportKernelMatrix.h.

References shark::exportKernelMatrix().

§ exportSparseData()

template<typename InputType >
void shark::exportSparseData ( LabeledData< InputType, unsigned int > &  dataset,
const std::string &  fn,
bool  dense = false,
bool  oneMinusOne = true,
bool  sortLabels = false,
bool  append = false 
)

Export data to sparse data (libSVM) format.

Parameters
datasetContainer storing the data
fnOutput file
denseFlag for using dense output format
oneMinusOneFlag for applying the transformation y<-2y-1 to binary labels
sortLabelsFlag for sorting data points according to labels
appendFlag for appending to the output file instead of overwriting it

Definition at line 129 of file SparseData.h.

References shark::LabeledData< InputT, LabelT >::element(), shark::inputDimension(), shark::numberOfClasses(), shark::LabeledData< InputT, LabelT >::numberOfElements(), and SHARKEXCEPTION.

Referenced by shark::export_libsvm().

§ generalSolveSystemInPlace() [1/2]

template<class System , class MatT , class VecT >
void shark::blas::generalSolveSystemInPlace ( matrix_expression< MatT > const &  A,
vector_expression< VecT > &  b 
)

Solves a non-square system of linear equations.

Given a \( m \times n \) input matrix A this function uses the generalized inverse of A to solve the system of linear equations. If b is not in the span of Ax or xA, the least squares solution is used, that is we minimize ||Ax-b||^2

The computation is carried out in-place.

Parameters
A\( n \times m \) input matrix.
bright hand side of the problem.

§ generalSolveSystemInPlace() [2/2]

template<class System , class MatA , class MatB >
void shark::blas::generalSolveSystemInPlace ( matrix_expression< MatA > const &  A,
matrix_expression< MatB > &  B 
)

Solves multiple non-square systems of linear equations.

Given a \( m \times n \) input matrix A this function uses the generalized inverse of A to solve the system of linear equations AX=B. If b_i is not in the span of Ax_i or x_iA, the least squares solution is used, that is we minimize ||Ax_i-b_i||^2 for all columns b_i of B.

The computation is carried out in-place.

Parameters
A\( n \times m \) input matrix.
B\( n \times k \) right hand sied matrix.

§ getColumn()

template<typename RowType >
RowType shark::getColumn ( const Data< RowType > &  data,
std::size_t  columnID 
)

§ getPartitioning() [1/2]

template<class Type>
std::vector<std::size_t> shark::Data< Type >::getPartitioning ( ) const
inline

Creates a vector with the batch sizes of every batch.

This method can be used together with repartition to ensure that two datasets have the same batch structure.

Definition at line 319 of file Dataset.h.

§ getPartitioning() [2/2]

template<class InputT, class LabelT>
std::vector<std::size_t> shark::LabeledData< InputT, LabelT >::getPartitioning ( ) const
inline

Creates a vector with the batch sizes of every batch.

This method can be used together with repartition to ensure that two datasets have the same batch structure.

Definition at line 704 of file Dataset.h.

§ import_libsvm() [1/4]

void shark::import_libsvm ( LabeledData< RealVector, unsigned int > &  dataset,
std::istream &  stream,
unsigned int  highestIndex = 0,
std::size_t  batchSize = LabeledData<RealVector, unsigned int>::DefaultBatchSize 
)
inline

Import data from a LIBSVM file.

Deprecated:
use importSparseData instead
Parameters
datasetcontainer storing the loaded data
streamstream to be read from
highestIndexhighest feature index, or 0 for auto-detection
batchSizesize of batch

Definition at line 59 of file Libsvm.h.

References shark::importSparseData().

§ import_libsvm() [2/4]

void shark::import_libsvm ( LabeledData< CompressedRealVector, unsigned int > &  dataset,
std::istream &  stream,
unsigned int  highestIndex = 0,
std::size_t  batchSize = LabeledData<RealVector, unsigned int>::DefaultBatchSize 
)
inline

Import data from a LIBSVM file.

Deprecated:
use importSparseData instead
Parameters
datasetcontainer storing the loaded data
streamstream to be read from
highestIndexhighest feature index, or 0 for auto-detection
batchSizesize of batch

Definition at line 75 of file Libsvm.h.

References shark::importSparseData().

§ import_libsvm() [3/4]

void shark::import_libsvm ( LabeledData< RealVector, unsigned int > &  dataset,
std::string  fn,
unsigned int  highestIndex = 0,
std::size_t  batchSize = LabeledData<RealVector, unsigned int>::DefaultBatchSize 
)
inline

Import data from a LIBSVM file.

Deprecated:
use importSparseData instead
Parameters
datasetcontainer storing the loaded data
fnthe file to be read from
highestIndexhighest feature index, or 0 for auto-detection
batchSizesize of batch

Definition at line 91 of file Libsvm.h.

References shark::importSparseData().

§ import_libsvm() [4/4]

void shark::import_libsvm ( LabeledData< CompressedRealVector, unsigned int > &  dataset,
std::string  fn,
unsigned int  highestIndex = 0,
std::size_t  batchSize = LabeledData<RealVector, unsigned int>::DefaultBatchSize 
)
inline

Import data from a LIBSVM file.

Deprecated:
use importSparseData instead
Parameters
datasetcontainer storing the loaded data
fnthe file to be read from
highestIndexhighest feature index, or 0 for auto-detection
batchSizesize of batch

Definition at line 107 of file Libsvm.h.

References shark::importSparseData().

§ importCSV() [1/3]

template<class T >
void shark::importCSV ( Data< T > &  data,
std::string  fn,
char  separator = ',',
char  comment = '#',
std::size_t  maximumBatchSize = Data<T>::DefaultBatchSize,
std::size_t  titleLines = 0 
)

Import a Dataset from a csv file.

Parameters
dataContainer storing the loaded data
fnThe file to be read from
separatorOptional separator between entries, typically a comma, spaces ar automatically ignored
commentTrailing character indicating comment line. By dfault it is '#'
maximumBatchSizeSize of batches in the dataset
titleLinesSpecifies a number of lines to be skipped in the beginning of the file

Definition at line 385 of file Csv.h.

References shark::csvStringToData(), and shark::blas::max().

Referenced by getSamples(), loadData(), and main().

§ importCSV() [2/3]

template<class T >
void shark::importCSV ( LabeledData< blas::vector< T >, unsigned int > &  data,
std::string  fn,
LabelPosition  lp,
char  separator = ',',
char  comment = '#',
std::size_t  maximumBatchSize = LabeledData<RealVector, unsigned int>::DefaultBatchSize 
)

Import a labeled Dataset from a csv file.

Parameters
dataContainer storing the loaded data
fnThe file to be read from
lpPosition of the label in the record, either first or last column
separatorOptional separator between entries, typically a comma, spaces ar automatically ignored
commentTrailing character indicating comment line. By dfault it is '#'
maximumBatchSizeSize of batches in the dataset

Definition at line 417 of file Csv.h.

References shark::csvStringToData().

§ importCSV() [3/3]

template<class T >
void shark::importCSV ( LabeledData< blas::vector< T >, blas::vector< T > > &  data,
std::string  fn,
LabelPosition  lp,
std::size_t  numberOfOutputs = 1,
char  separator = ',',
char  comment = '#',
std::size_t  maximumBatchSize = LabeledData<RealVector, RealVector>::DefaultBatchSize 
)

Import a labeled Dataset from a csv file.

Parameters
dataContainer storing the loaded data
fnThe file to be read from
lpPosition of the label in the record, either first or last column
numberOfOutputsdimensionality of the labels
separatorOptional separator between entries, typically a comma, spaces ar automatically ignored
commentTrailing character indicating comment line. By dfault it is '#'
maximumBatchSizeSize of batches in the dataset

Definition at line 446 of file Csv.h.

References shark::csvStringToData().

§ importSparseData() [1/4]

SHARK_EXPORT_SYMBOL void shark::importSparseData ( LabeledData< RealVector, unsigned int > &  dataset,
std::istream &  stream,
unsigned int  highestIndex = 0,
std::size_t  batchSize = LabeledData< RealVector, unsigned int >::DefaultBatchSize 
)

Import data from a sparse data (libSVM) file.

Parameters
datasetcontainer storing the loaded data
streamstream to be read from
highestIndexhighest feature index, or 0 for auto-detection
batchSizesize of batch

Referenced by shark::import_libsvm(), and main().

§ importSparseData() [2/4]

SHARK_EXPORT_SYMBOL void shark::importSparseData ( LabeledData< CompressedRealVector, unsigned int > &  dataset,
std::istream &  stream,
unsigned int  highestIndex = 0,
std::size_t  batchSize = LabeledData< RealVector, unsigned int >::DefaultBatchSize 
)

Import data from a sparse data (libSVM) file.

Parameters
datasetcontainer storing the loaded data
streamstream to be read from
highestIndexhighest feature index, or 0 for auto-detection
batchSizesize of batch

§ importSparseData() [3/4]

SHARK_EXPORT_SYMBOL void shark::importSparseData ( LabeledData< RealVector, unsigned int > &  dataset,
std::string  fn,
unsigned int  highestIndex = 0,
std::size_t  batchSize = LabeledData< RealVector, unsigned int >::DefaultBatchSize 
)

Import data from a sparse data (libSVM) file.

Parameters
datasetcontainer storing the loaded data
fnthe file to be read from
highestIndexhighest feature index, or 0 for auto-detection
batchSizesize of batch

§ importSparseData() [4/4]

SHARK_EXPORT_SYMBOL void shark::importSparseData ( LabeledData< CompressedRealVector, unsigned int > &  dataset,
std::string  fn,
unsigned int  highestIndex = 0,
std::size_t  batchSize = LabeledData< RealVector, unsigned int >::DefaultBatchSize 
)

Import data from a sparse data (libSVM) file.

Parameters
datasetcontainer storing the loaded data
fnthe file to be read from
highestIndexhighest feature index, or 0 for auto-detection
batchSizesize of batch

§ indexedSubset() [1/5]

template<class Type>
void shark::Data< Type >::indexedSubset ( IndexSet const &  indices,
self_type subset 
) const
inline

Fill in the subset defined by the list of indices.

Definition at line 325 of file Dataset.h.

Referenced by shark::binarySubProblem(), and shark::rangeSubset().

§ indexedSubset() [2/5]

template<class Type>
void shark::Data< Type >::indexedSubset ( IndexSet const &  indices,
self_type subset,
self_type complement 
) const
inline

Fill in the subset defined by the list of indices as well as its complement.

Definition at line 330 of file Dataset.h.

§ indexedSubset() [3/5]

template<class InputT, class LabelT>
void shark::LabeledData< InputT, LabelT >::indexedSubset ( IndexSet const &  indices,
self_type subset 
) const
inline

Fill in the subset defined by the list of indices.

Definition at line 717 of file Dataset.h.

Referenced by main().

§ indexedSubset() [4/5]

template<class InputT, class LabelT>
void shark::LabeledData< InputT, LabelT >::indexedSubset ( IndexSet const &  indices,
self_type subset,
self_type complement 
) const
inline

Fill in the subset defined by the list of indices as well as its complement.

Definition at line 723 of file Dataset.h.

§ indexedSubset() [5/5]

template<class DatasetT >
DatasetT shark::indexedSubset ( DatasetT const &  dataset,
typename DatasetT::IndexSet const &  indices 
)

§ init() [1/4]

template<class Source >
detail::ADLVector<Source&> shark::blas::init ( vector_container< Source > &  source)

Starting-point for the initialization sequence.

Usage: init(vector)<<a,b,c where vector is a ublas vector or sub-vector and a,b,c are either scalars or vectors. In debug mode, it is checked that size(vector) == size(a,b,c)

Definition at line 59 of file Initialize.h.

Referenced by shark::LooErrorCSvm< InputType, CacheType >::eval(), shark::NegativeGaussianProcessEvidence< InputType, OutputType, LabelType >::eval(), shark::NegativeGaussianProcessEvidence< InputType, OutputType, LabelType >::evalDerivative(), shark::LMCMA::init(), shark::ConvexCombination::parameterVector(), shark::RFTrainer::parameterVector(), shark::ProductKernel< InputType >::parameterVector(), shark::EpsilonSvmTrainer< InputType, CacheType >::parameterVector(), shark::Autoencoder< HiddenNeuron, OutputNeuron >::parameterVector(), shark::LinearModel< VectorType >::parameterVector(), shark::TiedAutoencoder< HiddenNeuron, OutputNeuron >::parameterVector(), shark::RBM< VisibleLayerT, HiddenLayerT, RngT >::parameterVector(), shark::ConvolutionalRBM< VisibleLayerT, HiddenLayerT, RngT >::parameterVector(), GaussianTaskKernel< InputTypeT >::parameterVector(), shark::Normalizer< DataType >::parameterVector(), shark::KernelExpansion< RealVector >::parameterVector(), shark::FFNet< HiddenNeuron, OutputNeuron >::parameterVector(), shark::KernelSGDTrainer< InputType, CacheType >::parameterVector(), shark::AbstractSvmTrainer< InputType, RealVector, KernelExpansion< InputType > >::parameterVector(), shark::KernelBudgetedSGDTrainer< InputType, CacheType >::parameterVector(), shark::ConvexCombination::setParameterVector(), shark::ProductKernel< InputType >::setParameterVector(), shark::Autoencoder< HiddenNeuron, OutputNeuron >::setParameterVector(), shark::TiedAutoencoder< HiddenNeuron, OutputNeuron >::setParameterVector(), shark::LinearModel< VectorType >::setParameterVector(), shark::RBM< VisibleLayerT, HiddenLayerT, RngT >::setParameterVector(), shark::ConvolutionalRBM< VisibleLayerT, HiddenLayerT, RngT >::setParameterVector(), GaussianTaskKernel< InputTypeT >::setParameterVector(), shark::Normalizer< DataType >::setParameterVector(), shark::KernelExpansion< RealVector >::setParameterVector(), shark::FFNet< HiddenNeuron, OutputNeuron >::setParameterVector(), shark::KernelSGDTrainer< InputType, CacheType >::setParameterVector(), shark::AbstractSvmTrainer< InputType, RealVector, KernelExpansion< InputType > >::setParameterVector(), and shark::KernelBudgetedSGDTrainer< InputType, CacheType >::setParameterVector().

§ init() [2/4]

template<class Source >
detail::ADLVector<const Source&> shark::blas::init ( const vector_container< Source > &  source)

Starting-point for the initialization sequence.

Usage: init(vector)<<a,b,c where vector is a ublas vector or sub-vector and a,b,c are either scalars or vectors. In debug mode, it is checked that size(vector) == size(a,b,c)

Definition at line 67 of file Initialize.h.

§ init() [3/4]

template<class Source >
detail::ADLVector<vector_range<Source> > shark::blas::init ( const vector_range< Source > &  source)

Starting-point for the initialization sequence when used for splitting the vector.

Usage: init(vector)>>a,b,c where vector is a ublas vector or sub-vector and a,b,c are mutable scalars or vectors. In debug mode, it is checked that size(vector) == size(a,b,c) Specialization for ublas vector_range.

Definition at line 83 of file Initialize.h.

§ init() [4/4]

template<class Source >
detail::ADLVector<matrix_row<Source> > shark::blas::init ( const matrix_row< Source > &  source)

Specialization for matrix rows.

Definition at line 90 of file Initialize.h.

§ initRandomNormal()

template<class InputType , class OutputType >
void shark::initRandomNormal ( AbstractModel< InputType, OutputType > &  model,
double  s 
)

Initialize model parameters normally distributed.

Parameters
modelmodel to be initialized
svariance of mean-free normal distribution

Definition at line 326 of file AbstractModel.h.

References shark::gauss(), shark::IParameterizable::numberOfParameters(), and shark::IParameterizable::setParameterVector().

Referenced by main(), and unsupervisedPreTraining().

§ initRandomUniform()

template<class InputType , class OutputType >
void shark::initRandomUniform ( AbstractModel< InputType, OutputType > &  model,
double  l,
double  h 
)

Initialize model parameters uniformly at random.

Parameters
modelmodel to be initialized
llower bound of initialization interval
hupper bound of initialization interval

Definition at line 341 of file AbstractModel.h.

References shark::IParameterizable::numberOfParameters(), shark::IParameterizable::setParameterVector(), and shark::uni().

Referenced by experiment(), main(), trainAutoencoderModel(), and trainRBM().

§ inputDimension()

§ inputs() [1/4]

template<class InputT>
self_type& shark::UnlabeledData< InputT >::inputs ( )
inline

Access to the base_type class as "inputs".

Added for consistency with the LabeledData::labels() method.

Definition at line 417 of file Dataset.h.

Referenced by shark::WeightedLabeledData< InputT, LabelT >::inputs().

§ inputs() [2/4]

template<class InputT>
self_type const& shark::UnlabeledData< InputT >::inputs ( ) const
inline

Access to the base_type class as "inputs".

Added for consistency with the LabeledData::labels() method.

Definition at line 424 of file Dataset.h.

§ inputs() [3/4]

template<class InputT, class LabelT>
InputContainer const& shark::LabeledData< InputT, LabelT >::inputs ( ) const
inline

Access to inputs as a separate container.

Definition at line 556 of file Dataset.h.

Referenced by shark::ProjectBudgetMaintenanceStrategy< RealVector >::addToModel(), shark::CARTClassifier< RealVector >::computeFeatureImportances(), shark::CARTClassifier< RealVector >::computeOOBerror(), shark::RadiusMarginQuotient< InputType, CacheType >::computeRadiusMargin(), shark::Autoencoder< HiddenNeuron, OutputNeuron >::decode(), shark::TiedAutoencoder< HiddenNeuron, OutputNeuron >::decode(), shark::TiedAutoencoder< HiddenNeuron, OutputNeuron >::encode(), shark::Autoencoder< HiddenNeuron, OutputNeuron >::encode(), shark::LooErrorCSvm< InputType, CacheType >::eval(), shark::NegativeGaussianProcessEvidence< InputType, OutputType, LabelType >::eval(), shark::CrossValidationError< ModelTypeT, LabelTypeT >::eval(), shark::SvmLogisticInterpretation< InputType >::eval(), shark::RadiusMarginQuotient< InputType, CacheType >::evalDerivative(), shark::NegativeGaussianProcessEvidence< InputType, OutputType, LabelType >::evalDerivative(), shark::SvmLogisticInterpretation< InputType >::evalDerivative(), experiment(), shark::exportKernelMatrix(), shark::inputDimension(), main(), shark::repartitionByClass(), run_one_trial(), shark::MissingFeatureSvmTrainer< InputType, CacheType >::setMaxIterations(), shark::Perceptron< InputType >::train(), shark::KernelMeanClassifier< InputType >::train(), shark::McReinforcedSvmTrainer< InputType, CacheType >::train(), shark::MissingFeatureSvmTrainer< InputType, CacheType >::train(), shark::McSvmOVATrainer< InputType, CacheType >::train(), shark::McSvmCSTrainer< InputType, CacheType >::train(), shark::McSvmMMRTrainer< InputType, CacheType >::train(), shark::McSvmLLWTrainer< InputType, CacheType >::train(), shark::McSvmWWTrainer< InputType, CacheType >::train(), shark::RegularizationNetworkTrainer< InputType >::train(), shark::McSvmADMTrainer< InputType, CacheType >::train(), shark::McSvmATMTrainer< InputType, CacheType >::train(), shark::McSvmATSTrainer< InputType, CacheType >::train(), shark::EpsilonSvmTrainer< InputType, CacheType >::train(), shark::KernelSGDTrainer< InputType, CacheType >::train(), shark::CSvmTrainer< InputType, CacheType >::train(), shark::KernelBudgetedSGDTrainer< InputType, CacheType >::train(), shark::SquaredHingeCSvmTrainer< InputType, CacheType >::train(), shark::LassoRegression< InputVectorType >::trainInternal(), trainProblem(), shark::transformInputs(), and shark::transformLabels().

§ inputs() [4/4]

template<class InputT, class LabelT>
InputContainer& shark::LabeledData< InputT, LabelT >::inputs ( )
inline

Access to inputs as a separate container.

Definition at line 560 of file Dataset.h.

§ labelDimension()

template<class InputType , class LabelType >
std::size_t shark::labelDimension ( LabeledData< InputType, LabelType > const &  dataset)

Return the label/output dimensionality of a labeled dataset.

Definition at line 865 of file Dataset.h.

References shark::dataDimension(), and shark::LabeledData< InputT, LabelT >::labels().

Referenced by shark::labelDimension(), main(), and shark::EpsilonSvmTrainer< InputType, CacheType >::train().

§ LabeledData() [1/4]

template<class InputT, class LabelT>
shark::LabeledData< InputT, LabelT >::LabeledData ( )
inline

Empty data set.

Definition at line 576 of file Dataset.h.

§ LabeledData() [2/4]

template<class InputT, class LabelT>
shark::LabeledData< InputT, LabelT >::LabeledData ( std::size_t  numBatches)
inline

Create an empty set with just the correct number of batches.

The user must initialize the dataset after that by himself.

Definition at line 582 of file Dataset.h.

§ LabeledData() [3/4]

template<class InputT, class LabelT>
shark::LabeledData< InputT, LabelT >::LabeledData ( std::size_t  size,
element_type const &  element,
std::size_t  batchSize = DefaultBatchSize 
)
inline

Optionally the desired batch Size can be set

Parameters
sizethe new size of the container
elementthe blueprint element from which to create the Container
batchSizethe size of the batches. if this is 0, the size is unlimited

Definition at line 592 of file Dataset.h.

§ LabeledData() [4/4]

template<class InputT, class LabelT>
shark::LabeledData< InputT, LabelT >::LabeledData ( Data< InputType > const &  inputs,
Data< LabelType > const &  labels 
)
inline

Construction from data.

Beware that when calling this constructor the organization of batches must be equal in both containers. This Constructor will not split the data!

Definition at line 601 of file Dataset.h.

§ labels() [1/2]

template<class InputT, class LabelT>
LabelContainer const& shark::LabeledData< InputT, LabelT >::labels ( ) const
inline

Access to labels as a separate container.

Definition at line 565 of file Dataset.h.

Referenced by shark::classSizes(), shark::CARTClassifier< RealVector >::computeFeatureImportances(), shark::CARTClassifier< RealVector >::computeOOBerror(), shark::RadiusMarginQuotient< InputType, CacheType >::computeRadiusMargin(), shark::TiedAutoencoder< HiddenNeuron, OutputNeuron >::decode(), shark::Autoencoder< HiddenNeuron, OutputNeuron >::decode(), shark::Autoencoder< HiddenNeuron, OutputNeuron >::encode(), shark::TiedAutoencoder< HiddenNeuron, OutputNeuron >::encode(), shark::LooErrorCSvm< InputType, CacheType >::eval(), shark::NegativeGaussianProcessEvidence< InputType, OutputType, LabelType >::eval(), shark::CrossValidationError< ModelTypeT, LabelTypeT >::eval(), shark::SvmLogisticInterpretation< InputType >::eval(), shark::NegativeGaussianProcessEvidence< InputType, OutputType, LabelType >::evalDerivative(), shark::SvmLogisticInterpretation< InputType >::evalDerivative(), experiment(), shark::exportKernelMatrix(), shark::KernelTargetAlignment< InputType, LabelType >::KernelTargetAlignment(), shark::labelDimension(), main(), shark::LabelOrder::normalizeLabels(), shark::numberOfClasses(), shark::repartitionByClass(), shark::LabelOrder::restoreOriginalLabels(), run_one_trial(), shark::MissingFeatureSvmTrainer< InputType, CacheType >::setMaxIterations(), shark::McReinforcedSvmTrainer< InputType, CacheType >::train(), shark::McSvmCSTrainer< InputType, CacheType >::train(), shark::McSvmMMRTrainer< InputType, CacheType >::train(), shark::McSvmLLWTrainer< InputType, CacheType >::train(), shark::McSvmATMTrainer< InputType, CacheType >::train(), shark::McSvmADMTrainer< InputType, CacheType >::train(), shark::McSvmWWTrainer< InputType, CacheType >::train(), shark::RegularizationNetworkTrainer< InputType >::train(), shark::McSvmATSTrainer< InputType, CacheType >::train(), shark::KernelSGDTrainer< InputType, CacheType >::train(), shark::CSvmTrainer< InputType, CacheType >::train(), shark::KernelBudgetedSGDTrainer< InputType, CacheType >::train(), shark::SquaredHingeCSvmTrainer< InputType, CacheType >::train(), shark::LassoRegression< InputVectorType >::trainInternal(), trainProblem(), shark::transformInputs(), and shark::transformLabels().

§ labels() [2/2]

template<class InputT, class LabelT>
LabelContainer& shark::LabeledData< InputT, LabelT >::labels ( )
inline

Access to labels as a separate container.

Definition at line 569 of file Dataset.h.

§ makeIndependent() [1/2]

template<class Type>
virtual void shark::Data< Type >::makeIndependent ( )
inlinevirtual

This method makes the vector independent of all siblings and parents.

Definition at line 273 of file Dataset.h.

Referenced by main().

§ makeIndependent() [2/2]

template<class InputT, class LabelT>
virtual void shark::LabeledData< InputT, LabelT >::makeIndependent ( )
inlinevirtual

This method makes the vector independent of all siblings and parents.

Definition at line 642 of file Dataset.h.

Referenced by shark::CARTClassifier< RealVector >::computeFeatureImportances(), and main().

§ matrixSet() [1/2]

template<class T >
detail::InitializerRange<typename T::const_iterator,detail::MatrixExpression<const typename T::value_type> > shark::blas::matrixSet ( const T &  range)

Uses a range of vectors for initialization.

Sometimes not a single matrix but a set of matrices is needed as argument like std::deque<RealMatrix> set; in this case, matrixSet is needed init(vec)<<vec1,matrixSet(set),vec2;

Definition at line 169 of file Initialize.h.

Referenced by shark::ConvolutionalRBM< VisibleLayerT, HiddenLayerT, RngT >::parameterVector(), shark::FFNet< HiddenNeuron, OutputNeuron >::parameterVector(), shark::ConvolutionalRBM< VisibleLayerT, HiddenLayerT, RngT >::setParameterVector(), and shark::FFNet< HiddenNeuron, OutputNeuron >::setParameterVector().

§ matrixSet() [2/2]

template<class T >
detail::InitializerRange<typename T::iterator,detail::MatrixExpression<typename T::value_type> > shark::blas::matrixSet ( T &  range)

Uses a range of vectors for splitting and initialization.

Sometimes not a single matrix but a set of matrices is needed as argument like std::deque<RealMatrix> set; in this case, vectorSet is needed init(vec)>>vec1,matrixSet(set),vec2;

Definition at line 183 of file Initialize.h.

§ maxExpInput()

template<class T >
T shark::maxExpInput ( )

Maximum allowed input value for exp.

Definition at line 70 of file Math.h.

§ minExpInput()

template<class T >
T shark::minExpInput ( )

Minimum value for exp(x) allowed so that it is not 0.

Definition at line 75 of file Math.h.

§ Multiply() [1/2]

shark::Multiply::Multiply ( double  factor)
inline
Parameters
factorAll components of all vectors in the dataset are multiplied by this number

Definition at line 1116 of file Dataset.h.

§ Multiply() [2/2]

shark::Multiply::Multiply ( const RealVector  factor)
inline
Parameters
factorFor all elements in the dataset, the i-th component is multiplied with the i-th component of this vector

Definition at line 1118 of file Dataset.h.

§ numberOfBatches() [1/2]

§ numberOfBatches() [2/2]

§ numberOfClasses() [1/2]

unsigned int shark::numberOfClasses ( Data< unsigned int > const &  labels)
inline

Return the number of classes of a set of class labels with unsigned int label encoding.

Definition at line 830 of file Dataset.h.

References shark::Data< Type >::batch(), shark::blas::max(), and shark::Data< Type >::numberOfBatches().

Referenced by shark::classSizes(), shark::createCVSameSizeBalanced(), experiment(), shark::exportSparseData(), shark::JaakkolaHeuristic::JaakkolaHeuristic(), main(), shark::numberOfClasses(), shark::KernelMeanClassifier< InputType >::train(), shark::NBClassifierTrainer< InputType, OutputType >::train(), shark::McReinforcedSvmTrainer< InputType, CacheType >::train(), shark::MissingFeatureSvmTrainer< InputType, CacheType >::train(), shark::McSvmOVATrainer< InputType, CacheType >::train(), shark::McSvmCSTrainer< InputType, CacheType >::train(), shark::McSvmMMRTrainer< InputType, CacheType >::train(), shark::McSvmLLWTrainer< InputType, CacheType >::train(), shark::McSvmATMTrainer< InputType, CacheType >::train(), shark::McSvmWWTrainer< InputType, CacheType >::train(), shark::McSvmADMTrainer< InputType, CacheType >::train(), shark::McSvmATSTrainer< InputType, CacheType >::train(), shark::KernelSGDTrainer< InputType, CacheType >::train(), shark::LinearMcSvmOVATrainer< InputType >::train(), shark::LinearMcSvmMMRTrainer< InputType >::train(), shark::LinearMcSvmReinforcedTrainer< InputType >::train(), shark::KernelBudgetedSGDTrainer< InputType, CacheType >::train(), shark::LinearMcSvmLLWTrainer< InputType >::train(), shark::LinearMcSvmADMTrainer< InputType >::train(), shark::LinearMcSvmATSTrainer< InputType >::train(), shark::LinearMcSvmATMTrainer< InputType >::train(), shark::LinearMcSvmCSTrainer< InputType >::train(), and shark::LinearMcSvmWWTrainer< InputType >::train().

§ numberOfClasses() [2/2]

template<class InputType >
std::size_t shark::numberOfClasses ( LabeledData< InputType, unsigned int > const &  dataset)

Return the number of classes (highest label value +1) of a classification dataset with unsigned int label encoding.

Definition at line 870 of file Dataset.h.

References shark::LabeledData< InputT, LabelT >::labels(), and shark::numberOfClasses().

§ numberOfElements() [1/2]

template<class Type>
std::size_t shark::Data< Type >::numberOfElements ( ) const
inline

Returns the total number of elements.

Definition at line 213 of file Dataset.h.

Referenced by shark::RemoveBudgetMaintenanceStrategy< InputType >::addToModel(), shark::ProjectBudgetMaintenanceStrategy< RealVector >::addToModel(), shark::MergeBudgetMaintenanceStrategy< RealVector >::addToModel(), shark::bootstrap(), shark::calculateMixedKernelMatrix(), shark::calculateRegularizedKernelMatrix(), shark::CSVMProblem< MatrixT >::CSVMProblem(), shark::dataDimension(), shark::NegativeAUC< LabelType, OutputType >::eval(), shark::ExactGradient< RBMType >::eval(), shark::NegativeLogLikelihood::eval(), shark::ZeroOneLoss< unsigned int, RealVector >::eval(), shark::AbstractLoss< unsigned int, RealVector >::eval(), shark::NegativeWilcoxonMannWhitneyStatistic< LabelType, OutputType >::eval(), shark::ExactGradient< RBMType >::evalDerivative(), shark::NegativeLogLikelihood::evalDerivative(), shark::SingleChainApproximator< MarkovChainType >::evalDerivative(), shark::ExampleModifiedKernelMatrix< InputType, CacheType >::ExampleModifiedKernelMatrix(), shark::exportFiltersToPGMGrid(), shark::GaussianKernelMatrix< T, CacheType >::GaussianKernelMatrix(), shark::GeneralQuadraticProblem< MatrixT >::GeneralQuadraticProblem(), shark::getColumn(), getSamples(), shark::MarkovChain< Operator >::initializeChain(), shark::TemperedMarkovChain< Operator >::initializeChain(), shark::KernelMatrix< InputType, CacheType >::KernelMatrix(), shark::kMeans(), shark::LabeledData< InputType, LabelType >::LabeledData(), main(), shark::QpMcBoxDecomp< Matrix >::QpMcBoxDecomp(), shark::QpMcSimplexDecomp< Matrix >::QpMcSimplexDecomp(), shark::MergeBudgetMaintenanceStrategy< RealVector >::reduceBudget(), shark::setColumn(), shark::MultiChainApproximator< MarkovChainType >::setData(), shark::KernelExpansion< RealVector >::setStructure(), shark::QpMcDecomp< Matrix >::solve(), shark::QpMcDecomp< Matrix >::solveSMO(), shark::KernelExpansion< RealVector >::sparsify(), shark::NormalizeComponentsWhitening::train(), shark::NormalizeComponentsZCA::train(), and shark::NormalizeKernelUnitVariance< InputType >::train().

§ numberOfElements() [2/2]

template<class InputT, class LabelT>
std::size_t shark::LabeledData< InputT, LabelT >::numberOfElements ( ) const
inline

Returns the total number of elements.

Definition at line 546 of file Dataset.h.

Referenced by shark::bootstrap(), shark::RadiusMarginQuotient< InputType, CacheType >::computeRadiusMargin(), shark::NegativeGaussianProcessEvidence< InputType, OutputType, LabelType >::eval(), shark::SvmLogisticInterpretation< InputType >::eval(), shark::NegativeGaussianProcessEvidence< InputType, OutputType, LabelType >::evalDerivative(), shark::SvmLogisticInterpretation< InputType >::evalDerivative(), shark::exportSparseData(), shark::JaakkolaHeuristic::JaakkolaHeuristic(), shark::KernelTargetAlignment< InputType, LabelType >::KernelTargetAlignment(), main(), shark::LabelOrder::normalizeLabels(), shark::LabelOrder::restoreOriginalLabels(), shark::MissingFeatureSvmTrainer< InputType, CacheType >::setMaxIterations(), shark::Pegasos< VectorType >::solve(), shark::McPegasos< VectorType >::solve(), shark::Perceptron< InputType >::train(), shark::KernelMeanClassifier< InputType >::train(), shark::NBClassifierTrainer< InputType, OutputType >::train(), shark::McReinforcedSvmTrainer< InputType, CacheType >::train(), shark::McSvmCSTrainer< InputType, CacheType >::train(), shark::McSvmMMRTrainer< InputType, CacheType >::train(), shark::McSvmLLWTrainer< InputType, CacheType >::train(), shark::McSvmWWTrainer< InputType, CacheType >::train(), shark::McSvmADMTrainer< InputType, CacheType >::train(), shark::McSvmATMTrainer< InputType, CacheType >::train(), shark::McSvmATSTrainer< InputType, CacheType >::train(), shark::KernelSGDTrainer< InputType, CacheType >::train(), shark::KernelBudgetedSGDTrainer< InputType, CacheType >::train(), and shark::SquaredHingeCSvmTrainer< InputType, CacheType >::train().

§ oneVersusRestProblem()

template<class I >
LabeledData<I,unsigned int> shark::oneVersusRestProblem ( LabeledData< I, unsigned int >const &  data,
unsigned int  oneClass 
)

Construct a binary (two-class) one-versus-rest problem from a multi-class problem.

The function returns a new LabeledData object. The input part coincides with the multi-class data, but the label part is replaced with binary labels 0 and 1. All instances of the given class (parameter oneClass) get a label of one, all others are assigned a label of zero.

Definition at line 1103 of file Dataset.h.

References shark::transformLabels().

Referenced by shark::McSvmOVATrainer< InputType, CacheType >::train(), and shark::LinearMcSvmOVATrainer< InputType >::train().

§ operator()() [1/5]

RealVector shark::Multiply::operator() ( RealVector  input) const
inline

Definition at line 1122 of file Dataset.h.

References SIZE_CHECK.

§ operator()() [2/5]

RealVector shark::Divide::operator() ( RealVector  input) const
inline

Definition at line 1150 of file Dataset.h.

References SIZE_CHECK.

§ operator()() [3/5]

RealVector shark::Shift::operator() ( RealVector  input) const
inline

Definition at line 1179 of file Dataset.h.

References SIZE_CHECK.

§ operator()() [4/5]

RealVector shark::Truncate::operator() ( RealVector  input) const
inline

Definition at line 1211 of file Dataset.h.

References shark::blas::max(), shark::blas::min(), and SIZE_CHECK.

§ operator()() [5/5]

RealVector shark::TruncateAndRescale::operator() ( RealVector  input) const
inline

Definition at line 1249 of file Dataset.h.

References shark::blas::max(), shark::blas::min(), and SIZE_CHECK.

§ operator<<() [1/2]

template<class T >
std::ostream& shark::operator<< ( std::ostream &  stream,
const Data< T > &  d 
)

Outstream of elements.

Definition at line 349 of file Dataset.h.

References shark::Data< Type >::elements().

§ operator<<() [2/2]

template<class T , class U >
std::ostream& shark::operator<< ( std::ostream &  stream,
const LabeledData< T, U > &  d 
)

brief Outstream of elements for labeled data.

Definition at line 817 of file Dataset.h.

References shark::Data< Type >::elements().

§ operator=()

template<class InputT>
self_type shark::UnlabeledData< InputT >::operator= ( Data< InputT > const &  data)
inline

we allow assignment from Data.

Definition at line 409 of file Dataset.h.

§ parameters() [1/2]

template<class T >
detail::ParameterizableExpression<const T> shark::blas::parameters ( const T &  object)

Uses the parameters of a parameterizable object for initialization.

The object doesn't have to be derived from IParameterizable, but needs to offer the methods

Definition at line 118 of file Initialize.h.

Referenced by shark::NestedGridSearch::configure(), shark::PointSearch::configure(), shark::LooErrorCSvm< InputType, CacheType >::eval(), shark::SvmLogisticInterpretation< InputType >::eval(), shark::KernelTargetAlignment< InputType, LabelType >::evalDerivative(), shark::SvmLogisticInterpretation< InputType >::evalDerivative(), shark::PointSearch::init(), shark::RBM< VisibleLayerT, HiddenLayerT, RngT >::numberOfParameters(), shark::ConvolutionalRBM< VisibleLayerT, HiddenLayerT, RngT >::numberOfParameters(), shark::NearestNeighborRegression< InputType >::parameterVector(), shark::NearestNeighborClassifier< InputType >::parameterVector(), shark::SoftNearestNeighborClassifier< InputType >::parameterVector(), shark::Autoencoder< HiddenNeuron, OutputNeuron >::parameterVector(), shark::TiedAutoencoder< HiddenNeuron, OutputNeuron >::parameterVector(), shark::RBM< VisibleLayerT, HiddenLayerT, RngT >::parameterVector(), shark::ConvolutionalRBM< VisibleLayerT, HiddenLayerT, RngT >::parameterVector(), GaussianTaskKernel< InputTypeT >::parameterVector(), shark::FFNet< HiddenNeuron, OutputNeuron >::parameterVector(), shark::KernelSGDTrainer< InputType, CacheType >::parameterVector(), shark::AbstractSvmTrainer< InputType, RealVector, KernelExpansion< InputType > >::parameterVector(), shark::KernelBudgetedSGDTrainer< InputType, CacheType >::parameterVector(), shark::RBM< VisibleLayerT, HiddenLayerT, RngT >::setParameterVector(), shark::ConvolutionalRBM< VisibleLayerT, HiddenLayerT, RngT >::setParameterVector(), GaussianTaskKernel< InputTypeT >::setParameterVector(), shark::KernelSGDTrainer< InputType, CacheType >::setParameterVector(), shark::AbstractSvmTrainer< InputType, RealVector, KernelExpansion< InputType > >::setParameterVector(), and shark::KernelBudgetedSGDTrainer< InputType, CacheType >::setParameterVector().

§ parameters() [2/2]

template<class T >
detail::ParameterizableExpression<T> shark::blas::parameters ( T &  object)

Uses the parameters of a parameterizable object for initialization.

The object doesn't have to be derived from IParameterizable, but needs to offer the methods

Definition at line 125 of file Initialize.h.

§ parameterSet() [1/2]

template<class T >
detail::InitializerRange<typename T::const_iterator, detail::ParameterizableExpression<const typename T::value_type> > shark::blas::parameterSet ( const T &  range)

Uses a range of parametrizable objects for initialization.

The objects in the set must offer the methods described by IParameterizable. Also pointer to objects are allowed

Definition at line 195 of file Initialize.h.

Referenced by shark::ProductKernel< InputType >::parameterVector(), and shark::ProductKernel< InputType >::setParameterVector().

§ parameterSet() [2/2]

template<class T >
detail::InitializerRange<typename T::iterator, detail::ParameterizableExpression<typename T::value_type> > shark::blas::parameterSet ( T &  range)

Uses a range of parametrizable objects for splitting and initialization.

The objects in the set must offer the methods described by IParameterizable. Also pointer to objects are allowed

Definition at line 206 of file Initialize.h.

§ pivotingCholeskyDecomposition()

template<class MatrixA , class MatrixL >
std::size_t shark::blas::pivotingCholeskyDecomposition ( matrix_expression< MatrixA > const &  A,
PermutationMatrix P,
matrix_expression< MatrixL > &  L 
)

Lower triangular Cholesky decomposition with full pivoting.

Given an \( m \times m \) symmetric positive semi-definite matrix \(A\), compute the lower triangular matrix \(L\) and permutation Matrix P such that \(P^TAP = LL^T \). If matrix A has rank(A) = k, the first k columns of A hold the full decomposition, while the rest of the matrix is zero. This method is slower than the cholesky decomposition without pivoting but numerically more stable. The diagonal elements are ordered such that i > j => L(i,i) >= L(j,j)

The implementation used here is described in the working paper "LAPACK-Style Codes for Level 2 and 3 Pivoted Cholesky Factorizations" http://www.netlib.org/lapack/lawnspdf/lawn161.pdf

Parameters
A\( m \times m \) matrix, which must be symmetric and positive definite
PThe pivoting matrix
L\( m \times m \) matrix, which stores the Cholesky factor
Returns
The rank of the matrix A

Definition at line 189 of file Cholesky.h.

References shark::blas::noalias(), shark::blas::pivotingCholeskyDecompositionInPlace(), and SIZE_CHECK.

§ pivotingCholeskyDecompositionInPlace()

template<class MatrixL >
std::size_t shark::blas::pivotingCholeskyDecompositionInPlace ( shark::blas::matrix_expression< MatrixL > &  Lref,
PermutationMatrix P 
)

Lower triangular Cholesky decomposition with full pivoting performed in place.

Given an \( m \times m \) symmetric positive semi-definite matrix \(A\), compute the lower triangular matrix \(L\) and permutation Matrix P such that \(P^TAP = LL^T \). If matrix A has rank(A) = k, the first k columns of A hold the full decomposition, while the rest of the matrix is zero. This method is slower than the cholesky decomposition without pivoting but numerically more stable. The diagonal elements are ordered such that i > j => L(i,i) >= L(j,j)

The implementation used here is described in the working paper "LAPACK-Style Codes for Level 2 and 3 Pivoted Cholesky Factorizations" http://www.netlib.org/lapack/lawnspdf/lawn161.pdf

The computation is carried out in place this means A is destroied and replaced by L.

Parameters
Lref\( m \times m \) matrix, which must be symmetric and positive definite. It is replaced by L in the end.
PThe pivoting matrix
Returns
The rank of the matrix A

Referenced by shark::blas::choleskyUpdate(), shark::blas::pivotingCholeskyDecomposition(), and shark::NormalizeComponentsWhitening::train().

§ pivotingRQ()

template<class MatrixT , class Mat >
std::size_t shark::blas::pivotingRQ ( blas::matrix_expression< MatrixT > const &  matrixA,
blas::matrix_container< Mat > &  matrixR,
blas::matrix_container< Mat > &  matrixQ,
blas::permutation_matrix permutation 
)

Determines the RQ Decomposition of the matrix A using pivoting returning the housholder transformation instead of Q.

The pivoting RQ-Decomposition finds an orthonormal matrix Q and a lower Triangular matrix R as well as a permutation matrix P such that PA = R*Q. Since Q is the multiplication of all householder transformations, It is quite expensive to compute. Often, Q is only an intermediate step in computations which can be carried out more efficiently using the Householder Transformations themselves.

The Matrix format of the householder transform is that the transformations are stored as upper triangular matrix. The first transformation being in the first row and so on.

§ pivotingRQHouseholder()

template<class MatrixT , class MatrixU >
std::size_t shark::blas::pivotingRQHouseholder ( blas::matrix_expression< MatrixT > const &  matrixA,
blas::matrix_container< MatrixU > &  matrixR,
blas::matrix_container< MatrixU > &  householderV,
blas::permutation_matrix permutation 
)

Determines the RQ Decomposition of the matrix A using pivoting.

The pivoting RQ-Decomposition finds an orthonormal matrix Q and a lower Triangular matrix R as well as a permuation matrix P such that PA = R*Q. This function is better known as the QR-Decomposition of a transposed matrix B^T = A and B = QR.

This version of the algorithm is based on householder transformations. since it uses pivoting it can be used to determine the rank of a matrix. The i-th applied householder decomposition has the form H_i=I-v_iv_i^T and the v_i are stored separately. A mxn natrix needs at most k=min{m,n} transformations. Also as RQ=AH_1,...,H_k Q=H_k,...,H_1

§ push_back() [1/3]

template<class Type>
void shark::Data< Type >::push_back ( const_batch_reference  batch)
inline

Definition at line 302 of file Dataset.h.

Referenced by shark::LabeledData< InputType, LabelType >::push_back().

§ push_back() [2/3]

template<class InputT, class LabelT>
void shark::LabeledData< InputT, LabelT >::push_back ( typename Batch< InputType >::type const &  inputs,
typename Batch< LabelType >::type const &  labels 
)
inline

Definition at line 675 of file Dataset.h.

§ push_back() [3/3]

template<class InputT, class LabelT>
void shark::LabeledData< InputT, LabelT >::push_back ( const_batch_reference  batch)
inline

Definition at line 683 of file Dataset.h.

§ randomRotationMatrix() [1/4]

template<class MatrixT , typename RngType >
void shark::blas::randomRotationMatrix ( matrix_container< MatrixT > &  matrixC,
RngType &  rng 
)

Initializes a matrix such that it forms a random rotation matrix.

The matrix needs to be quadratic and have the proper size (e.g. call matrix::resize before).

One common way to do this is using Gram-Schmidt-Orthogonalisation on a matrix which is initialized with gaussian numbers. However, this is highly unstable for big matrices.

This algorithm is implemented from one of the algorithms presented in Francesco Mezzadri "How to generate random matrices from the classical compact groups" http://arxiv.org/abs/math-ph/0609050v2

He gives two algorithms: the first one uses QR decomposition on the random gaussian matrix and ensures that the signs of Q are correct by multiplying every column of Q with the sign of the diagonal of R.

We use nother algorithm implemented in the paper which works similarly, but reversed. We apply Householder rotations H_N H_{N-1}..H_1 where H_1 is generated from a random vector on the n-dimensional unit sphere. this requires less operations and is thus preferable. Also only half the random numbers need to be generated

Definition at line 168 of file rotations.h.

References shark::blas::applyHouseholderOnTheLeft(), shark::blas::diag(), shark::blas::norm_2(), shark::blas::norm_sqr(), shark::blas::repeat(), shark::size(), SIZE_CHECK, and shark::blas::subrange().

Referenced by shark::RotatedObjectiveFunction::init(), shark::CIGTAB1::init(), shark::IHR4::init(), shark::IHR3::init(), shark::CIGTAB2::init(), shark::IHR1::init(), shark::IHR2::init(), shark::ELLI1::init(), shark::ELLI2::init(), shark::IHR6::init(), and shark::blas::randomRotationMatrix().

§ randomRotationMatrix() [2/4]

template<class MatrixT >
void shark::blas::randomRotationMatrix ( matrix_container< MatrixT > &  matrixC)

Initializes a matrix such that it forms a random rotation.

matrix. The matrix needs to be quadratic and have the proper size (e.g. call matrix::resize before) uses the global RNG.

Definition at line 203 of file rotations.h.

References shark::blas::randomRotationMatrix().

§ randomRotationMatrix() [3/4]

template<typename RngType >
RealMatrix shark::blas::randomRotationMatrix ( size_t  size,
RngType &  rng 
)

Creates a random rotation matrix with a certain size using the random number generator rng.

Definition at line 209 of file rotations.h.

References shark::blas::randomRotationMatrix().

§ randomRotationMatrix() [4/4]

RealMatrix shark::blas::randomRotationMatrix ( size_t  size)
inline

Creates a random rotation matrix with a certain size using the global random number gneerator.

Definition at line 216 of file rotations.h.

References shark::blas::randomRotationMatrix().

§ rangeSubset() [1/2]

template<class DatasetT >
DatasetT shark::rangeSubset ( DatasetT const &  dataset,
std::size_t  start,
std::size_t  end 
)

Fill in the subset of batches [start,...,size+start[.

Definition at line 892 of file Dataset.h.

References shark::Data< Type >::indexedSubset().

Referenced by main(), and shark::rangeSubset().

§ rangeSubset() [2/2]

template<class DatasetT >
DatasetT shark::rangeSubset ( DatasetT const &  dataset,
std::size_t  size 
)

Fill in the subset of batches [0,...,size[.

Definition at line 899 of file Dataset.h.

References shark::rangeSubset().

§ read() [1/2]

template<class Type>
void shark::Data< Type >::read ( InArchive archive)
inlinevirtual

Read the component from the supplied archive.

Parameters
[in,out]archiveThe archive to read from.

Reimplemented from shark::ISerializable.

Definition at line 265 of file Dataset.h.

§ read() [2/2]

template<class InputT, class LabelT>
void shark::LabeledData< InputT, LabelT >::read ( InArchive archive)
inlinevirtual

from ISerializable

Reimplemented from shark::ISerializable.

Definition at line 630 of file Dataset.h.

§ repartition() [1/2]

template<class Type>
template<class Range >
void shark::Data< Type >::repartition ( Range const &  batchSizes)
inline

Reorders the batch structure in the container to that indicated by the batchSizes vector.

After the operation the container will contain batchSizes.size() batchs with the i-th batch having size batchSize[i]. However the sum of all batch sizes must be equal to the current number of elements

Definition at line 311 of file Dataset.h.

§ repartition() [2/2]

template<class InputT, class LabelT>
template<class Range >
void shark::LabeledData< InputT, LabelT >::repartition ( Range const &  batchSizes)
inline

Reorders the batch structure in the container to that indicated by the batchSizes vector.

After the operation the container will contain batchSizes.size() batches with the i-th batch having size batchSize[i]. However the sum of all batch sizes must be equal to the current number of elements

Definition at line 695 of file Dataset.h.

Referenced by shark::repartitionByClass().

§ repartitionByClass()

template<class I >
void shark::repartitionByClass ( LabeledData< I, unsigned int > &  data,
std::size_t  batchSize = LabeledData<I,unsigned int>::DefaultBatchSize 
)

reorders the dataset such, that points are grouped by labels

The elements are not only reordered but the batches are also resized such, that every batch only contains elements of one class. This method must be used in order to use binarySubproblem.

Definition at line 997 of file Dataset.h.

References shark::classSizes(), shark::get(), shark::LabeledData< InputT, LabelT >::inputs(), shark::LabeledData< InputT, LabelT >::labels(), shark::LabeledData< InputT, LabelT >::numberOfBatches(), shark::LabeledData< InputT, LabelT >::repartition(), shark::size(), and shark::Data< Type >::swap.

Referenced by main().

§ safeExp()

template<class T >
T shark::safeExp ( x)

Thresholded exp function, over- and underflow safe.

Replaces the value of exp(x) for numerical reasons by the a threshold value if it gets too large. Use it only, if there is no other way to get the function stable!

Parameters
xthe exponent

Definition at line 112 of file Math.h.

References shark::blas::max().

§ safeLog()

template<class T >
T shark::safeLog ( x)

Thresholded log function, over- and underflow safe.

Replaces the value of log(x) for numerical reasons by the a threshold value if it gets too low. Use it only, if there is no other way to get the function stable!

Parameters
xthe exponent

Definition at line 127 of file Math.h.

Referenced by shark::NBClassifier< InputType, OutputType >::eval(), shark::AbstractDistribution::logP(), and shark::Normal< RngType >::logP().

§ selectFeatures()

template<class FeatureSet >
Data<RealVector> shark::selectFeatures ( Data< RealVector > const &  data,
FeatureSet const &  features 
)

Creates a copy o a dataset selecting only a certain set of features.

Definition at line 955 of file Dataset.h.

References shark::transform().

§ selectInputFeatures()

template<class T , class FeatureSet >
LabeledData<RealVector,T> shark::selectInputFeatures ( LabeledData< RealVector, T > const &  data,
FeatureSet const &  features 
)

Definition at line 960 of file Dataset.h.

References shark::transformInputs().

§ setColumn()

template<typename RowType >
void shark::setColumn ( Data< RowType > &  data,
std::size_t  columnID,
RowType  newColumn 
)

§ Shift() [1/2]

shark::Shift::Shift ( double  offset)
inline
Parameters
offsetScalar added to all components of all vectors in the dataset

Definition at line 1173 of file Dataset.h.

§ Shift() [2/2]

shark::Shift::Shift ( const RealVector  offset)
inline
Parameters
offsetVector added to vectors in the dataset

Definition at line 1175 of file Dataset.h.

§ shuffle() [1/2]

template<class InputT>
virtual void shark::UnlabeledData< InputT >::shuffle ( )
inlinevirtual

shuffles all elements in the entire dataset (that is, also across the batches)

Definition at line 439 of file Dataset.h.

§ shuffle() [2/2]

template<class InputT, class LabelT>
virtual void shark::LabeledData< InputT, LabelT >::shuffle ( )
inlinevirtual

shuffles all elements in the entire dataset (that is, also across the batches)

Definition at line 648 of file Dataset.h.

Referenced by main().

§ sigmoid()

template<class T >
boost::enable_if<boost::is_arithmetic<T>, T>::type shark::sigmoid ( x)

Logistic function/logistic function.

Calculates the sigmoid function 1/(1+exp(-x)). The type must be arithmetic. For example float,double,long double, int,... but no custom Type.

Definition at line 95 of file Math.h.

Referenced by shark::CrossEntropyIndependent::evalDerivative(), shark::CrossEntropy::evalDerivative(), shark::LogisticNeuron::function(), shark::BipolarLayer::sufficientStatistics(), and shark::BinaryLayer::sufficientStatistics().

§ softPlus() [1/2]

template<class T >
boost::enable_if<boost::is_arithmetic<T>, T>::type shark::softPlus ( x)

Numerically stable version of the function log(1+exp(x)).

Numerically stable version of the function log(1+exp(x)). This function is the integral of the famous sigmoid function. The type must be arithmetic. For example float,double,long double, int,... but no custom Type.

Definition at line 147 of file Math.h.

Referenced by shark::BipolarLayer::logMarginalize(), and shark::BinaryLayer::logMarginalize().

§ softPlus() [2/2]

double shark::softPlus ( double  x)
inline

Numerically stable version of the function log(1+exp(x)). calculated with float precision to save some time.

Numerically stable version of the function log(1+exp(x)). This function is the integral of the famous sigmoid function.

Definition at line 161 of file Math.h.

§ solveSymmPosDefSystem() [1/2]

template<class System , class MatT , class Vec1T , class Vec2T >
void shark::blas::solveSymmPosDefSystem ( matrix_expression< MatT > const &  A,
vector_expression< Vec1T > &  x,
vector_expression< Vec2T > const &  b 
)

System of symmetric linear equations solver.

Solves a system of linear equations Ax=b for x, using Cholesky decomposition and backward substitution. A must be symmetric. This Method is in no way optimized for sparse matrices. Be aware, that the matrix must have full rank!

§ solveSymmPosDefSystem() [2/2]

template<class System , class MatT , class Mat1T , class Mat2T >
void shark::blas::solveSymmPosDefSystem ( matrix_expression< MatT > const &  A,
matrix_expression< Mat1T > &  X,
matrix_expression< Mat2T > const &  B 
)

System of symmetric linear equations solver.

Solves multiple systems of linear equations Ax_1=b_1 Ax_1=b_2 ... =>AX=B or XA = B for X, using cholesky decomposition and backward substitution. The first template parameter is used to decide which type of system is solved Note, that B=(b_1,...,b_n), so the right hand sides are stored as columns. A must be symmetric. This Method is in no way optimized for sparse matrices. Be aware, that the matrix must have full rank!

Parameters
Athe system matrix A
Xthe stored result of the solution of LGS
Bthe right hand side of the LGS

§ solveSymmPosDefSystemInPlace() [1/2]

template<class System , class MatT , class VecT >
void shark::blas::solveSymmPosDefSystemInPlace ( matrix_expression< MatT > const &  A,
vector_expression< VecT > &  b 
)

System of symmetric linear equations solver. The result is stored in b.

Solves a system of linear equations Ax=b for x, using Cholesky decomposition and backward substitution. and stores the result in b. A must be symmetric. This method is in no way optimized for sparse matrices. Be aware, that the matrix must have full rank!

§ solveSymmPosDefSystemInPlace() [2/2]

template<class System , class MatT , class Mat1T >
void shark::blas::solveSymmPosDefSystemInPlace ( matrix_expression< MatT > const &  A,
matrix_expression< Mat1T > &  B 
)

System of symmetric linear equations solver.

Solves multiple systems of linear equations Ax_1=b_1 Ax_1=b_2 ... =>AX=B or XA=B for X, using cholesky decomposition and backward substitution. The first template parameter is used to decide which type of system is solved Note, that B=(b_1,...,b_n), so the right hand sides are stored as columns. A must be symmetric. This Method is in no way optimized for sparse matrices. Be aware, that the matrix must have full rank! Also the result is stored in B directly so it"s contents are destroyed.

Parameters
Athe system matrix A
Bthe right hand side of the LGS, also stores the result

§ solveSymmSemiDefiniteSystemInPlace() [1/2]

template<class System , class MatT , class VecT >
void shark::blas::solveSymmSemiDefiniteSystemInPlace ( matrix_expression< MatT > const &  A,
vector_expression< VecT > &  b 
)

Solves a square system of linear equations without full rank.

Solves the system Ax= b or x^TA=b^T when A is symmetric positive semi-definite. If b is not in the span of Ax or xA, the least squares solution is used, that is we minimize ||Ax-b||^2

The computation is carried out in-place. The algorithm can be looked up in "Fast Computation of Moore-Penrose Inverse Matrices" Pierre Courrieu, 2005

Parameters
A\( n \times n \) input matrix.
bright hand side vector.

§ solveSymmSemiDefiniteSystemInPlace() [2/2]

template<class System , class Mat1T , class Mat2T >
void shark::blas::solveSymmSemiDefiniteSystemInPlace ( matrix_expression< Mat1T > const &  A,
matrix_expression< Mat2T > &  B 
)

Solves multiple square system of linear equations without full rank.

Solves multiple systems of linear equations Ax_1=b_1 Ax_1=b_2 ... =>AX=B or XA = B A must be symmetric positive semi-definite - thus is not required to have full rank. Note, that B=(b_1,...,b_n), so the right hand sides are stored as columns. If the b_i are not in the span of Ax_i or x_i^TA, the least squares solution is used, that is we minimize ||Ax_i-b_i||^2

The computation is carried out in-place. The algorithm can be looked up in "Fast Computation of Moore-Penrose Inverse Matrices" Pierre Courrieu, 2005

Parameters
A\( n \times n \) input matrix.
B\( n \times k \) right hand side matrix.

§ solveSystem() [1/2]

template<class MatT , class Vec1T , class Vec2T >
void shark::blas::solveSystem ( const matrix_expression< MatT > &  A,
vector_expression< Vec1T > &  x,
const vector_expression< Vec2T > &  b 
)

System of linear equations solver.

Solves asystem of linear equations Ax=b for x, using LU decomposition and backward substitution. This Method is in no way optimized for sparse matrices. Be aware, that the matrix must have full rank!

§ solveSystem() [2/2]

template<class MatT , class Mat1T , class Mat2T >
void shark::blas::solveSystem ( const matrix_expression< MatT > &  A,
matrix_expression< Mat1T > &  X,
const matrix_expression< Mat2T > &  B 
)

System of linear equations solver.

Solves multiple systems of linear equations Ax_1=b_1 Ax_2=b_2 ... =>AX=B for X, using LU decomposition and backward substitution. Note, that B=(b_1,...,b_n), so the right hand sides are stored as columns This Method is in no way optimized for sparse matrices. Be aware that the matrix must have full rank!

§ solveSystemInPlace() [1/2]

template<class MatT , class VecT >
void shark::blas::solveSystemInPlace ( matrix_expression< MatT > const &  A,
vector_expression< VecT > &  b 
)

In-Place System of linear equations solver.

Solves a system of linear equations Ax=b for x, using LU decomposition and backward substitution sotring the results in b. This Method is in no way optimized for sparse matrices. Be aware, that the matrix must have full rank!

§ solveSystemInPlace() [2/2]

template<class MatT , class Mat2T >
void shark::blas::solveSystemInPlace ( matrix_expression< MatT > const &  A,
matrix_expression< Mat2T > &  B 
)

In-Place system of linear equations solver.

Solves multiple systems of linear equations Ax_1=b_1 Ax_2=b_2 ... =>AX=B for X, using LU decomposition and backward substitution and stores the result in b Note, that B=(b_1,...,b_n), so the right hand sides are stored as columns This Method is in no way optimized for sparse matrices. Be aware, that the matrix must have full rank!

§ splice() [1/3]

template<class Type>
self_type shark::Data< Type >::splice ( std::size_t  batch)
inline

Splits the container into two independent parts. The front part remains in the container, the back part is returned.

Order of elements remain unchanged. The SharedVector is not allowed to be shared for this to work.

Definition at line 288 of file Dataset.h.

§ splice() [2/3]

template<class InputT>
self_type shark::UnlabeledData< InputT >::splice ( std::size_t  batch)
inline

Splits the container in two independent parts. The left part remains in the container, the right is stored as return type.

Order of elements remain unchanged. The SharedVector is not allowed to be shared for this to work.

Definition at line 432 of file Dataset.h.

§ splice() [3/3]

template<class InputT, class LabelT>
self_type shark::LabeledData< InputT, LabelT >::splice ( std::size_t  batch)
inline

Splits the container into two independent parts. The left part remains in the container, the right is stored as return type.

Order of elements remain unchanged. The SharedVector is not allowed to be shared for this to work.

Definition at line 662 of file Dataset.h.

Referenced by main().

§ splitAtElement()

template<class DatasetT >
DatasetT shark::splitAtElement ( DatasetT &  data,
std::size_t  elementIndex 
)

Removes the last part of a given dataset and returns a new split containing the removed elements.

For this operation, the dataset is not allowed to be shared. data The dataset which should be splited index the first element to be split

Returns
the set which contains the splitd element (right part of the given set)

Definition at line 973 of file Dataset.h.

References shark::size(), and SIZE_CHECK.

Referenced by main().

§ splitBatch() [1/2]

template<class Type>
void shark::Data< Type >::splitBatch ( std::size_t  batch,
std::size_t  elementIndex 
)
inline

Definition at line 280 of file Dataset.h.

§ splitBatch() [2/2]

template<class InputT, class LabelT>
void shark::LabeledData< InputT, LabelT >::splitBatch ( std::size_t  batch,
std::size_t  elementIndex 
)
inline

Definition at line 653 of file Dataset.h.

§ sqr()

template<class T >
boost::enable_if<boost::is_arithmetic<T>, T>::type shark::sqr ( const T &  x)
inline

Calculates x^2.

Definition at line 81 of file Math.h.

Referenced by shark::CMAChromosome::CMAChromosome(), shark::blas::diagonalMahalanobisNorm(), shark::blas::diagonalMahalanobisNormSqr(), shark::HuberLoss::eval(), shark::TukeyBiweightLoss::eval(), shark::SquaredEpsilonHingeLoss::eval(), shark::GSP::eval(), shark::SquaredHingeLoss::eval(), shark::Schwefel::eval(), shark::Cigar::eval(), shark::Discus::eval(), shark::CigarDiscus::eval(), shark::Ellipsoid::eval(), shark::Himmelblau::eval(), shark::LZ9::eval(), shark::Fonseca::eval(), shark::DTLZ3::eval(), shark::ZDT2::eval(), shark::LZ1::eval(), shark::LZ7::eval(), shark::DTLZ2::eval(), shark::DTLZ4::eval(), shark::ZDT6::eval(), shark::DTLZ5::eval(), shark::LZ3::eval(), shark::LZ4::eval(), shark::LZ5::eval(), shark::LZ6::eval(), shark::DTLZ1::eval(), shark::LZ8::eval(), shark::LZ2::eval(), shark::CIGTAB1::eval(), shark::IHR4::eval(), shark::ZDT4::eval(), shark::IHR2::eval(), shark::ELLI1::eval(), shark::ELLI2::eval(), shark::IHR6::eval(), shark::Rosenbrock::eval(), shark::TwoNormRegularizer::eval(), shark::HuberLoss::evalDerivative(), shark::TukeyBiweightLoss::evalDerivative(), shark::SquaredHingeLoss::evalDerivative(), shark::Rosenbrock::evalDerivative(), shark::KernelTargetAlignment< InputType, LabelType >::evalDerivative(), shark::FastSigmoidNeuron::functionDerivative(), shark::IHR2::hg(), shark::IHR1::hg(), shark::IHR3::hg(), shark::IHR6::hg(), shark::VDCMA::init(), shark::LMCMA::init(), shark::PointSearch::init(), shark::kMeans(), shark::VDCMA::lambda(), shark::GaussianLayer::logMarginalize(), shark::Normal< RngType >::logP(), shark::GaussianLayer::logProbability(), shark::InvertedGenerationalDistance::operator()(), shark::HMGSelectionCriterion::operator()(), shark::Normal< RngType >::p(), shark::Cauchy< RngType >::p(), shark::LeastContributorApproximator< Rng, ExactHypervolume >::sample(), shark::ARDKernelUnconstrained< InputType >::setParameterVector(), shark::KDTree< InputT >::squaredDistanceLowerBound(), shark::statistics::Variance::statistics(), shark::tetragamma(), shark::KernelMeanClassifier< InputType >::train(), shark::ARDKernelUnconstrained< InputType >::weightedParameterDerivative(), and shark::WeightedSumKernel< InputType >::weightedParameterDerivative().

§ svd()

template<class MatrixT , class MatrixU , class VectorT >
void shark::blas::svd ( const MatrixT &  amatA,
MatrixU &  umatA,
MatrixU &  vmatA,
VectorT &  wvecA,
unsigned  maxIterations = 200,
bool  ignoreThreshold = true 
)
Determines the singular value decomposition of a rectangular matrix "amatA".

§ tetragamma()

double shark::tetragamma ( double  x)
inline

Calculates the tetragamma function - the derivative of the trigamma function.

The trigamma function is defined as

\[\Psi^{(2)}(x)= \frac{\partial}{\partial x}\Psi^{(1)}(x)= \frac{\partial^3}{\partial ^3} \log \gamma(x)\]

The function is undefined for x=-1,-2,-3,... and an exception is thrown. For more information see http://mathworld.wolfram.com/PolygammaFunction.html

We calculate it in two different ways. If the argument is small a taylor expansion is used. otherwise the argument is transformed to a valu large enough such that the asymptotic series holds which is then easy to calculate with high precision

Definition at line 256 of file Math.h.

References shark::cube(), SHARKEXCEPTION, and shark::sqr().

§ toVector() [1/2]

§ toVector() [2/2]

template<class Matrix >
detail::MatrixExpression<Matrix> shark::blas::toVector ( matrix_expression< Matrix > &  matrix)

Linearizes a matrix as a set of row vectors and treats them as a set of vectors for initialization.

Definition at line 109 of file Initialize.h.

§ transform() [1/2]

template<class T , class Functor >
boost::lazy_disable_if< CanBeCalled<Functor,typename Data<T>::batch_type>, TransformedData<Functor,T>>::type shark::transform ( Data< T > const &  data,
Functor  f 
)

Transforms a dataset using a Functor f and returns the transformed result.

this version is used, when the Functor supports only element-by-element transformations

Definition at line 912 of file Dataset.h.

References shark::Data< Type >::batch(), shark::Data< Type >::batches(), shark::Data< Type >::numberOfBatches(), SHARK_PARALLEL_FOR, and shark::transform().

Referenced by getSamples(), main(), shark::selectFeatures(), shark::transformInputs(), and shark::transformLabels().

§ transform() [2/2]

template<class T , class Functor >
boost::lazy_enable_if< CanBeCalled<Functor,typename Data<T>::batch_type>, TransformedData<Functor,T>>::type shark::transform ( Data< T > const &  data,
Functor const &  f 
)

Transforms a dataset using a Functor f and returns the transformed result.

this version is used, when the Functor supports batch-by-batch transformations

Definition at line 929 of file Dataset.h.

References shark::Data< Type >::batch(), shark::Data< Type >::batches(), shark::Data< Type >::numberOfBatches(), and SHARK_PARALLEL_FOR.

Referenced by shark::transform().

§ transformInputs()

template<class I , class L , class Functor >
LabeledData<typename detail::TransformedDataElement<Functor,I >::type, L > shark::transformInputs ( LabeledData< I, L > const &  data,
Functor const &  f 
)

Transforms the inputs of a dataset and return the transformed result.

Definition at line 941 of file Dataset.h.

References shark::LabeledData< InputT, LabelT >::inputs(), shark::LabeledData< InputT, LabelT >::labels(), and shark::transform().

Referenced by main(), run_one_trial(), and shark::selectInputFeatures().

§ transformLabels()

template<class I , class L , class Functor >
LabeledData<I,typename detail::TransformedDataElement<Functor,L >::type > shark::transformLabels ( LabeledData< I, L > const &  data,
Functor const &  f 
)

Transforms the labels of a dataset and returns the transformed result.

Definition at line 948 of file Dataset.h.

References shark::LabeledData< InputT, LabelT >::inputs(), shark::LabeledData< InputT, LabelT >::labels(), and shark::transform().

Referenced by shark::binarySubProblem(), main(), and shark::oneVersusRestProblem().

§ trigamma()

double shark::trigamma ( double  x)
inline

Calculates the trigamma function -the derivative of the digamma function.

The trigamma function is defined as

\[\Psi^{(1)}(x)= \frac{\partial^2}{\partial ^2} \log \gamma(x)\]

It has poles as x=-1,-2,-3,.. at which the function value is infinity. For more information see http://mathworld.wolfram.com/TrigammaFunction.html

We calculate it in two different ways. If the argument is small a taylor expansion is used. otherwise the argument is transformed to a valu large enough such that the asymptotic series holds which is then easy to calculate with high precision

Definition at line 194 of file Math.h.

§ Truncate() [1/2]

shark::Truncate::Truncate ( double  minValue,
double  maxValue 
)
inline
Parameters
minValueAll elements below this value are cut to the minimum value
maxValueAll elements above this value are cut to the maximum value

Definition at line 1204 of file Dataset.h.

§ Truncate() [2/2]

shark::Truncate::Truncate ( const RealVector  minv,
const RealVector  maxv 
)
inline
Parameters
minvLower bound for element-wise truncation
maxvUpper bound for element-wise truncation

Definition at line 1207 of file Dataset.h.

References SIZE_CHECK.

§ TruncateAndRescale() [1/2]

shark::TruncateAndRescale::TruncateAndRescale ( double  minCutValue,
double  maxCutValue,
double  minValue = 0.,
double  maxValue = 1. 
)
inline
Parameters
minCutValueAll elements below this value are cut to the minimum value
maxCutValueAll elements above this value are cut to the maximum value
minValueThe imterval [minCutValue, maxCutValue] is mapped to [minValue, maxValue]
maxValueThe imterval [minCutValue, maxCutValue] is mapped to [minValue, maxValue]

Definition at line 1240 of file Dataset.h.

§ TruncateAndRescale() [2/2]

shark::TruncateAndRescale::TruncateAndRescale ( const RealVector  minv,
const RealVector  maxv,
double  minValue = 0.,
double  maxValue = 1. 
)
inline
Parameters
minvLower bound for element-wise truncation
maxvUpper bound for element-wise truncation
minValueThe imterval [minv, maxv is mapped to [minValue, maxValue]
maxValueThe imterval [minv, maxv] is mapped to [minValue, maxValue]

Definition at line 1245 of file Dataset.h.

References SIZE_CHECK.

§ UnlabeledData() [1/5]

template<class InputT>
shark::UnlabeledData< InputT >::UnlabeledData ( )
inline

Constructor.

Definition at line 378 of file Dataset.h.

§ UnlabeledData() [2/5]

template<class InputT>
shark::UnlabeledData< InputT >::UnlabeledData ( Data< InputT > const &  points)
inline

Construction from data.

Definition at line 382 of file Dataset.h.

§ UnlabeledData() [3/5]

template<class InputT>
shark::UnlabeledData< InputT >::UnlabeledData ( std::size_t  size,
element_type const &  element,
std::size_t  batchSize = base_type::DefaultBatchSize 
)
inline

Construction with size and a single element.

Optionally the desired batch Size can be set

Parameters
sizethe new size of the container
elementthe blueprint element from which to create the Container
batchSizethe size of the batches. if this is 0, the size is unlimited

Definition at line 393 of file Dataset.h.

§ UnlabeledData() [4/5]

template<class InputT>
shark::UnlabeledData< InputT >::UnlabeledData ( std::size_t  numBatches)
inline

Create an empty set with just the correct number of batches.

The user must initialize the dataset after that by himself.

Definition at line 400 of file Dataset.h.

§ UnlabeledData() [5/5]

template<class InputT>
shark::UnlabeledData< InputT >::UnlabeledData ( UnlabeledData< InputT > const &  container,
std::vector< std::size_t >  batchSizes 
)
inline

Construct a dataset with different batch sizes. it is a copy of the other dataset.

Definition at line 405 of file Dataset.h.

§ vectorSet() [1/2]

template<class T >
detail::InitializerRange<typename T::const_iterator,detail::VectorExpression<const typename T::value_type&> > shark::blas::vectorSet ( const T &  range)

Uses a range of vectors for initialization.

Sometimes not a single vector but a set of vectors is needed as argument like std::deque<RealVector> set; in this case, vectorSet is needed init(vec)<<vec1,vectorSet(set),vec2;

Definition at line 140 of file Initialize.h.

§ vectorSet() [2/2]

template<class T >
detail::InitializerRange<typename T::iterator,detail::VectorExpression<typename T::value_type&> > shark::blas::vectorSet ( T &  range)

Uses a range of vectors for splitting and initialization.

Sometimes not a single vector but a set of vectors is needed as argument like std::deque<RealVector> set; in this case, vectorSet is needed init(vec)>>vec1,vectorSet(set),vec2;

Definition at line 154 of file Initialize.h.

§ write() [1/2]

template<class Type>
void shark::Data< Type >::write ( OutArchive archive) const
inlinevirtual

Write the component to the supplied archive.

Parameters
[in,out]archiveThe archive to write to.

Reimplemented from shark::ISerializable.

Definition at line 269 of file Dataset.h.

§ write() [2/2]

template<class InputT, class LabelT>
void shark::LabeledData< InputT, LabelT >::write ( OutArchive archive) const
inlinevirtual

from ISerializable

Reimplemented from shark::ISerializable.

Definition at line 636 of file Dataset.h.

Variable Documentation

§ m_data [1/2]

§ m_data [2/2]

template<class InputT, class LabelT>
InputContainer shark::LabeledData< InputT, LabelT >::m_data
protected

Definition at line 732 of file Dataset.h.

§ m_label

template<class InputT, class LabelT>
LabelContainer shark::LabeledData< InputT, LabelT >::m_label
protected

point data

Definition at line 733 of file Dataset.h.

§ SQRT_2_PI

const double shark::SQRT_2_PI = boost::math::constants::root_two_pi<double>()
static

Constant for sqrt( 2 * pi ).

Definition at line 65 of file Math.h.

Referenced by shark::GaussianLayer::logMarginalize(), shark::Normal< RngType >::logP(), and shark::Normal< RngType >::p().

Friends

§ LabeledData

template<class Type>
template<class InputT , class LabelT >
friend class LabeledData
friend

Definition at line 168 of file Dataset.h.

§ operator==

template<class Type>
template<class T >
bool operator== ( const Data< T > &  op1,
const Data< T > &  op2 
)
friend

§ swap [1/2]

template<class Type>
void swap ( Data< Type > &  a,
Data< Type > &  b 
)
friend

Definition at line 337 of file Dataset.h.

Referenced by shark::repartitionByClass().

§ swap [2/2]

template<class InputT, class LabelT>
void swap ( LabeledData< InputT, LabelT > &  a,
LabeledData< InputT, LabelT > &  b 
)
friend

Definition at line 708 of file Dataset.h.