QUESTION 16~18
根据老师的要求,基于[-1,1]上的均匀分布随机生成20个样本,相应的输出有20%的错误率;20个样本将数轴分为21段,中间有19段,θ取这19段的中点当中的一个,s取1或-1。遍历所有的θ和s,找到E-in最小的(θ,s)组合就得到了那个g函数。
#include <iostream>
#include <ctime>
#include <vector>
#include <algorithm>
using namespace std;
#define SAMPLE_SIZE 20 //样本量
struct Hypothesi