private ClusterPrediction PredictIris(float SepalLength, float SepalWidth, float PetalLength, float PetalWidth) { IrisData iris = new IrisData { SepalLength = SepalLength, SepalWidth = SepalWidth, PetalLength = PetalLength, PetalWidth = PetalWidth }; return(PredictIris(iris)); }
private void btnPredict_Click(object sender, EventArgs e) { if (Input == null) { Input = new IrisData(); } Input.PetalLength = float.Parse(txtPtlLgth.Text); Input.PetalWidth = float.Parse(txtPtlWdth.Text); Input.SepalLength = float.Parse(txtSplLgth.Text); Input.SepalWidth = float.Parse(txtSplWdth.Text); ClusterPrediction prediction = PredictIris(Input); txtPredictions.Text += $"\r\n\r\nPetal Length: {txtPtlLgth.Text}cm"; txtPredictions.Text += $"\r\nPetal Width: {txtPtlWdth.Text}cm"; txtPredictions.Text += $"\r\nSepal Length: {txtSplLgth.Text}cm"; txtPredictions.Text += $"\r\nSepal Width: {txtSplWdth.Text}cm"; txtPredictions.Text += $"\r\n{new string('-', 30)}"; txtPredictions.Text += $"\r\nCluster: {prediction.PredictedClusterId}"; txtPredictions.Text += $"\r\nDistances: {string.Join(" ", prediction.Distances)}"; txtPredictions.Text += $"\r\n{new string('*', 50)}"; }
private void Main_Load(object sender, EventArgs e) { Input = new IrisData(); ClusterPredictions = new List <ClusterPrediction>(); TrainedData = new List <IrisData>(); }
private ClusterPrediction PredictIris(IrisData iris) { return(Model.Predict(iris)); }