private void UpdateStatistics() {
      DoubleMatrix matrix = new DoubleMatrix(9, seriesCache.Count);
      matrix.SortableView = false;
      List<string> columnNames = new List<string>();
      foreach (Series series in seriesCache.Values) {
        DataPoint datapoint = series.Points.FirstOrDefault();
        if (datapoint != null) {
          IRun run = (IRun)datapoint.Tag;
          string selectedAxis = xAxisValue;
          IItem value = null;

          if (Enum.IsDefined(typeof(AxisDimension), selectedAxis)) {
            AxisDimension axisDimension = (AxisDimension)Enum.Parse(typeof(AxisDimension), selectedAxis);
            switch (axisDimension) {
              case AxisDimension.Color: value = new StringValue(run.Color.ToString());
                break;
            }
          } else value = Content.GetValue(run, selectedAxis);
          string columnName = string.Empty;
          if (value is DoubleValue || value is IntValue)
            columnName = selectedAxis + ": ";
          columnName += value.ToString();
          columnNames.Add(columnName);
        }
      }
      matrix.ColumnNames = columnNames;
      matrix.RowNames = new string[] { "Count", "Minimum", "Maximum", "Median", "Average", "Standard Deviation", "Variance", "25th Percentile", "75th Percentile" };

      for (int i = 0; i < seriesCache.Count; i++) {
        Series series = seriesCache.ElementAt(i).Value;
        double[] seriesValues = series.Points.Select(p => p.YValues[0]).OrderBy(d => d).ToArray();
        matrix[0, i] = seriesValues.Length;
        matrix[1, i] = seriesValues.Min();
        matrix[2, i] = seriesValues.Max();
        matrix[3, i] = seriesValues.Median();
        matrix[4, i] = seriesValues.Average();
        matrix[5, i] = seriesValues.StandardDeviation();
        matrix[6, i] = seriesValues.Variance();
        matrix[7, i] = seriesValues.Quantile(0.25);
        matrix[8, i] = seriesValues.Quantile(0.75);
      }
      statisticsMatrixView.Content = matrix;
    }
Пример #2
0
 protected PathValue(PathValue original, Cloner cloner)
   : base(original, cloner) {
   stringValue = cloner.Clone(original.stringValue);
 }
Пример #3
0
    public new bool[] Check() {
      bool[] result = new bool[ConstrainedValue.Rows];

      if (!Active)
        return result;

      for (int row = 0; row < ConstrainedValue.Rows; ++row) {
        object item = null;
        if (ConstrainedValue.VariableHasType<double>(constraintColumn)) {
          item = new HeuristicLab.Data.DoubleValue(ConstrainedValue.GetCell<double>(ConstraintColumn, row));
        } else if (ConstrainedValue.VariableHasType<DateTime>(constraintColumn)) {
          item = new HeuristicLab.Data.DateTimeValue(ConstrainedValue.GetCell<DateTime>(ConstraintColumn, row));
        } else {
          item = new StringValue(ConstrainedValue.GetCell<string>(ConstraintColumn, row));
        }

        result[row] = !base.Check(item);
      }

      return result;
    }
Пример #4
0
 private List<IFilter> CreateFilters(string match, ComparisonOperation comparisonOperation, int columnIndex) {
   IPreprocessingData preprocessingData = Content.FilterLogic.PreprocessingData;
   IStringConvertibleValue value;
   if (preprocessingData.VariableHasType<double>(columnIndex)) {
     value = new DoubleValue();
   } else if (preprocessingData.VariableHasType<String>(columnIndex)) {
     value = new StringValue();
   } else if (preprocessingData.VariableHasType<DateTime>(columnIndex)) {
     value = new DateTimeValue();
   } else {
     throw new ArgumentException("unsupported type");
   }
   value.SetValue(match);
   var comparisonFilter = new ComparisonFilter(preprocessingData, GetConstraintOperation(comparisonOperation), value, true);
   comparisonFilter.ConstraintColumn = columnIndex;
   return new List<Filter.IFilter>() { comparisonFilter };
 }
    private CopyColumnTransformation CreateCopyTransformation(string oldColumn, string newColumn) {
      var newColumName = new StringValue(newColumn);

      var copyTransformation = new CopyColumnTransformation();
      copyTransformation.ColumnParameter.ValidValues.Add(newColumName);
      copyTransformation.ColumnParameter.Value = newColumName;

      copyTransformation.CopiedColumnNameParameter.Value.Value = oldColumn;
      return copyTransformation;
    }
