private void MutateClassifier(float mutationDistance) { int classifiersCount = irisClassifiers.Count; classifierIndexToMutate = seed.Next(classifiersCount); Iris toMutate = irisClassifiers[classifierIndexToMutate]; oldClassifier = toMutate.Copy(toMutate); switch (seed.Next(4)) { case 0: toMutate.PetalLength += GetRandomNumber(-mutationDistance, mutationDistance); break; case 1: toMutate.PetalWidth += GetRandomNumber(-mutationDistance, mutationDistance); break; case 2: toMutate.SepalLength += GetRandomNumber(-mutationDistance, mutationDistance); break; case 3: toMutate.SepalWidth += GetRandomNumber(-mutationDistance, mutationDistance); break; } }
private void MutateIris() { int irisCount = irisRecords.Count; int classifiersCount = irisClassifiers.Count; irisIndexToMutate = seed.Next(irisCount); Iris toMutate = irisRecords[irisIndexToMutate]; oldIris = toMutate.Copy(toMutate); toMutate.ClassificationLabel = (toMutate.ClassificationLabel + seed.Next(classifiersCount)) % classifiersCount; }