Changeset 1168
- Timestamp:
- Feb 26, 2008, 9:48:22 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/matrix_lookup_test.cc
r1134 r1168 146 146 147 147 *error << "MatrixLookup::training_data(const std::vector<size_t>)..."; 148 const classifier::MatrixLookup* TrnData =m2.training_data(utility::Index(one)); 148 const classifier::MatrixLookup* TrnData = 149 new MatrixLookup(m2, utility::Index(one), false); 149 150 if (TrnData->rows() != m2.rows() || TrnData->columns()!=one.size()){ 150 151 ok =false; … … 159 160 std::vector<size_t> val(23,2); 160 161 const classifier::MatrixLookup* ValData = 161 m2.validation_data(utility::Index(one), utility::Index(val));162 new MatrixLookup(m2, utility::Index(val), false); 162 163 if (ValData->rows() != m2.rows() || TrnData->columns()!=val.size()){ 163 164 ok =false; -
trunk/yat/classifier/Kernel.cc
r1166 r1168 67 67 68 68 if (other.weighted()){ 69 mlw_ = other.mlw_->selected(utility::Index(index));69 mlw_ = new MatrixLookupWeighted(*other.mlw_, utility::Index(index),true); 70 70 ref_count_w_ = new u_int(1); 71 71 ml_=NULL; … … 73 73 } 74 74 else{ 75 ml_ = other.ml_->selected(utility::Index(index));75 ml_ = new MatrixLookup(*other.ml_, utility::Index(index),true); 76 76 ref_count_ = new u_int(1); 77 77 mlw_=NULL; -
trunk/yat/classifier/KernelLookup.cc
r1167 r1168 137 137 { 138 138 return utility::SmartPtr<const MatrixLookup> 139 ( kernel_->data().training_data(column_index_));139 (new MatrixLookup(kernel_->data(), column_index_, false)); 140 140 } 141 141 … … 145 145 { 146 146 return utility::SmartPtr<const MatrixLookupWeighted> 147 ( kernel_->data_weighted().training_data(column_index_));147 (new MatrixLookupWeighted(kernel_->data_weighted(),column_index_,false)); 148 148 } 149 149 -
trunk/yat/classifier/MatrixLookup.cc
r1134 r1168 170 170 return const_row_iterator(const_row_iterator::iterator_type(*this,i+1,0),1); 171 171 } 172 173 174 const MatrixLookup*175 MatrixLookup::selected(const utility::Index& i) const176 {177 return new MatrixLookup(*this,i, true);178 }179 180 181 182 const MatrixLookup*183 MatrixLookup::training_data(const utility::Index& i) const184 {185 return new MatrixLookup(*this,i, false);186 }187 188 189 190 const MatrixLookup*191 MatrixLookup::validation_data(const utility::Index& train,192 const utility::Index& val) const193 {194 return new MatrixLookup(*this,val, false);195 }196 197 172 198 173 -
trunk/yat/classifier/MatrixLookup.h
r1134 r1168 270 270 const_row_iterator end_row(size_t) const; 271 271 272 /**273 the new MatrixLookup will consist of the rolumn vectors274 defined by @a index. This means that the returned MatrixLookup275 will fullfill: \f$ returned(i,j) = original(index[i],j) \f$276 277 @note If underlying matrix goes out of scope or is deleted, the278 returned pointer becomes invalid and the result of further use is279 undefined.280 281 */282 const MatrixLookup* selected(const utility::Index&) const;283 284 ///285 /// The created MatrixLookup corresponds to all rows and the286 /// columns defined by @a index in the original MatrixLookup. The287 /// created MatrixLookup will fullfill:288 /// \f$ novel_ml(i,j)=original(i,index[j]) \f$.289 ///290 /// @return pointer to sub-Lookup of the MatrixLookup291 ///292 /// @note If underlying matrix goes out of scope or is deleted, the293 /// returned pointer becomes invalid and the result of further use is294 /// undefined.295 ///296 /// @note Returns a dynamically allocated DataLookup2D, which has297 /// to be deleted by the caller to avoid memory leaks.298 ///299 const MatrixLookup* training_data(const utility::Index& index) const;300 301 ///302 /// The created MatrixLookup corresponds to all rows and the303 /// columns defined by @a index in the original MatrixLookup. The304 /// created MatrixLookup will fullfill:305 /// \f$ novel_ml(i,j)=original(i,index[j]) \f$.306 ///307 /// @return pointer to sub-Lookup of the MatrixLookup308 ///309 /// @note If underlying matrix goes out of scope or is deleted, the310 /// returned pointer becomes invalid and the result of further use is311 /// undefined.312 ///313 const MatrixLookup* validation_data(const utility::Index&,314 const utility::Index&) const;315 272 /// 316 273 /// @return false -
trunk/yat/classifier/MatrixLookupWeighted.cc
r1134 r1168 246 246 return const_row_iterator(const_row_iterator::iterator_type(*this,i+1,0),1); 247 247 } 248 249 250 const MatrixLookupWeighted*251 MatrixLookupWeighted::selected(const utility::Index& i) const252 {253 return new MatrixLookupWeighted(*this,i, true);254 }255 256 257 258 const MatrixLookupWeighted*259 MatrixLookupWeighted::training_data(const utility::Index& i) const260 {261 return new MatrixLookupWeighted(*this,i, false);262 }263 264 265 266 const MatrixLookupWeighted*267 MatrixLookupWeighted::validation_data(const utility::Index& train,268 const utility::Index& val) const269 {270 return new MatrixLookupWeighted(*this,val, false);271 }272 273 248 274 249 -
trunk/yat/classifier/MatrixLookupWeighted.h
r1134 r1168 303 303 const_row_iterator end_row(size_t) const; 304 304 305 /**306 the new MatrixLookup will consist of the rolumn vectors307 defined by @a index. This means that the returned308 MatrixLookupWeighted309 will fullfill:310 returned(i,j) = original(index[i],j)311 312 @note If underlying matrix goes out of scope or is deleted, the313 returned pointer becomes invalid and the result of further use is314 undefined.315 316 */317 const MatrixLookupWeighted* selected(const utility::Index& i) const;318 319 ///320 /// The created MatrixLookupWeighted corresponds to all rows and the321 /// columns defined by @a index in the original MatrixLookupWeighted. The322 /// created MatrixLookupWeighted will fullfill:323 /// novel_ml(i,j)=original(i,index[j]).324 ///325 /// @return pointer to sub-Lookup of the MatrixLookupWeighted326 ///327 /// @note If underlying matrix goes out of scope or is deleted, the328 /// returned pointer becomes invalid and the result of further use is329 /// undefined.330 ///331 const MatrixLookupWeighted*332 training_data(const utility::Index& index) const;333 334 ///335 /// The created MatrixLookupWeighted corresponds to all rows and the336 /// columns defined by @a index in the original MatrixLookupWeighted. The337 /// created MatrixLookupWeighted will fullfill:338 /// novel_ml(i,j)=original(i,index[j])339 ///340 /// @return pointer to sub-Lookup of the MatrixLookupWeighted341 ///342 /// @note If underlying matrix goes out of scope or is deleted, the343 /// returned pointer becomes invalid and the result of further use is344 /// undefined.345 ///346 const MatrixLookupWeighted* validation_data(const utility::Index&,347 const utility::Index&) const;348 349 305 /// 350 306 /// @return weight value of element (@a row, @a column) -
trunk/yat/classifier/SubsetGenerator.h
r1167 r1168 209 209 // training data with no feature selection 210 210 const MatrixLookup* train_data_all_feat = 211 ml.training_data(training_index(k));211 new MatrixLookup(ml, training_index(k), false); 212 212 // use these data to create feature selection 213 213 utility::yat_assert<std::runtime_error>(train_data_all_feat); … … 241 241 // training data with no feature selection 242 242 const MatrixLookupWeighted* train_data_all_feat = 243 ml.training_data(training_index(k));243 new MatrixLookupWeighted(ml, training_index(k), false); 244 244 // use these data to create feature selection 245 245 f_selector_->update(*train_data_all_feat, training_target(k));
Note: See TracChangeset
for help on using the changeset viewer.