예제 #1
0
        public int Classify(DataRow row)
        {
            if (IsLeaf)
            {
                return Classification;
            }

            foreach(var kvp in _children)
            {
                if(kvp.Value(row))
                {
                    return kvp.Key.Classify(row);
                }
            }
            return 0;
        }
예제 #2
0
파일: NBayes.cs 프로젝트: mlohstroh/ml
        private double ProbabiltyOfClassification(DataRow row, int classification)
        {
            double chanceOfClassification = GetProbabilityOfClassification(classification);
            List<BayesContainer> probability = _probabilities[classification];


            foreach(var attr in _attributes)
            {
                // evil extra loop... whatever. I don't care about speed here
                foreach(var container in probability)
                {
                    if (container.Attribute == attr)
                        chanceOfClassification *= container.Probability;
                }
            }

            return chanceOfClassification;
        }
예제 #3
0
파일: Perceptron.cs 프로젝트: mlohstroh/ml
        private double GetWeightedSum(DataRow row)
        {
            double weightedSum = 0;

            for (int x = 0; x < _edges.Count; x++)
            {
                Edge currentEdge = _edges[x];
                weightedSum += currentEdge.Weight * row.RetrieveValueAsInt(currentEdge.Attribute);
            }

            // now that we have the weighted sum, lets sigmoid it
			return weightedSum;
        }