예제 #1
0
파일: Program.cs 프로젝트: kubbit98/PJATK
        public double calculateSum(SCP scp)
        {
            double sum = 0;

            for (int i = 0; i < input; i++)
            {
                sum += scp.points[i] * weight[i];
            }
            return(sum > theta ? 1 : 0);
        }
예제 #2
0
파일: Program.cs 프로젝트: kubbit98/PJATK
 public Perceptron testOne()
 {
     while (true)
     {
         Console.WriteLine("\nPodaj punkty (Cokolwiek innego dla wyjscia)");
         try
         {
             SCP scp = new SCP(Console.ReadLine(), false);
             Console.WriteLine("To" + (calculateSum(scp) == 1 ? " " : " nie ") + "Iris-setosa\n");
         }
         catch (Exception e) { Console.WriteLine("Zakończono program"); return(this); }
     }
 }
예제 #3
0
파일: Program.cs 프로젝트: kubbit98/PJATK
        static void Main(string[] args)
        {
            List <SCP> trainingList = new List <SCP>(), testList = new List <SCP>();;

            string[] trainingLines = File.ReadAllLines("..\\..\\..\\iris_training.txt"), testLines = File.ReadAllLines("..\\..\\..\\iris_test.txt");
            //string[] testLines = File.ReadAllLines("..\\..\\..\\iris_training.txt"), trainingLines = File.ReadAllLines("..\\..\\..\\iris_test.txt");
            foreach (string line in trainingLines)
            {
                SCP p = new SCP(line, true); trainingList.Add(p);
            }
            foreach (string line in testLines)
            {
                SCP p = new SCP(line, true); testList.Add(p);
            }
            Perceptron magic = new Perceptron(trainingList[0].points.Length, "Iris-setosa", 0.5);

            magic.learn(trainingList).test(testList).testOne();
        }