Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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)}";
        }
Ejemplo n.º 3
0
 private void Main_Load(object sender, EventArgs e)
 {
     Input = new IrisData();
     ClusterPredictions = new List <ClusterPrediction>();
     TrainedData        = new List <IrisData>();
 }
Ejemplo n.º 4
0
 private ClusterPrediction PredictIris(IrisData iris)
 {
     return(Model.Predict(iris));
 }