コード例 #1
0
        public static double ProbabilityofMatch(int[] profile, ProfileDistribution distribution)
        {
            double product = distribution.PMatch;
            var    factors = distribution.Factors;

            for (int i = 0; i < profile.Length; i++)
            {
                if (profile[i] < 0) //Skip over fields where we can't evaluate the strength of the match
                {
                    continue;
                }

                product *= factors[i].GivenMatch.Probability[profile[i]] / factors[i].GivenNoMatch.Probability[profile[i]];
            }

            return(product / (1d + product));
        }
コード例 #2
0
ファイル: ProfileEngine.cs プロジェクト: kwende/MitchMatch
        public static ProfileDistribution CreateProfileDistribution(List <List <int> > knownMatches, Row[] allData)
        {
            string directoryPath = @"C:\Users\jbrownkramer\Desktop\PatientMatchingData";

            ProfileDistribution toReturn = new ProfileDistribution();

            toReturn.Factors = new ConditionedDistribution[OrderedFields.Length];

            for (int i = 0; i < OrderedFields.Length; i++)
            {
                string fieldName = OrderedFields[i];
                Console.WriteLine("Creating distribution for " + fieldName);

                RowMatchObject matchObject;
                if (fieldName == "MRN")
                {
                    matchObject = FastFuzzyMatchEngine.FuzzyMRNMatches(allData);
                }
                else
                {
                    string filePath = Path.Combine(directoryPath, fieldName + "Matches.dat");
                    matchObject = Serializer.Deserialize <RowMatchObject>(filePath);
                }
                var probabilityObject = ProbabilityEngine.ComputeConditionedDistribution(knownMatches, matchObject, allData.Length);
                toReturn.Factors[i] = probabilityObject;
            }

            //Compute the probability of match
            long totalMatches = 0;

            foreach (var set in knownMatches)
            {
                totalMatches += Choose2(set.Count);
            }
            toReturn.PMatch = ((double)totalMatches) / ((double)Choose2(allData.Length));

            return(toReturn);
        }
コード例 #3
0
        public static double ProbabilityofMatch(Row a, Row b, ProfileDistribution distribution)
        {
            var profile = ProfileEngine.CreateProfile(a, b);

            return(ProbabilityofMatch(profile, distribution));
        }