private static void ComputeFifth() { var fifther = new Fifther(); fifther.Load(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "fifth")); Console.Write("Enter dataset:"); var cString = Console.ReadLine(); var bagOfTerms = File.ReadAllLines("res\\expert_topics.csv").Skip(1).Select(z => z.Split(',')).ToDictionary(z => int.Parse(z[0]), z => new HashSet <string>(z[1].Split(' '))); var scope = new QuestionnaireScope(); XmlSerializer serializer = new XmlSerializer(typeof(QuestionnaireScope)); using (var reader = new StreamReader("test_fifth.xml")) { scope = (QuestionnaireScope)serializer.Deserialize(reader); } var log = new LoggerConfiguration() .MinimumLevel.Verbose() .WriteTo.LiterateConsole() .CreateLogger(); var repository = new UserGetRepository(cString, log, new CompressorProto()); var fifthRepo = new FifthResultRepository(cString); var groupmapping = JsonConvert.DeserializeObject <Dictionary <long, double[]> >(File.ReadAllText("map_groups.json")); fifthRepo.CleanAll(); var count = 0; var gsw = Stopwatch.StartNew(); UserGet[] users = new UserGet[0]; const int batch = 1000; do { try { users = repository.RangeSelect(count, batch).ToArray(); users = users.Where(z => z?.Groups?.Count > 0).ToArray(); float[][] input = new float[users.Length][]; for (int user = 0; user < users.Length; user++) { input[user] = users[user].ToVector(groupmapping, bagOfTerms); } var preds = fifther.PredictDistr(input, 5); fifthRepo.Insert(users.Select(z => z.id).ToArray(), preds.Select(z => QuestionaireDatasetPreparation.PredictionsToScales(scope, z)).ToArray()); count += batch; log.Information("Done {Count} recs. {DaysForMillion} days", count, TimeSpan.FromMilliseconds(1000000 * gsw.ElapsedMilliseconds / count).TotalDays); } catch (Exception ex) { Console.WriteLine(ex); } } while (users.Length != 0); Console.WriteLine("Done"); Console.ReadLine(); Console.ReadLine(); }