我刚刚开始使用Accord.net和ML。 我有一个我建的数据集(我相信它没有错误) 第1列是X坐标 第2列是Y坐标 第3列是输出(1到8之间)(7种可能的结果)
问题似乎是算法不构建像
这样的规则 x > 10 && x < 20
它似乎只在规则中使用一次x或y值,因此结果只能是4种可能的选项
DecisionVariable[] attributes =
{
new DecisionVariable("xcor", DecisionVariableKind.Continuous),
new DecisionVariable("ycor", DecisionVariableKind.Continuous)
};
var c45 = new C45Learning(attributes);
List<string>ROWS = FILE_FUNCTIONS.GET_FILEROWS();
int TOTROWS = ROWS.Count();
double[][] inputs = new double[TOTROWS][];
int[] outputs = new int[TOTROWS];
int i = 0;
foreach (string ROW in ROWS)
{
string[] ROWARRAY = ROW.Split('|');
double x = Convert.ToDouble(ROWARRAY[0]);
double y = Convert.ToDouble(ROWARRAY[1]);
int res = Convert.ToInt32(ROWARRAY[2]);
inputs[i] = new double[] { x, y };
outputs[i] = res;
i++;
}
DecisionTree tree = c45.Learn(inputs, outputs);
我想附加整个数据集但是我看不到如何。 下面的几条数据线
191.810946844273|36.9122812814319|1
248.564145210943|29.0892297630513|1
257.615301273994|24.4442924810173|1
129.675980149507|13.2879068417561|3
134.813121928929|12.5544953189123|3
132.122238639478|15.7326103428065|3
171.017749679524|16.7997445714401|2
195.480334579228|14.5995107904566|2
194.501831882918|16.7997445714401|2
281.408852439504|12.6201425479222|4
281.197749719569|15.8549964244587|4
36.2920287712232|40.4902007544059|5
39.3726166843489|40.2977867868674|5
42.0681313817349|40.1053722263791|5
26.8727621956996|34.0420081824319|6
27.4503731129132|32.983728692696|6
26.7764944385667|30.4823423710968|6
61.2292951575644|27.3051931767757|7
62.3845158983875|27.1127786162874|7
64.4061519214272|26.8241573685046|7
38.8950333342043|10.377928032616|8
33.5040039394321|10.5703425931042|8
31.0972947006528|11.2437929618635|8