This repository has been archived by the owner on Jul 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 54
/
srm_test.h
54 lines (46 loc) · 1.79 KB
/
srm_test.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
Copyright 2015 Google Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifndef SRM_TEST_H_
#define SRM_TEST_H_
#include "types.h"
#include "gtest/gtest.h"
class SrmTest : public ::testing::Test {
protected:
virtual void SetUp() {
// Three positive examples, two negative examples, three features. Best
// split for feature 0 is useless, and for the other features divides
// examples into the ratios +3/-1 (left) and +0/-1 (right). Two splits (on
// features 1 and 2) perfectly classify all examples.
// TODO(usyed): For more interesting tests, weights should be different from
// uniform.
Example examples_arr[5];
examples_arr[0].values = {1.0, 0.1, 11.0};
examples_arr[0].label = 1;
examples_arr[0].weight = 0.2;
examples_arr[1].values = {3.0, 0.3, 11.0};
examples_arr[1].label = 1;
examples_arr[1].weight = 0.2;
examples_arr[2].values = {5.0, 0.4, 11.0};
examples_arr[2].label = 1;
examples_arr[2].weight = 0.2;
examples_arr[3].values = {2.0, 0.2, 22.0};
examples_arr[3].label = -1;
examples_arr[3].weight = 0.2;
examples_arr[4].values = {4.0, 0.5, 11.0};
examples_arr[4].label = -1;
examples_arr[4].weight = 0.2;
examples_.assign(examples_arr, examples_arr + 5);
}
vector<Example> examples_;
};
#endif // SRM_TEST_H_