Exemplo n.º 1
0
        private static double[,] GetData(IDataset ds, IEnumerable <string> allowedInputs, IEnumerable <int> rows, Scaling scaling)
        {
            if (scaling != null)
            {
                // BackwardsCompatibility3.3
                #region Backwards compatible code, remove with 3.4
                // TODO: completely remove Scaling class
                List <string> variablesList = allowedInputs.ToList();
                List <int>    rowsList      = rows.ToList();

                double[,] matrix = new double[rowsList.Count, variablesList.Count];

                int col = 0;
                foreach (string column in variablesList)
                {
                    var values = scaling.GetScaledValues(ds, column, rowsList);
                    int row    = 0;
                    foreach (var value in values)
                    {
                        matrix[row, col] = value;
                        row++;
                    }
                    col++;
                }
                return(matrix);

                #endregion
            }
            else
            {
                return(ds.ToArray(allowedInputs, rows));
            }
        }
Exemplo n.º 2
0
    public static double[,] PrepareAndScaleInputMatrix(IDataset dataset, IEnumerable<string> variables, IEnumerable<int> rows, Scaling scaling) {
      List<string> variablesList = variables.ToList();
      List<int> rowsList = rows.ToList();

      double[,] matrix = new double[rowsList.Count, variablesList.Count];

      int col = 0;
      foreach (string column in variables) {
        var values = scaling.GetScaledValues(dataset, column, rows);
        int row = 0;
        foreach (var value in values) {
          matrix[row, col] = value;
          row++;
        }
        col++;
      }

      return matrix;
    }
Exemplo n.º 3
0
        public static double[,] PrepareAndScaleInputMatrix(IDataset dataset, IEnumerable <string> variables, IEnumerable <int> rows, Scaling scaling)
        {
            List <string> variablesList = variables.ToList();
            List <int>    rowsList      = rows.ToList();

            double[,] matrix = new double[rowsList.Count, variablesList.Count];

            int col = 0;

            foreach (string column in variables)
            {
                var values = scaling.GetScaledValues(dataset, column, rows);
                int row    = 0;
                foreach (var value in values)
                {
                    matrix[row, col] = value;
                    row++;
                }
                col++;
            }

            return(matrix);
        }