Exemplo n.º 1
0
        public static String SaveDataSet()
        {
            String content = JsonConvert.SerializeObject(NeuralNetworkHandler.keeper);

            String fileId = GoogleDriveHandler.GetFileIdByName(NeuralNetworkHandler.keeper.Name);

            if (fileId == null)
            {
                GoogleDriveHandler.UploadGoogleDocument(content, NeuralNetworkHandler.keeper.Name + "-ds", "application/vnd.google-apps.file", "text/plain");
            }
            else
            {
                GoogleDriveHandler.UploadGoogleDocument(content, NeuralNetworkHandler.keeper.Name + "-ds", "application/vnd.google-apps.file", "text/plain", fileId);
            }

            return(String.Format("Successfully saved the dataset to {0}-ds", NeuralNetworkHandler.keeper.Name));
        }
Exemplo n.º 2
0
        public static String SaveNetwork(String name)
        {
            String content = ModelFileHandler.SaveModelToString(network);

            String fileId = GoogleDriveHandler.GetFileIdByName(name + "-nn");

            if (fileId == null)
            {
                GoogleDriveHandler.UploadGoogleDocument(content, name + "-nn", "application/vnd.google-apps.file", "text/plain");
            }
            else
            {
                GoogleDriveHandler.UploadGoogleDocument(content, name + "-nn", "application/vnd.google-apps.file", "text/plain", fileId);
            }

            return(String.Format("Successfully saved the network to {0}-nn", network.Name));
        }
Exemplo n.º 3
0
        public static String LoadNetwork(String name)
        {
            if (isTraining)
            {
                return("You can't load a network when there already is one training.");
            }

            String networkId = GoogleDriveHandler.GetFileIdByName(name + "-nn");

            if (String.IsNullOrEmpty(networkId))
            {
                return(String.Format("No file found with the name {0}-nn.", name));
            }

            String networkContent = GoogleDriveHandler.DownloadGoogleDocument(networkId, "text/plain", Encoding.UTF8);

            network      = ModelFileHandler.LoadModelFromString(networkContent);
            network.Name = name;

            return("Network successfully loaded in.");
        }
Exemplo n.º 4
0
        public static String LoadDataSet(String name)
        {
            if (NeuralNetworkHandler.isTraining)
            {
                return("You can't load a dataset when there is a network training.");
            }


            String datasetId = GoogleDriveHandler.GetFileIdByName(name + "-ds");

            if (datasetId == null)
            {
                return(String.Format("No file found with the name {0}-ds", name));
            }

            String datasetContent = GoogleDriveHandler.DownloadGoogleDocument(datasetId, "text/plain", Encoding.UTF8);

            NeuralNetworkHandler.keeper = JsonConvert.DeserializeObject <DataKeeper>(datasetContent);
            NeuralNetworkHandler.keeper.ValidationSet = NeuralNetworkHandler.keeper.DataSet;
            NeuralNetworkHandler.keeper.ShuffleDataSet();

            return("Dataset successfully loaded in.");
        }