bool IsSame(LingValue other) { return(other.Membership == sumMembership && other.NumOfRules == numOfRules && other.ValueName.ToLower() == valueName.ToLower() && other.VariableName.ToLower() == variableName.ToLower()); }
//darkness internal static List <LingValue> DarknessFuzzification(double darknessAnswer) { LingValue lowValue = new LingValue("darkness", "low", LowDarknessFunction(darknessAnswer)); LingValue highValue = new LingValue("darkness", "high", HidhDarknessFunction(darknessAnswer)); return(new List <LingValue>(new[] { lowValue, highValue })); }
//background internal static List <LingValue> BackgroundFuzzification(double backgrouundAnswer) { LingValue largeBackground = new LingValue("background", "large", LargeBacgroundFunction(backgrouundAnswer)); LingValue normalBackground = new LingValue("background", "normal", NormalBacgroundFunction(backgrouundAnswer)); return(new List <LingValue>(new[] { largeBackground, normalBackground })); }
//identity internal static List <LingValue> IdentityFuzzification(double mccAnswer, double threshold) { LingValue sameValue = new LingValue("identity", "same", SameFunction(mccAnswer, threshold)); LingValue differentValue = new LingValue("identity", "different", DifferentFunction(mccAnswer, threshold)); return(new List <LingValue>(new[] { sameValue, differentValue })); }
public bool Evaluate(List <LingValue> currentValues) { double newMembership = 1; double currentMembership; foreach (Term term in terms) { if (!term.Evaluate(currentValues, out currentMembership)) { return(false); } newMembership = Math.Min(newMembership, currentMembership); } int index = answer.FindIndex(currentValues); if (index == -1) { LingValue newValue = new LingValue(answer.VariableName, answer.ValueName, newMembership * factor); currentValues.Add(newValue); } else { currentValues[index].AddMembership(newMembership * factor); } return(true); }
//LowQualityBlocksNfiq internal static List <LingValue> LowQualityBlocksNfiqFuzzification(double nfiqBlocksAnswer) { LingValue manyBlocks = new LingValue("LowQualityBlocks".ToLower(), "many", ManyLowQualityBlocksFunction(nfiqBlocksAnswer)); LingValue littleBlocks = new LingValue("LowQualityBlocks".ToLower(), "little", LittleLowQualityBlocksFunction(nfiqBlocksAnswer)); return(new List <LingValue>(new[] { manyBlocks, littleBlocks })); }
bool IsSame(LingValue other) { return other.Membership == sumMembership && other.NumOfRules == numOfRules && other.ValueName.ToLower() == valueName.ToLower() && other.VariableName.ToLower() == variableName.ToLower(); }
public bool Evaluate(List<LingValue> currentValues) { double newMembership = 1; double currentMembership; foreach (Term term in terms) { if (!term.Evaluate(currentValues, out currentMembership)) { return false; } newMembership = Math.Min(newMembership, currentMembership); } int index = answer.FindIndex(currentValues); if (index == -1) { LingValue newValue = new LingValue(answer.VariableName, answer.ValueName, newMembership * factor); currentValues.Add(newValue); } else { currentValues[index].AddMembership(newMembership * factor); } return true; }
internal static List <LingValue> AverageQualityNfiqFuzzification(double nfiqQualityAnswer) { LingValue highQualityNfiq = new LingValue("QualityNfiq".ToLower(), "high", HighQualityNfiqFunction(nfiqQualityAnswer)); //LingValue middleQualityNfiq = new LingValue("QualityNfiq","Middle",MiddleQualityNfiqFunction(nfiqQualityAnswer)); LingValue lowQualityNfiq = new LingValue("QualityNfiq".ToLower(), "low", LowQualityNfiqFunction(nfiqQualityAnswer)); return(new List <LingValue>(new[] { highQualityNfiq, lowQualityNfiq })); }
internal LingValue GetAnswer(Tuple <InputVector, InputVector, InputVector> input, double threshold) { List <LingValue> firstAnswer = GetAnswersForOneFinger(input.Item1, threshold); List <LingValue> secondAnswer = GetAnswersForOneFinger(input.Item2, threshold); List <LingValue> thirdAnswer = GetAnswersForOneFinger(input.Item3, threshold); List <LingValue> existingValuesAnswer = new List <LingValue>(); foreach (LingValue item in firstAnswer) { if (item.VariableName == "fingerprintAnswer".ToLower()) { LingValue newVal = new LingValue("fingerprintAnswer1".ToLower(), item.ValueName, item.Membership); existingValuesAnswer.Add(newVal); } } foreach (LingValue item in secondAnswer) { if (item.VariableName == "fingerprintAnswer".ToLower()) { LingValue newVal = new LingValue("fingerprintAnswer2".ToLower(), item.ValueName, item.Membership); existingValuesAnswer.Add(newVal); } } foreach (LingValue item in thirdAnswer) { if (item.VariableName == "fingerprintAnswer".ToLower()) { LingValue newVal = new LingValue("fingerprintAnswer3".ToLower(), item.ValueName, item.Membership); existingValuesAnswer.Add(newVal); } } var results = EvaluateFullAnswers(existingValuesAnswer); return(FindMaxLingValue(results)); }
internal LingValue GetAnswer(Tuple<InputVector, InputVector, InputVector> input, double threshold) { List<LingValue> firstAnswer = GetAnswersForOneFinger(input.Item1, threshold); List<LingValue> secondAnswer = GetAnswersForOneFinger(input.Item2, threshold); List<LingValue> thirdAnswer = GetAnswersForOneFinger(input.Item3, threshold); List<LingValue> existingValuesAnswer = new List<LingValue>(); foreach (LingValue item in firstAnswer) { if (item.VariableName == "fingerprintAnswer".ToLower()) { LingValue newVal = new LingValue("fingerprintAnswer1".ToLower(), item.ValueName, item.Membership); existingValuesAnswer.Add(newVal); } } foreach (LingValue item in secondAnswer) { if (item.VariableName == "fingerprintAnswer".ToLower()) { LingValue newVal = new LingValue("fingerprintAnswer2".ToLower(), item.ValueName, item.Membership); existingValuesAnswer.Add(newVal); } } foreach (LingValue item in thirdAnswer) { if (item.VariableName == "fingerprintAnswer".ToLower()) { LingValue newVal = new LingValue("fingerprintAnswer3".ToLower(), item.ValueName, item.Membership); existingValuesAnswer.Add(newVal); } } var results = EvaluateFullAnswers(existingValuesAnswer); return FindMaxLingValue(results); }
//background internal static List<LingValue> BackgroundFuzzification(double backgrouundAnswer) { LingValue largeBackground = new LingValue("background", "large", LargeBacgroundFunction(backgrouundAnswer)); LingValue normalBackground = new LingValue("background", "normal", NormalBacgroundFunction(backgrouundAnswer)); return new List<LingValue>(new[] { largeBackground, normalBackground }); }
//darkness internal static List<LingValue> DarknessFuzzification(double darknessAnswer) { LingValue lowValue = new LingValue("darkness", "low", LowDarknessFunction(darknessAnswer)); LingValue highValue = new LingValue("darkness", "high", HidhDarknessFunction(darknessAnswer)); return new List<LingValue>(new[] { lowValue, highValue }); }
internal static List<LingValue> AverageQualityNfiqFuzzification(double nfiqQualityAnswer) { LingValue highQualityNfiq = new LingValue("QualityNfiq".ToLower(), "high", HighQualityNfiqFunction(nfiqQualityAnswer)); //LingValue middleQualityNfiq = new LingValue("QualityNfiq","Middle",MiddleQualityNfiqFunction(nfiqQualityAnswer)); LingValue lowQualityNfiq = new LingValue("QualityNfiq".ToLower(), "low", LowQualityNfiqFunction(nfiqQualityAnswer)); return new List<LingValue>(new[] { highQualityNfiq, lowQualityNfiq }); }
//identity internal static List<LingValue> IdentityFuzzification(double mccAnswer, double threshold) { LingValue sameValue = new LingValue("identity", "same", SameFunction(mccAnswer, threshold)); LingValue differentValue = new LingValue("identity", "different", DifferentFunction(mccAnswer, threshold)); return new List<LingValue>(new[] { sameValue, differentValue }); }
//LowQualityBlocksNfiq internal static List<LingValue> LowQualityBlocksNfiqFuzzification(double nfiqBlocksAnswer) { LingValue manyBlocks = new LingValue("LowQualityBlocks".ToLower(), "many", ManyLowQualityBlocksFunction(nfiqBlocksAnswer)); LingValue littleBlocks = new LingValue("LowQualityBlocks".ToLower(), "little", LittleLowQualityBlocksFunction(nfiqBlocksAnswer)); return new List<LingValue>(new[] { manyBlocks, littleBlocks }); }