| 172 | |
| 173 | private: |
| 174 | class map_prob |
| 175 | { |
| 176 | public: |
| 177 | unsigned long order() const { return fe.order(); } |
| 178 | unsigned long num_states() const { return fe.num_labels(); } |
| 179 | |
| 180 | map_prob( |
| 181 | const sample_sequence_type& x_, |
| 182 | const feature_extractor& fe_, |
| 183 | const matrix<double,0,1>& weights_ |
| 184 | ) : |
| 185 | sequence(x_), |
| 186 | fe(fe_), |
| 187 | weights(weights_) |
| 188 | { |
| 189 | } |
| 190 | |
| 191 | unsigned long number_of_nodes( |
| 192 | ) const |
| 193 | { |
| 194 | return sequence.size(); |
| 195 | } |
| 196 | |
| 197 | template < |
| 198 | typename EXP |
| 199 | > |
| 200 | double factor_value ( |
| 201 | unsigned long node_id, |
| 202 | const matrix_exp<EXP>& node_states |
| 203 | ) const |
| 204 | { |
| 205 | if (dlib::impl::call_reject_labeling_if_exists(fe, sequence, node_states, node_id)) |
| 206 | return -std::numeric_limits<double>::infinity(); |
| 207 | |
| 208 | return fe_helpers::dot(weights, fe, sequence, node_states, node_id); |
| 209 | } |
| 210 | |
| 211 | const sample_sequence_type& sequence; |
| 212 | const feature_extractor& fe; |
| 213 | const matrix<double,0,1>& weights; |
| 214 | }; |
| 215 | public: |
| 216 | |
| 217 | sequence_labeler() |
no outgoing calls
no test coverage detected