QuickRank  v2.0
QuickRank: A C++ suite of Learning to Rank algorithms
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
quickrank::data::VerticalDataset Class Reference

This class implements a Dataset to be used for a L-t-R task. More...

#include <vertical_dataset.h>

Public Member Functions

 VerticalDataset (std::shared_ptr< Dataset > h_dataset)
 Allocates a vertical dataset by copying and transposing an horizontal one. More...
 
virtual ~VerticalDataset ()
 
 VerticalDataset (const VerticalDataset &other)=delete
 Avoid inefficient copy constructor. More...
 
VerticalDatasetoperator= (const VerticalDataset &)=delete
 Avoid inefficient copy assignment. More...
 
quickrank::Featureat (size_t document_id, size_t feature_id)
 Returns a pointer to a specific data item. More...
 
Label getLabel (size_t document_id)
 Returns the value of the i-th relevance label. More...
 
unsigned int offset (size_t i) const
 Returns the offset in the internal data strcutures of the i-th query results list. More...
 
std::unique_ptr< QueryResultsgetQueryResults (size_t i) const
 Returns the i-th QueryResults in the dataset. More...
 
unsigned int num_features () const
 Returns the number of features used to represent a document. More...
 
unsigned int num_queries () const
 Returns the number of queries in the dataset. More...
 
unsigned int num_instances () const
 Returns the number of documents in the dataset. More...
 

Private Member Functions

virtual std::ostream & put (std::ostream &os) const
 Prints the data reading time stats. More...
 

Private Attributes

size_t num_features_
 
size_t num_queries_
 
size_t num_instances_
 
quickrank::Featuredata_ = NULL
 
quickrank::Labellabels_ = NULL
 
std::vector< size_t > offsets_
 

Friends

std::ostream & operator<< (std::ostream &os, const VerticalDataset &me)
 The output stream operator. More...
 

Detailed Description

This class implements a Dataset to be used for a L-t-R task.

The internal representation is vertical: a row vector of size num_instances() x num_features(). (A training instance is indeed a document.) We allow to directly access the internal representation through the function at() to support fast access and custom high performance implementations. Representation is vertical, i.e., a matrix features x documents.

Constructor & Destructor Documentation

quickrank::data::VerticalDataset::VerticalDataset ( std::shared_ptr< Dataset h_dataset)

Allocates a vertical dataset by copying and transposing an horizontal one.

Parameters
h_datasetThe horizontal dataset.
quickrank::data::VerticalDataset::~VerticalDataset ( )
virtual
quickrank::data::VerticalDataset::VerticalDataset ( const VerticalDataset other)
delete

Avoid inefficient copy constructor.

Member Function Documentation

quickrank::Feature* quickrank::data::VerticalDataset::at ( size_t  document_id,
size_t  feature_id 
)
inline

Returns a pointer to a specific data item.

Parameters
document_idThe document of interest.
feature_idThe feature of interest.
Returns
A reference to the requested feature value of the given document id.
Label quickrank::data::VerticalDataset::getLabel ( size_t  document_id)
inline

Returns the value of the i-th relevance label.

std::unique_ptr< QueryResults > quickrank::data::VerticalDataset::getQueryResults ( size_t  i) const

Returns the i-th QueryResults in the dataset.

Parameters
iThe i-th query results list of interest.
Returns
The requested QueryResults.
unsigned int quickrank::data::VerticalDataset::num_features ( ) const
inline

Returns the number of features used to represent a document.

unsigned int quickrank::data::VerticalDataset::num_instances ( ) const
inline

Returns the number of documents in the dataset.

unsigned int quickrank::data::VerticalDataset::num_queries ( ) const
inline

Returns the number of queries in the dataset.

unsigned int quickrank::data::VerticalDataset::offset ( size_t  i) const
inline

Returns the offset in the internal data strcutures of the i-th query results list.

Parameters
iThe i-th query results list of interest.
Returns
The offset of the first document in the i-th query results list. This can be used to later invoke the at() function.
VerticalDataset& quickrank::data::VerticalDataset::operator= ( const VerticalDataset )
delete

Avoid inefficient copy assignment.

std::ostream & quickrank::data::VerticalDataset::put ( std::ostream &  os) const
privatevirtual

Prints the data reading time stats.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const VerticalDataset me 
)
friend

The output stream operator.

Prints the data reading time stats

Member Data Documentation

quickrank::Feature* quickrank::data::VerticalDataset::data_ = NULL
private
quickrank::Label* quickrank::data::VerticalDataset::labels_ = NULL
private
size_t quickrank::data::VerticalDataset::num_features_
private
size_t quickrank::data::VerticalDataset::num_instances_
private
size_t quickrank::data::VerticalDataset::num_queries_
private
std::vector<size_t> quickrank::data::VerticalDataset::offsets_
private

The documentation for this class was generated from the following files: