Skip to content

Commit ceca0ec

Browse files
author
Bojan Misic
committed
Fix iris.txt dataset and modify Iris Classification tests accordingly
1 parent 36b5bb1 commit ceca0ec

File tree

3 files changed

+178
-178
lines changed

3 files changed

+178
-178
lines changed

test/Microsoft.ML.Tests/Scenarios/IrisPlantClassificationTests.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ public void TrainAndPredictIrisModelTest()
3030

3131
IrisPrediction prediction = model.Predict(new IrisData()
3232
{
33-
SepalLength = 3.3f,
34-
SepalWidth = 1.6f,
35-
PetalLength = 0.2f,
36-
PetalWidth = 5.1f,
33+
SepalLength = 5.1f,
34+
SepalWidth = 3.3f,
35+
PetalLength = 1.6f,
36+
PetalWidth = 0.2f,
3737
});
3838

3939
Assert.Equal(1, prediction.PredictedLabels[0], 2);
@@ -42,10 +42,10 @@ public void TrainAndPredictIrisModelTest()
4242

4343
prediction = model.Predict(new IrisData()
4444
{
45-
SepalLength = 3.1f,
46-
SepalWidth = 5.5f,
47-
PetalLength = 2.2f,
48-
PetalWidth = 6.4f,
45+
SepalLength = 6.4f,
46+
SepalWidth = 3.1f,
47+
PetalLength = 5.5f,
48+
PetalWidth = 2.2f,
4949
});
5050

5151
Assert.Equal(0, prediction.PredictedLabels[0], 2);
@@ -54,10 +54,10 @@ public void TrainAndPredictIrisModelTest()
5454

5555
prediction = model.Predict(new IrisData()
5656
{
57-
SepalLength = 3.1f,
58-
SepalWidth = 2.5f,
59-
PetalLength = 1.2f,
60-
PetalWidth = 4.4f,
57+
SepalLength = 4.4f,
58+
SepalWidth = 3.1f,
59+
PetalLength = 2.5f,
60+
PetalWidth = 1.2f,
6161
});
6262

6363
Assert.Equal(.2, prediction.PredictedLabels[0], 1);

test/Microsoft.ML.Tests/Scenarios/IrisPlantClassificationWithStringLabelTests.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ public void TrainAndPredictIrisModelWithStringLabelTest()
4141

4242
IrisPrediction prediction = model.Predict(new IrisDataWithStringLabel()
4343
{
44-
SepalLength = 3.3f,
45-
SepalWidth = 1.6f,
46-
PetalLength = 0.2f,
47-
PetalWidth = 5.1f,
44+
SepalLength = 5.1f,
45+
SepalWidth = 3.3f,
46+
PetalLength = 1.6f,
47+
PetalWidth = 0.2f,
4848
});
4949

5050
Assert.Equal(1, prediction.PredictedLabels[0], 2);
@@ -53,10 +53,10 @@ public void TrainAndPredictIrisModelWithStringLabelTest()
5353

5454
prediction = model.Predict(new IrisDataWithStringLabel()
5555
{
56-
SepalLength = 3.1f,
57-
SepalWidth = 5.5f,
58-
PetalLength = 2.2f,
59-
PetalWidth = 6.4f,
56+
SepalLength = 6.4f,
57+
SepalWidth = 3.1f,
58+
PetalLength = 5.5f,
59+
PetalWidth = 2.2f,
6060
});
6161

6262
Assert.Equal(0, prediction.PredictedLabels[0], 2);
@@ -65,10 +65,10 @@ public void TrainAndPredictIrisModelWithStringLabelTest()
6565

6666
prediction = model.Predict(new IrisDataWithStringLabel()
6767
{
68-
SepalLength = 3.1f,
69-
SepalWidth = 2.5f,
70-
PetalLength = 1.2f,
71-
PetalWidth = 4.4f,
68+
SepalLength = 4.4f,
69+
SepalWidth = 3.1f,
70+
PetalLength = 2.5f,
71+
PetalWidth = 1.2f,
7272
});
7373

7474
Assert.Equal(.2, prediction.PredictedLabels[0], 1);
@@ -127,16 +127,16 @@ public void TrainAndPredictIrisModelWithStringLabelTest()
127127
public class IrisDataWithStringLabel
128128
{
129129
[Column("0")]
130-
public float PetalWidth;
130+
public float SepalLength;
131131

132132
[Column("1")]
133-
public float SepalLength;
133+
public float SepalWidth;
134134

135135
[Column("2")]
136-
public float SepalWidth;
136+
public float PetalLength;
137137

138138
[Column("3")]
139-
public float PetalLength;
139+
public float PetalWidth;
140140

141141
[Column("4", name: "Label")]
142142
public string IrisPlantType;

0 commit comments

Comments
 (0)