private void buttonPredict_Click(object sender, EventArgs e) { if (_classifier == null) { XtraMessageBox.Show("There is no model to predict!", "Uh Oh!", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } _classifier.Predict(_subject); propertyStudent.Refresh(); MessageBox.Show(string.Format("Looks like {0} is {1}!", _subject.Name, _subject.Good ? "good" : "not good"), "Result", MessageBoxButtons.OK, MessageBoxIcon.Information); }
public static void DrawGrid(double[] extent, double resolution, IPredict predict, string fileName) { int width = (int)Math.Round((extent[2] - extent[0]) / resolution) + 1, height = (int)Math.Round((extent[3] - extent[1]) / resolution) + 1; Bitmap bitmap = new Bitmap(width, height); double lon, lat; for (int i = 0; i < width; i++) { lon = extent[0] + i * resolution; for (int j = 0; j < height; j++) { lat = extent[3] - j * resolution; int value = (int)Math.Round(predict.Predict(lon, lat)); bitmap.SetPixel(i, j, Color.FromArgb(value / 256, value % 256, 0)); } } bitmap.Save(fileName); bitmap.Dispose(); }