Esempio n. 1
0
        public void Instantiate() {
            int[] actualLayersSizes = new int[LayersSizes.Length + 2];
            actualLayersSizes[0] = 300;
            actualLayersSizes[actualLayersSizes.Length - 1] = 10;

            for (int i = 0; i < LayersSizes.Length; i++)
                actualLayersSizes[i + 1] = LayersSizes[i];

            Instance = new Perceptron(actualLayersSizes);
            Instance.Initialize();
        }
Esempio n. 2
0
        public void Instantiate()
        {
            int[] actualLayersSizes = new int[LayersSizes.Length + 2];
            actualLayersSizes[0] = 300;
            actualLayersSizes[actualLayersSizes.Length - 1] = 10;

            for (int i = 0; i < LayersSizes.Length; i++)
            {
                actualLayersSizes[i + 1] = LayersSizes[i];
            }

            Instance = new Perceptron(actualLayersSizes);
            Instance.Initialize();
        }
Esempio n. 3
0
        static void Run(string[] args)
        {
            Engine.Output = new ConsoleStreamOutput();

            if (args.Length == 0)
            {
                throw new Exception("error: invalid arguments\nUse /? or /help to see available commands");
            }

            INeuralNetwork net;

            switch (args[0])
            {
            case "/?":
            case "/help":
                Console.WriteLine("This is help.");
                break;

            case "/data":
                if (args.Length != 2)
                {
                    InvalidArguments();
                }

                Settings.Instance.DataDirectoryPath = args[1];
                Settings.Save();
                break;

            case "/tests":
                if (args.Length != 2)
                {
                    InvalidArguments();
                }

                Settings.Instance.TestsDirectoryPath = args[1];
                Settings.Save();
                break;

            case "/rate":
                if (args.Length != 2)
                {
                    InvalidArguments();
                }

                Settings.Instance.LearningRate = double.Parse(args[1]);
                Settings.Save();
                break;

            case "/create":
                if (args.Length < 2)
                {
                    InvalidArguments();
                }

                int[] layersSizes = new int[args.Length - 1];

                for (int i = 0; i < layersSizes.Length; i++)
                {
                    layersSizes[i] = int.Parse(args[i + 1]);
                }

                Engine.Create(layersSizes);
                break;

            case "/learn":
                if (args.Length != 1)
                {
                    InvalidArguments();
                }

                Engine.Learn();
                break;

            case "/classify":
                if (args.Length != 2)
                {
                    InvalidArguments();
                }

                Engine.Classify(args[1]);
                break;

            case "/optimize":
                Genetics genetics = new Genetics();
                net = genetics.Optimize();
                net.Save(Settings.Instance.NetworkFileName);
                Settings.Save();
                break;

            case "/inspect":
                if (args.Length != 1)
                {
                    InvalidArguments();
                }

                net = new Perceptron();
                net.Load(Settings.Instance.NetworkFileName);
                Console.WriteLine(net.Inspect());
                break;

            default:
                InvalidArguments();
                break;
            }
        }
Esempio n. 4
0
        static void Run(string[] args) {
            Engine.Output = new ConsoleStreamOutput();

            if (args.Length == 0)
                throw new Exception("error: invalid arguments\nUse /? or /help to see available commands");

            INeuralNetwork net;

            switch (args[0]) {
                case "/?":
                case "/help":
                    Console.WriteLine("This is help.");
                    break;

                case "/data":
                    if (args.Length != 2)
                        InvalidArguments();

                    Settings.Instance.DataDirectoryPath = args[1];
                    Settings.Save();
                    break;

                case "/tests":
                    if (args.Length != 2)
                        InvalidArguments();

                    Settings.Instance.TestsDirectoryPath = args[1];
                    Settings.Save();
                    break;

                case "/rate":
                    if (args.Length != 2)
                        InvalidArguments();

                    Settings.Instance.LearningRate = double.Parse(args[1]);
                    Settings.Save();
                    break;

                case "/create":
                    if (args.Length < 2)
                        InvalidArguments();

                    int[] layersSizes = new int[args.Length - 1];

                    for (int i = 0; i < layersSizes.Length; i++)
                        layersSizes[i] = int.Parse(args[i + 1]);

                    Engine.Create(layersSizes);
                    break;

                case "/learn":
                    if (args.Length != 1)
                        InvalidArguments();

                    Engine.Learn();
                    break;

                case "/classify":
                    if (args.Length != 2)
                        InvalidArguments();

                    Engine.Classify(args[1]);
                    break;

                case "/optimize":
                    Genetics genetics = new Genetics();
                    net = genetics.Optimize();
                    net.Save(Settings.Instance.NetworkFileName);
                    Settings.Save();
                    break;

                case "/inspect":
                    if (args.Length != 1)
                        InvalidArguments();

                    net = new Perceptron();
                    net.Load(Settings.Instance.NetworkFileName);
                    Console.WriteLine(net.Inspect());
                    break;

                default:
                    InvalidArguments();
                    break;
            }
        }