Exemple #1
0
        public Outcome MachineLearning(Instances instances)
        {
            Outcome outcome = new Outcome();

            //load model
            string projectPath = AppDomain.CurrentDomain.BaseDirectory;
            LibSVM cls         = (LibSVM)SerializationHelper.read(projectPath + "/MachineLearning/svmModel.model");

            //predict outcome
            instances.setClassIndex(19);
            double[] values = cls.distributionForInstance(instances.instance(0));

            if (values[0] < values[1])
            {
                outcome.Success = false;
            }
            else
            {
                outcome.Success = true;
            }

            return(outcome);
        }