Пример #6
0
 public override void CollectParameterValues(IDictionary<string, IItem> values) {
   base.CollectParameterValues(values);
   values["Type"] = new StringValue(GetType().GetPrettyName(false));
 }
Пример #7
0
 protected StringValue(StringValue original, Cloner cloner)
   : base(original, cloner) {
   this.value = original.value != null ? original.value : string.Empty;
   this.readOnly = original.readOnly;
 }
 private void RenameTransformationColumnParameter(List<Transformation<double>> transformations) {
   foreach (var transformation in transformations) {
     var newColumnName = new StringValue(renamedColumns[transformation.Column]);
     transformation.ColumnParameter.ValidValues.Add(newColumnName);
     transformation.ColumnParameter.Value = newColumnName;
   }
 }
Пример #9
0
 private IStringConvertibleValue CreateStringConvertibleValue(int columnIndex) {
   IStringConvertibleValue value;
   if (Content.ConstrainedValue.VariableHasType<double>(columnIndex)) {
     value = new DoubleValue();
   } else if (Content.ConstrainedValue.VariableHasType<String>(columnIndex)) {
     value = new StringValue();
   } else if (Content.ConstrainedValue.VariableHasType<DateTime>(columnIndex)) {
     value = new DateTimeValue();
   } else {
     throw new ArgumentException("unsupported type");
   }
   return value;
 }
Пример #10
0
 protected PathValue(PathValue original, Cloner cloner)
     : base(original, cloner)
 {
     stringValue = cloner.Clone(original.stringValue);
 }
Пример #11
0
 protected StringValue(StringValue original, Cloner cloner)
     : base(original, cloner)
 {
     this.value    = original.value != null ? original.value : string.Empty;
     this.readOnly = original.readOnly;
 }
 public ICheckedItemList<StringValue> CreateVariableItemList(IEnumerable<string> checkedItems = null) {
   ICheckedItemList<StringValue> itemList = new CheckedItemList<StringValue>();
   foreach (string name in PreprocessingData.GetDoubleVariableNames()) {
     var n = new StringValue(name);
     itemList.Add(n, (checkedItems == null) ? true : checkedItems.Contains(name));
   }
   return new ReadOnlyCheckedItemList<StringValue>(itemList);
 }
    private void AddTypeSelectedForSimilarityTableEntry(StringValue[] typeSelectedForSimilarity) {
      if (!ResultCollection.ContainsKey(TypeSelectedForSimilarityParameterName)) {
        var newTable = new DataTable(TypeSelectedForSimilarityParameterName, "");
        newTable.VisualProperties.YAxisTitle = "Percentage";
        newTable.VisualProperties.YAxisMaximumAuto = false;

        ResultCollection.Add(new Result(TypeSelectedForSimilarityParameterName, newTable));
      }
      var table = ((DataTable)ResultCollection[TypeSelectedForSimilarityParameterName].Value);

      // all rows must have the same number of values so we can just take the first
      int numberOfValues = table.Rows.Select(r => r.Values.Count).DefaultIfEmpty().First();

      double count = typeSelectedForSimilarity.Count();
      var groupedValues = typeSelectedForSimilarity.Select(x => x.Value).GroupBy(x => x);
      foreach (var type in groupedValues) {
        if (!table.Rows.ContainsKey(type.Key)) {
          // initialize a new row for the symbol and pad with zeros
          DataRow row = new DataRow(type.Key, "", Enumerable.Repeat(0.0, numberOfValues));
          row.VisualProperties.StartIndexZero = true;
          table.Rows.Add(row);
        }
        table.Rows[type.Key].Values.Add(type.Count() / count * 100);
      }

      // add a zero for each data row that was not modified in the previous loop 
      foreach (var row in table.Rows.Where(r => r.Values.Count != numberOfValues + 1))
        row.Values.Add(0.0);
    }