/// <summary> /// This method is called to determine the birth year for a person. It /// obtains 100 web pages that Yahoo returns for that person. Each of these /// pages is then searched for the birth year of that person. Which ever year /// is selected the largest number of times is selected as the birth year. /// </summary> public void Process() { ReadCSV famous = new ReadCSV("famous.csv"); Report("Building training data from list of famous people."); DateTime started = new DateTime(); this.totalTasks = 0; while (famous.Next()) { String name = famous.Get("Person"); int year = famous.GetInt("Year"); CollectionWorker worker = new CollectionWorker(this, name, year); worker.Call(); this.totalTasks++; } long length = (DateTime.Now - started).Ticks; length /= 1000L; length /= 60; Console.WriteLine("Took " + length + " minutes to collect training data from the Internet."); Console.WriteLine("Writing training file"); WriteTrainingFile(); }
public void loadPrime(String primeFilename) { ReadCSV csv = new ReadCSV(primeFilename); while (csv.Next()) { DateTime date = csv.GetDate("date"); double rate = csv.GetDouble("prime"); InterestRate ir = new InterestRate(date, rate); this.rates.Add(ir); } csv.Close(); this.rates.Sort(); }
public void loadSP500(String sp500Filename) { ReadCSV csv = new ReadCSV(sp500Filename); while (csv.Next()) { DateTime date = csv.GetDate("date"); double amount = csv.GetDouble("adj close"); FinancialSample sample = new FinancialSample(); sample.setAmount(amount); sample.setDate(date); this.samples.Add(sample); } csv.Close(); this.samples.Sort(); }