public void SOM_6_columns_iris_0() { InitData_dataset_iris(); //Split last column away from _trainingData double[][] newTrainingData = ArrayManipulation.RemoveLastColumn2D(_trainingData); string [] values = Conversion.ConvertToStringArray(ArrayManipulation.GetLastColAs1DArray(_trainingData)); string[] newAttributeHeaders = ArrayManipulation.RemoveLastColumn1D(_attributeHeaders); BuildSelfOrganizingMap build = new BuildSelfOrganizingMap(); build.SetParameters(4, 4);//, .1, 100, 3); ModelSelfOrganizingMap model = (ModelSelfOrganizingMap)build.BuildModel(newTrainingData, newAttributeHeaders); values = Conversion.ReplaceWithString1D(values, "0", "setosa"); values = Conversion.ReplaceWithString1D(values, "1", "versicolor"); values = Conversion.ReplaceWithString1D(values, "2", "virginica"); string somMap = model.GetPrintedSOMMapWithNameIds(newTrainingData, values); //string valueCompare = "versicolor versicolor setosa setosa \r\n" + // "virginica versicolor versicolor setosa \r\n" + // "virginica virginica virginica virginica \r\n" + // "virginica virginica virginica virginica"; //Using Random init weights is leading to different structure //However the following line should always be there Assert.IsTrue(somMap.Contains("virginica virginica virginica virginica")); }
public void ArrayManipulation_1D_double_last_col() { double[] array = new double[] { 2, 3, 4, 5 }; double[] newArray = ArrayManipulation.RemoveLastColumn1D(array); Assert.AreEqual(newArray.Length, 3); Assert.AreEqual(newArray[0], 2); Assert.AreEqual(newArray[1], 3); Assert.AreEqual(newArray[2], 4); }
public void ArrayManipulation_1D_string_last_col() { string[] array = new string[] { "a", "b", "c", "d" }; string[] newArray = ArrayManipulation.RemoveLastColumn1D(array); Assert.AreEqual(newArray.Length, 3); Assert.AreEqual(newArray[0], "a"); Assert.AreEqual(newArray[1], "b"); Assert.AreEqual(newArray[2], "c"); }