示例#1
0
        public void Run()
        {
            Insert2 trainingStatus = m_predictionFramework.GetModelStatus(ProjectModelId);

            Console.WriteLine("Training status: {0}", trainingStatus.TrainingStatus);
            ToConsole(trainingStatus.ModelInfo);
        }
示例#2
0
        public void Run()
        {
            Console.WriteLine("Model '{0}' deleted with response '{1}'.", ProjectModelId.ModelId, m_predictionFramework.DeleteTrainedModel(ProjectModelId));
            Insert2 insertResponse = m_predictionFramework.TrainRegressionModel(ProjectModelId, m_storageData);

            Console.WriteLine("Inserted the training data for the model.");

            // Wait until the training is complete
            bool trainingRunning = true;

            while (trainingRunning)
            {
                Console.WriteLine("Getting a new training progress status...");
                var getResponse = m_predictionFramework.GetModelStatus(ProjectModelId);
                Console.WriteLine("Got a new training progress status: {0}", getResponse.TrainingStatus);

                switch (getResponse.TrainingStatus)
                {
                case "RUNNING":
                    Console.WriteLine("The model training is still in progress, let us wait for {0} ms.", PROGRESS_WAITING_TIME);
                    Thread.Sleep(PROGRESS_WAITING_TIME);
                    break;

                case "DONE":
                    Console.WriteLine("The model has been trained successfully.");
                    ToConsole(getResponse.ModelInfo);
                    trainingRunning = false;
                    break;

                case "ERROR: TRAINING JOB NOT FOUND":
                    throw new Exception("the training job was not found.");

                case "ERROR: TOO FEW INSTANCES IN DATASET":
                    throw new Exception("there are too few instances in the dataset.");

                default:
                    throw new ArgumentException("Unknown status (error): " + getResponse.TrainingStatus);
                }
            }
        }