Example #1
0
        private List <List <Double> > rawExamplesFromDataSet(DataSet ds,
                                                             Numerizer numerizer)
        {
            // assumes all values for inout and target are doubles
            List <List <Double> > rds = new List <List <Double> >();

            for (int i = 0; i < ds.size(); i++)
            {
                List <Double> rexample = new List <Double>();
                Example       e        = ds.getExample(i);
                Pair <List <Double>, List <Double> > p = numerizer.numerize(e);
                List <Double> attributes = p.getFirst();
                foreach (Double d in attributes)
                {
                    rexample.Add(d);
                }
                List <Double> targets = p.getSecond();
                foreach (Double d in targets)
                {
                    rexample.Add(d);
                }
                rds.Add(rexample);
            }
            return(rds);
        }
Example #2
0
        /*
         * create a normalized data "table" from the DataSet using numerizer. At
         * this stage, the data isnot split into input pattern and targets TODO
         * remove redundancy of recreating the target columns. the numerizer has
         * already isolated the targets
         */
        public void createNormalizedDataFromDataSet(DataSet ds, Numerizer numerizer)
        {
            List <List <Double> > rds = rawExamplesFromDataSet(ds, numerizer);

            // normalize raw dataset
            nds = normalize(rds);
        }
Example #3
0
        /*
         * create a normalized data "table" from the DataSet using numerizer. At
         * this stage, the data isnot split into input pattern and targets TODO
         * remove redundancy of recreating the target columns. the numerizer has
         * already isolated the targets
         */
        public void createNormalizedDataFromDataSet(DataSet ds, Numerizer numerizer)
        {

            List<List<Double>> rds = rawExamplesFromDataSet(ds, numerizer);
            // normalize raw dataset
            nds = normalize(rds);
        }
Example #4
0
        static string NumerizeLongScale(long r, string s)
        {
            string numerizedInput = null;

            try
            {
                numerizedInput = Numerizer.Numerize(s, true);
            }
            catch (Exception ex)
            {
                throw new Exception(
                          String.Format(
                              "Test case: {0} => {1} :: {2}", s, r, ex.Message),
                          ex);
            }
            return(numerizedInput);
        }
Example #5
0
        static string Numerize(int r, string s, string culture = "en")
        {
            Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(culture);

            string numerizedInput = null;

            try
            {
                numerizedInput = Numerizer.Numerize(s);
            }
            catch (Exception ex)
            {
                throw new Exception(
                          String.Format(
                              "Test case: {0} => {1} :: {2}", s, r, ex.Message),
                          ex);
            }
            return(numerizedInput);
        }
Example #6
0
        private static string Numerize(int r, string s)
        {
            string numerizedInput = null;

            try
            {
                numerizedInput = Numerizer.Numerize(s);
            }
            catch (Exception ex)
            {
                throw new Exception(
                          string.Format(
                              "Test case: {0} => {1} :: {2}",
                              s,
                              r,
                              ex.Message),
                          ex);
            }

            return(numerizedInput);
        }
Example #7
0
 public void test_edges_in_french()
 {
     Assert.Equal(
         "27 Oct 2006 7h30", Numerizer.Numerize("27 Oct 2006 7h30"));
 }
Example #8
0
 public void test_edges()
 {
     Assert.Equal(
         "27 Oct 2006 7:30am", Numerizer.Numerize("27 Oct 2006 7:30am"));
 }
Example #9
0
 /*
  * method called by clients to set up data set and make it ready for
  * processing
  */
 public void createExamplesFromDataSet(DataSet ds, Numerizer numerizer)
 {
     createNormalizedDataFromDataSet(ds, numerizer);
     setTargetColumns();
     createExamples();
 }
Example #10
0
 public static string Numerize(this string @this, bool intendingTime)
 {
     return(Numerizer.Numerize(@this, intendingTime));
 }
Example #11
0
 public static string Numerize(this string @this)
 {
     return(Numerizer.Numerize(@this));
 }
Example #12
0
        private List<List<Double>> rawExamplesFromDataSet(DataSet ds,
                Numerizer numerizer) {
		// assumes all values for inout and target are doubles
		List<List<Double>> rds = new List<List<Double>>();
		for (int i = 0; i < ds.size(); i++) {
			List<Double> rexample = new List<Double>();
			Example e = ds.getExample(i);
			Pair<List<Double>, List<Double>> p = numerizer.numerize(e);
			List<Double> attributes = p.getFirst();
			foreach (Double d in attributes) {
				rexample.Add(d);
			}
			List<Double> targets = p.getSecond();
			foreach (Double d in targets) {
				rexample.Add(d);
			}
			rds.Add(rexample);
		}
		return rds;
	}
Example #13
0
        /*
         * method called by clients to set up data set and make it ready for
         * processing
         */
        public void createExamplesFromDataSet(DataSet ds, Numerizer numerizer)
        {
            createNormalizedDataFromDataSet(ds, numerizer);
            setTargetColumns();
            createExamples();

        }