Class Salsa::Dense¶
Defined in File Salsa.h
Nested Relationships¶
This class is a nested type of Class Salsa.
Inheritance Relationships¶
Base Type¶
public SubmodularOptimizer(Class SubmodularOptimizer)
Class Documentation¶
-
class Salsa::Dense : public SubmodularOptimizer
Dense thresholding strategy (Algorithm 1 in the ICML paper). This basically simulates the SimpleGreedy / PreemptionStreaming algalgorithm with a slightly different sampling strategy for the thresholds. In the original version OPT is known and different epsilon are used to “sample” different thresholds. As detailed in the longer version arxiv version of the paper, we can estimate OPT via \(O = \{(1+\varepsilon)^i \mid i \in \mathbb{Z}, m \le (1+\varepsilon)^i \le K \cdot m\}\) where \( m = \max f({m}) \) is the maximum singleton function value.
Public Functions
-
inline Dense(unsigned int K, SubmodularFunction &f, data_t threshold, data_t beta, data_t C1, data_t C2, unsigned int N)
Construct a new Dense object.
- Parameters
K – The cardinality constraint you of the optimization problem, that is the number of items selected.
f – The function which should be maximized. Note, that the clone function is used to construct a new SubmodularFunction which is owned by this object. If you implement a custom SubmodularFunction make sure that everything you need is actually cloned / copied.
threshold – The (sampled) OPT threshold
beta – The \(\beta\) parameter
C1 – The \(\C_1\) parameter
C2 – The \(C_2\) parameter
N – The number of items in the datastream
-
inline Dense(unsigned int K, std::function<data_t(std::vector<std::vector<data_t>> const&)> f, data_t threshold, data_t beta, data_t C1, data_t C2, unsigned int N)
Construct a new Dense object.
- Parameters
K – The cardinality constraint you of the optimization problem, that is the number of items selected.
f – The function which should be maximized. Note, that this parameter is likely moved and not copied. Thus, if you construct multiple optimizers with the same function they all reference the same function. This can be very efficient for state-less functions, but may lead to weird side effects if f keeps track of a state.
threshold – The (sampled) OPT threshold
beta – The \(\beta\) parameter
C1 – The \(\C_1\) parameter
C2 – The \(C_2\) parameter
N – The number of items in the datastream
-
inline virtual void fit(std::vector<std::vector<data_t>> const &X, unsigned int iterations = 1)
Throws an exception when called. FixedThreshold should not be used outside Salsa.
- Parameters
X – A constant reference to the entire data set
iterations – Number of iterations over the entire dataset
-
inline virtual void next(std::vector<data_t> const &x, std::optional<idx_t> const id = std::nullopt)
Consume the next object in the data stream. Add the current item to the summary if there are fewer than K element in it and if the items gain exceeds the current thresholding rule. Performs one function query.
- Parameters
&x – A constant reference to the next object on the stream.
id – The id of the given object. If this is a
std::nulloptthis parameter is ignored. Otherwise the id is inserted into the solution. Make sure, that either all or no object receives an id to keep track which id belongs to which object. This algorithm simply stores the objects and the ids in two separate lists and performs no safety checks.
-
inline Dense(unsigned int K, SubmodularFunction &f, data_t threshold, data_t beta, data_t C1, data_t C2, unsigned int N)