public static ContestResults PrepareBaselineContestRestults(string contestId, 
                                TraceLabSDK.Types.Contests.TLExperimentResults experimentResults,
                                string techniqueName,                    
                                string techniqueDescription)
        {
            List<DatasetResultsDTO> results = new List<DatasetResultsDTO>();
            foreach (TraceLabSDK.Types.Contests.DatasetResults dataset in experimentResults.DatasetsResults)
            {
                results.Add(new DatasetResultsDTO(dataset));
            }

            var baselineResults = new ContestResults(contestId, techniqueName, techniqueDescription, results, experimentResults.Score, experimentResults.BaseData);
            return baselineResults;
        }
Exemple #2
0
        /// <summary>
        /// Publishes the contest results.
        /// </summary>
        /// <param name="ticket">The ticket.</param>
        /// <param name="username">The username.</param>
        /// <param name="contestResult">The contest result.</param>
        /// <param name="response">The response.</param>
        public void PublishContestResults(string ticket, string username, ContestResults contestResult, Callback <ContestResultsPublishedResponse> callback)
        {
            //set authentication ticket
            Envelope envelope = new Envelope(ticket, username, contestResult);

            //serialize contest result object to json format; requires adding the Contest result and all available metric types, as known type for the serialize method
            List <Type> knownTypes = new List <Type>(MetricTypesManager.GetMetricTypes);

            knownTypes.Add(typeof(ContestResults));

            string jsonEnvelope = JsonSerializer.Serialize <Envelope>(envelope, knownTypes);

            //call service and retrieve response json
            CallServiceAsync(TraceLabServiceCommands.PublishContestResults, jsonEnvelope, callback);
        }