Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/12/11 13:48:31 (13 years ago)
Author:
mkommend
Message:

#1597, #1609, #1640:

  • Corrected TableFileParser to handle empty rows correctly.
  • Refactored DataSet to store values in List<List> instead of a two-dimensional array.
  • Enable importing and storing string and datetime values.
  • Changed data access methods in dataset and adapted all concerning classes.
  • Changed interpreter to store the variable values for all rows during the compilation step.
Location:
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/AlglibUtil.cs

    r6002 r6740  
    3131
    3232      double[,] matrix = new double[rowsList.Count, variablesList.Count];
    33       for (int row = 0; row < rowsList.Count; row++) {
    34         int col = 0;
    35         foreach (string column in variables) {
    36           matrix[row, col] = dataset[column, rowsList[row]];
    37           col++;
     33
     34      int col = 0;
     35      foreach (string column in variables) {
     36        var values = dataset.GetDoubleValues(column, rows);
     37        int row = 0;
     38        foreach (var value in values) {
     39          matrix[row, col] = value;
     40          row++;
    3841        }
     42        col++;
    3943      }
     44
    4045      return matrix;
    4146    }
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/MultinomialLogitClassification.cs

    r6649 r6740  
    7878      int nRows = inputMatrix.GetLength(0);
    7979      int nFeatures = inputMatrix.GetLength(1) - 1;
    80       double[] classValues = dataset.GetVariableValues(targetVariable).Distinct().OrderBy(x => x).ToArray();
     80      double[] classValues = dataset.GetDoubleValues(targetVariable).Distinct().OrderBy(x => x).ToArray();
    8181      int nClasses = classValues.Count();
    8282      // map original class values to values [0..nClasses-1]
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/NearestNeighbour/NearestNeighbourClassification.cs

    r6649 r6740  
    9696      int nRows = inputMatrix.GetLength(0);
    9797      int nFeatures = inputMatrix.GetLength(1) - 1;
    98       double[] classValues = dataset.GetVariableValues(targetVariable).Distinct().OrderBy(x => x).ToArray();
     98      double[] classValues = dataset.GetDoubleValues(targetVariable).Distinct().OrderBy(x => x).ToArray();
    9999      int nClasses = classValues.Count();
    100100      // map original class values to values [0..nClasses-1]
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkClassification.cs

    r6720 r6740  
    192192      int nRows = inputMatrix.GetLength(0);
    193193      int nFeatures = inputMatrix.GetLength(1) - 1;
    194       double[] classValues = dataset.GetVariableValues(targetVariable).Distinct().OrderBy(x => x).ToArray();
     194      double[] classValues = dataset.GetDoubleValues(targetVariable).Distinct().OrderBy(x => x).ToArray();
    195195      int nClasses = classValues.Count();
    196196      // map original class values to values [0..nClasses-1]
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkEnsembleClassification.cs

    r6720 r6740  
    178178      int nRows = inputMatrix.GetLength(0);
    179179      int nFeatures = inputMatrix.GetLength(1) - 1;
    180       double[] classValues = dataset.GetVariableValues(targetVariable).Distinct().OrderBy(x => x).ToArray();
     180      double[] classValues = dataset.GetDoubleValues(targetVariable).Distinct().OrderBy(x => x).ToArray();
    181181      int nClasses = classValues.Count();
    182182      // map original class values to values [0..nClasses-1]
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/RandomForest/RandomForestClassification.cs

    r6649 r6740  
    108108      int nCols = inputMatrix.GetLength(1);
    109109      int info;
    110       double[] classValues = dataset.GetVariableValues(targetVariable).Distinct().OrderBy(x => x).ToArray();
     110      double[] classValues = dataset.GetDoubleValues(targetVariable).Distinct().OrderBy(x => x).ToArray();
    111111      int nClasses = classValues.Count();
    112112      // map original class values to values [0..nClasses-1]
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorMachineUtil.cs

    r6002 r6740  
    3434    public static SVM.Problem CreateSvmProblem(Dataset dataset, string targetVariable, IEnumerable<string> inputVariables, IEnumerable<int> rowIndices) {
    3535      double[] targetVector =
    36         dataset.GetEnumeratedVariableValues(targetVariable, rowIndices)
    37         .ToArray();
     36        dataset.GetDoubleValues(targetVariable, rowIndices).ToArray();
    3837
    3938      SVM.Node[][] nodes = new SVM.Node[targetVector.Length][];
     
    4645        int colIndex = 1; // make sure the smallest node index for SVM = 1
    4746        foreach (var inputVariable in inputVariablesList) {
    48           double value = dataset[row, dataset.GetVariableIndex(inputVariable)];
     47          double value = dataset.GetDoubleValue(inputVariable, row);
    4948          // SVM also works with missing values
    5049          // => don't add NaN values in the dataset to the sparse SVM matrix representation
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/kMeans/KMeansClusteringUtil.cs

    r5809 r6740  
    2020#endregion
    2121
     22using System;
    2223using System.Collections.Generic;
    2324using System.Linq;
    2425using HeuristicLab.Problems.DataAnalysis;
    25 using System;
    2626
    2727namespace HeuristicLab.Algorithms.DataAnalysis {
     
    4242          int col = 0;
    4343          foreach (var inputVariable in allowedInputVariables) {
    44             double d = center[col++] - dataset[inputVariable, row];
     44            double d = center[col++] - dataset.GetDoubleValue(inputVariable, row);
    4545            d = d * d; // square;
    4646            centerDistance += d;
     
    7373        double[] p = new double[allowedInputVariables.Count];
    7474        for (int i = 0; i < nCols; i++) {
    75           p[i] = dataset[allowedInputVariables[i], row];
     75          p[i] = dataset.GetDoubleValue(allowedInputVariables[i], row);
    7676        }
    7777        clusterPoints[clusterValues[clusterValueIndex++]].Add(p);
Note: See TracChangeset for help on using the changeset viewer.