Last change
on this file since 624 was
624,
checked in by Peter, 17 years ago
|
fixes #109 and #110
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Author Date ID
|
File size:
1.2 KB
|
Line | |
---|
1 | // $Id$ |
---|
2 | |
---|
3 | #include "FeatureSelectorIR.h" |
---|
4 | |
---|
5 | #include "FeatureSelector.h" |
---|
6 | #include "InputRanker.h" |
---|
7 | |
---|
8 | #include <algorithm> |
---|
9 | |
---|
10 | namespace theplu { |
---|
11 | namespace classifier { |
---|
12 | |
---|
13 | |
---|
14 | FeatureSelectorIR::FeatureSelectorIR(statistics::Score& score, size_t N, |
---|
15 | size_t first) |
---|
16 | : FeatureSelector(N, first), score_(score) |
---|
17 | { |
---|
18 | } |
---|
19 | |
---|
20 | |
---|
21 | |
---|
22 | FeatureSelectorIR::FeatureSelectorIR(const FeatureSelectorIR& other) |
---|
23 | : FeatureSelector(other), score_(other.score_) |
---|
24 | { |
---|
25 | } |
---|
26 | |
---|
27 | |
---|
28 | |
---|
29 | FeatureSelectorIR& FeatureSelectorIR::operator=(const FeatureSelectorIR& other) |
---|
30 | { |
---|
31 | FeatureSelector::operator=(other); |
---|
32 | return *this; |
---|
33 | } |
---|
34 | |
---|
35 | |
---|
36 | void FeatureSelectorIR::update(const MatrixLookup& data, const Target& target) |
---|
37 | { |
---|
38 | InputRanker ir = InputRanker(data, target, score_); |
---|
39 | features_.resize(N_); |
---|
40 | std::copy(ir.rank().begin()+first_, ir.rank().begin()+first_+N_, |
---|
41 | features_.begin()); |
---|
42 | |
---|
43 | } |
---|
44 | |
---|
45 | |
---|
46 | void FeatureSelectorIR::update(const MatrixLookupWeighted& data, |
---|
47 | const Target& target) |
---|
48 | { |
---|
49 | InputRanker ir = InputRanker(data, target, score_); |
---|
50 | features_.resize(N_); |
---|
51 | std::copy(ir.rank().begin()+first_, ir.rank().begin()+first_+N_, |
---|
52 | features_.begin()); |
---|
53 | |
---|
54 | } |
---|
55 | |
---|
56 | |
---|
57 | } // end of namespace classifier |
---|
58 | } // end of namespace theplu |
---|
Note: See
TracBrowser
for help on using the repository browser.