Opened 16 years ago

Closed 16 years ago

#119 closed request (fixed)

NCC and weights

Reported by: Peter Owned by: Markus Ringnér
Priority: major Milestone: yat 0.2
Component: classifier Version:
Keywords: Cc:

Description (last modified by Peter)

needed for #120

NCC should not have an interface with two MatrixLookup?. In partuclar in make_classifier the SubsetGenerator? will not support any weights anymore so the block:

if(cs.weighted()) {

ncc= new NCC(training_data,cs.training_target(),this->distance_,cs.training_weight());


must be replaced.

Change History (6)

comment:1 Changed 16 years ago by Peter

Description: modified (diff)

comment:2 Changed 16 years ago by Peter

Milestone: 0.2

comment:3 Changed 16 years ago by Peter

At the time being make_classifier is passed a SubsetGenerator?, and the from the SubsetGenerator? can the traing_data be retrieved in form of a DataLookup2D*. There will be no support for retrieving any weights from SubsetGenerator? (se #120), and for that reason NCC needs to be modified.

Some questions:

  1. What constructors shall NCC have?
  2. What should the internal representation of data?
  3. How should make_classifier be implemented?

Some suggestions:

  1. Either a DataLookup2D constructor or two constructors passing MatrixLookup?& and MatrixLookupWeighted?, respectively. Advantage with the latter alternative is that we can be sure no-one by accident creates an NCC with a KernelLookup?. The advantage with the first one is obviously that a DataLookup?& can be used to create a NCC e.g. in make_classifier.
  2. This problem is pretty much the same as in Kernel, in which a DataLookup?* is stored as well as a MatrixLookupWeighted?*. In the non-weighted case, i.e. Kernel is constructed with a MatrixLookup?, the MatrixLookupWeighted? pointer is set to NULL. The DataLookup2D* keeps the data from construction (i.e. in weighted case we have a DataLookup2D* and a MatrixLookupWeighted?* poining to the same object). In code valid for both cases (weighted and non-weighted) data is retrieved from the DataLookup?*. However in the weighted case when specific MatrixLookupWeighted? functions are needed this is retieved from the MatrixLookupWeighted?*.
  3. Well this pretty much depend on 1. so we should consider this point when choosing way for 1.

comment:4 Changed 16 years ago by Markus Ringnér

This is what I have done:

  1. I have settled for using two constructors to avoid constructing NCC with a KernelLookup?. In make_classifier dynamic_casts are performed to make sure the Lookup is of a proper type.
  1. I keep only one DataLookup2D& and if it is weighted, dynamic_casts are performed to be able to access MatrixLookupWeighted? functions.
  1. Given my answer to 1, make_classifier should perform dynamic_casts and catch if an improper DataLookup? structure is used.

comment:5 Changed 16 years ago by Markus Ringnér

Owner: changed from Peter to Markus Ringnér

comment:6 Changed 16 years ago by Peter

Resolution: fixed
Status: newclosed

fixed in [632]

Note: See TracTickets for help on using tickets.