/// <summary>
        /// Initialise the form with the Worker Object
        /// </summary>
        /// <param name="currentWorker"></param>
        public FormTaskDetails(string taskId, ExperimentModel relatedExperimentItem)
        {
            InitializeComponent();

            this.taskId = taskId;
            //Display the workerId in the form title
            this.Text = "[Task]" + taskId;
            this.relatedExperimentItem = relatedExperimentItem;
            this.labelForTaskId.Text = taskId;
            this.labelModelDetail.Text = relatedExperimentItem.ToString();

            //load data
            labelConfusionMatrix.Text = probabilityText;
            indexOfExperimentItem = MainPage.mainPageForm.currentExperimentSetting.GetExperimenModelIndex(relatedExperimentItem);
            probabilitiesArray = MainPage.mainPageForm.currentExperimentSetting.GetTaskTrueLabel(indexOfExperimentItem, taskId);
            labelHeader = "";
            int labelCount = 0;

            //Initialise the probabilitiesArray
            if (probabilitiesArray != null)
            {
                labelCount = probabilitiesArray.Dimension;
                Enumerable.Range(1, labelCount).ToList().ForEach(i => labelHeader += "Label" + i + "       ");
                // labelForDataHeader.Text = labelHeader;
                SetUpChart();

                //Only sync the background thread if it is activeLearning
                if (MainPage.mainPageForm.currentExperimentSetting.experimentType == ExperimentType.ActiveLearning)
                {
                    backgroundTaskValues.RunWorkerAsync();
                }
            }// End if the probabilitiesArray is not null
        } // End Constructor
        /// <summary>
        /// Initialise the form with the Worker Object
        /// </summary>
        /// <param name="currentWorker"></param>
        public FormWorkerOrCommunityDetail(Worker currentWorker, ExperimentModel relatedExperimentItem)
        {
            InitializeComponent();
            this.currentWorker = currentWorker;

            //Display the workerId in the form title
            this.Text = "[Worker]" + currentWorker.WorkerId;
            this.relatedExperimentItem = relatedExperimentItem;
            this.labelForWorkerId.Text = currentWorker.WorkerId;
            this.labelModelDetail.Text = relatedExperimentItem.ToString();
            RunType[] runTypesHaveWorkerMatrices = { RunType.DawidSkene, RunType.BCC, RunType.CBCC };

            //Only display the confusion matrices if it matches the runType
            if (runTypesHaveWorkerMatrices.Contains(relatedExperimentItem.runType))
            {
                indexOfExperimentItem    = MainPage.mainPageForm.currentExperimentSetting.GetExperimenModelIndex(relatedExperimentItem);
                printableConfusionMatrix = MainPage.mainPageForm.currentExperimentSetting.getWorkerResults(indexOfExperimentItem, currentWorker.WorkerId);
                LoadConfusionMatrix();
                //SetUpChart();
                labelConfusionMatrix.Text   = MainPage.mainPageForm.currentExperimentSetting.getConfusionMatrixString(printableConfusionMatrix);
                textBoxConfusionMatrix.Text = labelConfusionMatrix.Text;
                //start background thread to update the confusion matrice accordingly if it is activeLearning
                if (MainPage.mainPageForm.currentExperimentSetting.experimentType == ExperimentType.ActiveLearning)
                {
                    backgroundUpdateConfusionMatrix.RunWorkerAsync();
                }
            }
            else //for the RunType that does not have confusion matrix
            {
                //hide all controls related to confusion matrix
                confusionMatrixGraph.Visible   = false;
                textBoxConfusionMatrix.Visible = false;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initialise the form with the Worker Object
        /// </summary>
        /// <param name="currentWorker"></param>
        public FormTaskDetails(string taskId, ExperimentModel relatedExperimentItem)
        {
            InitializeComponent();

            this.taskId = taskId;
            //Display the workerId in the form title
            this.Text = "[Task]" + taskId;
            this.relatedExperimentItem = relatedExperimentItem;
            this.labelForTaskId.Text   = taskId;
            this.labelModelDetail.Text = relatedExperimentItem.ToString();

            //load data
            labelConfusionMatrix.Text = probabilityText;
            indexOfExperimentItem     = MainPage.mainPageForm.currentExperimentSetting.GetExperimenModelIndex(relatedExperimentItem);
            probabilitiesArray        = MainPage.mainPageForm.currentExperimentSetting.GetTaskTrueLabel(indexOfExperimentItem, taskId);
            labelHeader = "";
            int labelCount = 0;

            //Initialise the probabilitiesArray
            if (probabilitiesArray != null)
            {
                labelCount = probabilitiesArray.Dimension;
                Enumerable.Range(1, labelCount).ToList().ForEach(i => labelHeader += "Label" + i + "       ");
                // labelForDataHeader.Text = labelHeader;
                SetUpChart();

                //Only sync the background thread if it is activeLearning
                if (MainPage.mainPageForm.currentExperimentSetting.experimentType == ExperimentType.ActiveLearning)
                {
                    backgroundTaskValues.RunWorkerAsync();
                }
            } // End if the probabilitiesArray is not null
        }     // End Constructor
        /// <summary>
        /// Initialise the form with the Worker Object
        /// </summary>
        /// <param name="currentWorker"></param>
        public FormWorkerOrCommunityDetail(int communityIndex, ExperimentModel relatedExperimentItem)
        {
            InitializeComponent();
            isWorker            = false;
            this.communityIndex = communityIndex;

            //Display the workerId in the form title
            this.Text = "[Community]" + (communityIndex);
            this.labelForWorkerId.Text = "Community " + (communityIndex);
            labelTypeName.Text         = "Community";

            this.relatedExperimentItem = relatedExperimentItem;
            this.labelModelDetail.Text = relatedExperimentItem.ToString();

            //The RunType that has Community Matrix
            RunType[] runTypesHaveCommunityMatrices = { RunType.CBCC };

            //Only display the confusion matrices if it matches the runType
            if (runTypesHaveCommunityMatrices.Contains(relatedExperimentItem.runType))
            {
                indexOfExperimentItem = MainPage.mainPageForm.currentExperimentSetting.GetExperimenModelIndex(relatedExperimentItem);

                //get printableConfusionMatrix
                printableConfusionMatrix = MainPage.mainPageForm.currentExperimentSetting.getCommunityResults(indexOfExperimentItem, communityIndex);
                LoadConfusionMatrix();

                labelConfusionMatrix.Text   = MainPage.mainPageForm.currentExperimentSetting.getConfusionMatrixString(printableConfusionMatrix);
                textBoxConfusionMatrix.Text = labelConfusionMatrix.Text;
                //start background thread to update the confusion matrice accordingly
                backgroundUpdateConfusionMatrix.RunWorkerAsync();
            }
            else
            {
                //hide all controls related to confusion matrix
                confusionMatrixGraph.Visible   = false;
                textBoxConfusionMatrix.Visible = false;
            }
        } // End the constructor for the community
        /// <summary>
        /// Initialise the form with the Worker Object
        /// </summary>
        /// <param name="currentWorker"></param>
        public FormWorkerOrCommunityDetail(Worker currentWorker, ExperimentModel relatedExperimentItem)
        {
            InitializeComponent();
            this.currentWorker = currentWorker;

            //Display the workerId in the form title
            this.Text = "[Worker]" + currentWorker.WorkerId;
            this.relatedExperimentItem = relatedExperimentItem;
            this.labelForWorkerId.Text = currentWorker.WorkerId;
            this.labelModelDetail.Text = relatedExperimentItem.ToString();
            RunType[] runTypesHaveWorkerMatrices = { RunType.DawidSkene, RunType.BCC, RunType.CBCC };

            //Only display the confusion matrices if it matches the runType
            if (runTypesHaveWorkerMatrices.Contains(relatedExperimentItem.runType))
            {
                indexOfExperimentItem = MainPage.mainPageForm.currentExperimentSetting.GetExperimenModelIndex(relatedExperimentItem);
                printableConfusionMatrix = MainPage.mainPageForm.currentExperimentSetting.getWorkerResults(indexOfExperimentItem, currentWorker.WorkerId);
                LoadConfusionMatrix();
                //SetUpChart();
                labelConfusionMatrix.Text = MainPage.mainPageForm.currentExperimentSetting.getConfusionMatrixString(printableConfusionMatrix);
                textBoxConfusionMatrix.Text = labelConfusionMatrix.Text;
                //start background thread to update the confusion matrice accordingly if it is activeLearning
                if (MainPage.mainPageForm.currentExperimentSetting.experimentType == ExperimentType.ActiveLearning)
                {
                    backgroundUpdateConfusionMatrix.RunWorkerAsync();
                }

            }
            else //for the RunType that does not have confusion matrix 
            {
                //hide all controls related to confusion matrix
                confusionMatrixGraph.Visible = false;
                textBoxConfusionMatrix.Visible = false;
            }

        }
        /// <summary>
        /// Initialise the form with the Worker Object
        /// </summary>
        /// <param name="currentWorker"></param>
        public FormWorkerOrCommunityDetail(int communityIndex, ExperimentModel relatedExperimentItem)
        {
            InitializeComponent();
            isWorker = false;
            this.communityIndex = communityIndex;

            //Display the workerId in the form title
            this.Text = "[Community]" + (communityIndex );
            this.labelForWorkerId.Text = "Community " + (communityIndex );
            labelTypeName.Text = "Community";

            this.relatedExperimentItem = relatedExperimentItem;
            this.labelModelDetail.Text = relatedExperimentItem.ToString();

            //The RunType that has Community Matrix
            RunType[] runTypesHaveCommunityMatrices = { RunType.CBCC };

            //Only display the confusion matrices if it matches the runType
            if (runTypesHaveCommunityMatrices.Contains(relatedExperimentItem.runType))
            {
                indexOfExperimentItem = MainPage.mainPageForm.currentExperimentSetting.GetExperimenModelIndex(relatedExperimentItem);

                //get printableConfusionMatrix 
                printableConfusionMatrix = MainPage.mainPageForm.currentExperimentSetting.getCommunityResults(indexOfExperimentItem, communityIndex);
                LoadConfusionMatrix();
    
                labelConfusionMatrix.Text = MainPage.mainPageForm.currentExperimentSetting.getConfusionMatrixString(printableConfusionMatrix);
                textBoxConfusionMatrix.Text = labelConfusionMatrix.Text;
                //start background thread to update the confusion matrice accordingly
                backgroundUpdateConfusionMatrix.RunWorkerAsync();
            }
            else
            {
                //hide all controls related to confusion matrix
                confusionMatrixGraph.Visible = false;
                textBoxConfusionMatrix.Visible = false;
            }

        } // End the constructor for the community