public void run() { init(); // delete already existing data from database db.ExecuteNonQuery("DELETE FROM " + Constants.ExperimentsTable + " WHERE algorithm_id = " + experimentMethodCode + " and population_group = " + experimentGroup); // At this stage we have everything we need to run the experiment // We should run the experiment on 5 different parameters mentioned in ExperimentInputParams var inputParams = new ExperimentInputParams(); Users = new List <User>(50000); for (int i = 0; i < Users.Capacity; i++) { Users.Add(null); } foreach (var pop in inputParams.percentOfParticipants) { foreach (var pou in inputParams.percentOfUpdatesUsed) { for (int i = 0; i < Users.Capacity; i++) { Users[i] = null; } UserTags = null; GC.Collect(); GC.WaitForPendingFinalizers(); UserTags = (from tag in TotalReportedUserTags where tag.RandomUserValue <= pop && tag.RandomColumnValue <= pou select tag).ToList(); var usersids = (from tag in UserTags select new { id = tag.UserID, trust = tag.UserTrust }).Distinct().ToList(); for (int i = 0; i < usersids.Count; i++) { Users[usersids[i].id] = new User(usersids[i].id, usersids[i].trust, 50); } foreach (var dc in inputParams.discounted) { foreach (var mt in inputParams.maxTrust) { foreach (var pot in inputParams.percentOfTraining) { var options = new ExperimentOptions(dc, mt, pop, pou, pot, experimentMethodCode, experimentGroup); if (UserTags.Count > 0) { Method method = new Method(Occupancies, Users, UserTags, options); MethodPerformance performance = method.Execute(); int experiment_id = storeExperiment2db(performance, options); } } } } } } }
private void GetOccupancyPenaltySumation() { double sum11 = 0, sum12 = 0, sum13 = 0, sum21 = 0, sum22 = 0, sum23 = 0; int counter = 0; var PenaltyMatrix = new ExperimentInputParams().PenaltyMatrix; for (int i = 0; i < Occupancies.Count; i++) { if (Occupancies[i].CountInEvaluation) { if (Occupancies[i].Day >= StopTrainingDay) { var oc = Occupancies[i]; sum11 += PenaltyMatrix[oc.OccupancyTag - 1][oc.PredictedOccupancyTag - 1]; sum12 += PenaltyMatrix[oc.OccupancyTag - 1][oc.MaxVoteOccupancyTag - 1]; sum13 += PenaltyMatrix[oc.OccupancyTag - 1][oc.RandomOccupancyTag - 1]; counter++; } } } OccupancyPenaltyPerformance = new Performance[] { new Performance(sum11 / counter, -1), new Performance(sum12 / counter, -1), new Performance(sum13 / counter, -1) }; // pred, maxvote, random }