protected String GenerateConfigFile(String filePath, String symbol, String training_file_path, String testing_file_path, String unique_id) { String output_file_base = filePath + "_results_"; String config_file_name = filePath + "_config" + unique_id + ".txt"; List <String> labels = new List <String> { "KNN_num_neighbors", "num_training_pts", "samples_per_group", "window_size", "avg_target", "good_target", "bad_target", "min_samples", "thresh1", "thresh2", "future_lookahead", "s_name", "description", "training_file", "training_start", "training_end", "testing_file", "testing_start", "testing_end", "output_csv_file", "output_txt_file", "output_pdf_file" }; List <String> values = new List <String> { KNN_num_neighbors.ToString(), num_training_pts.ToString(), samples_per_group.ToString(), window_size.ToString(), avg_target.ToString(), good_target.ToString(), bad_target.ToString(), min_samples.ToString(), thresh1.ToString(), thresh2.ToString(), FutureValueDaysToLookAhead.ToString(), symbol, description, training_file_path, TrainingStartDate.ToShortDateString(), TrainingEndDate.ToShortDateString(), testing_file_path, TestingStartDate.ToShortDateString(), TestingEndDate.ToShortDateString(), output_file_base + "data" + unique_id + ".csv", output_file_base + "summary" + unique_id + ".txt", output_file_base + "plot" + unique_id + ".pdf", }; List <String> types = new List <String> { "int", "int", "int", "int", "float", "float", "float", "int", "float", "float", "int", "str", "str", "str", "str", "str", "str", "str", "str", "str", "str", "str" }; var cfg = new StringBuilder(); for (int i = 0; i < labels.Count; i++) { cfg.AppendLine(labels[i] + "=" + values[i] + "#" + types[i]); } File.WriteAllText(config_file_name, cfg.ToString()); return(config_file_name); }
protected String GenerateConfigFile(String filePath, String symbol, String company, String training_file_path, String testing_file_path, String unique_id) { String output_file_base = filePath + "_results_"; String config_file_name = filePath + "_config" + unique_id + ".txt"; List <String> labels = new List <String> { "KNN_num_neighbors", "num_training_pts", "num_groups", "stagger_factor", "window_size", "avg_target", "good_target", "bad_target", "min_samples_pct", "thresh1", "thresh2", "future_lookahead", "s_name", "co_name", "description", "training_file", "training_start", "training_end", "testing_file", "testing_start", "testing_end", "output_csv_file", "output_txt_file", "output_pdf_file" }; List <String> values = new List <String> { KNN_num_neighbors.ToString(), num_training_pts.ToString(), num_groups.ToString(), stagger_factor.ToString(), window_size.ToString(), avg_target.ToString(), good_target.ToString(), bad_target.ToString(), min_samples_pct.ToString(), thresh1.ToString(), thresh2.ToString(), FutureValueDaysToLookAhead.ToString(), symbol, company, description, training_file_path, TrainingStartDate.ToShortDateString(), TrainingEndDate.ToShortDateString(), testing_file_path, TestingStartDate.ToShortDateString(), TestingEndDate.ToShortDateString(), output_file_base + "data" + unique_id + ".csv", output_file_base + "summary" + unique_id + ".txt", output_file_base + "plot" + unique_id + ".pdf", }; List <String> types = new List <String> { "int", "int", "int", "int", "int", "float", "float", "float", "float", "float", "float", "int", "str", "str", "str", "str", "str", "str", "str", "str", "str", "str", "str", "str" }; var cfg = new StringBuilder(); for (int i = 0; i < labels.Count; i++) { cfg.AppendLine(labels[i] + "=" + values[i] + "#" + types[i]); } //mut.WaitOne(); //wait until safe to enter; prior thread has completed writing. try { File.WriteAllText(config_file_name, cfg.ToString()); //mut.ReleaseMutex(); } catch (System.Exception exp) { Log("File write error for file name '" + filePath + "' Error '" + exp.Message + "'", LogLevel.Warning); } return(config_file_name); }