[10157] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
[16565] | 3 | * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
[10157] | 4 | *
|
---|
| 5 | * This file is part of HeuristicLab.
|
---|
| 6 | *
|
---|
| 7 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
| 8 | * it under the terms of the GNU General Public License as published by
|
---|
| 9 | * the Free Software Foundation, either version 3 of the License, or
|
---|
| 10 | * (at your option) any later version.
|
---|
| 11 | *
|
---|
| 12 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 15 | * GNU General Public License for more details.
|
---|
| 16 | *
|
---|
| 17 | * You should have received a copy of the GNU General Public License
|
---|
| 18 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
| 19 | */
|
---|
| 20 | #endregion
|
---|
| 21 |
|
---|
[10367] | 22 | using System;
|
---|
[10157] | 23 | using System.Collections.Generic;
|
---|
| 24 | using HeuristicLab.Core;
|
---|
[10220] | 25 | using HeuristicLab.Data;
|
---|
[10163] | 26 | using HeuristicLab.Problems.DataAnalysis;
|
---|
[16565] | 27 | using HEAL.Attic;
|
---|
[10157] | 28 |
|
---|
[10182] | 29 | namespace HeuristicLab.DataPreprocessing {
|
---|
[16565] | 30 | [StorableType("1fd88253-ae07-415f-81df-5b73c61fd495")]
|
---|
[10157] | 31 | public interface IPreprocessingData : INamedItem {
|
---|
[15518] | 32 | #region Cells
|
---|
| 33 | bool IsCellEmpty(int columnIndex, int rowIndex);
|
---|
[10367] | 34 | T GetCell<T>(int columnIndex, int rowIndex);
|
---|
[10157] | 35 |
|
---|
[10367] | 36 | void SetCell<T>(int columnIndex, int rowIndex, T value);
|
---|
| 37 |
|
---|
| 38 | string GetCellAsString(int columnIndex, int rowIndex);
|
---|
| 39 |
|
---|
[10811] | 40 | IList<T> GetValues<T>(int columnIndex, bool considerSelection = false);
|
---|
[10367] | 41 |
|
---|
| 42 | void SetValues<T>(int columnIndex, IList<T> values);
|
---|
[11002] | 43 | bool SetValue(string value, int columnIndex, int rowIndex);
|
---|
[10181] | 44 |
|
---|
[15518] | 45 | int Columns { get; }
|
---|
| 46 | int Rows { get; }
|
---|
| 47 | #endregion
|
---|
| 48 |
|
---|
| 49 | #region Rows
|
---|
[10157] | 50 | void InsertRow(int rowIndex);
|
---|
| 51 | void DeleteRow(int rowIndex);
|
---|
[11002] | 52 | void DeleteRowsWithIndices(IEnumerable<int> rows);
|
---|
[10194] | 53 | void InsertColumn<T>(string variableName, int columnIndex);
|
---|
[10367] | 54 |
|
---|
| 55 | void DeleteColumn(int columnIndex);
|
---|
[10157] | 56 |
|
---|
[13252] | 57 | void RenameColumn(int columnIndex, string name);
|
---|
| 58 | void RenameColumns(IList<string> names);
|
---|
| 59 |
|
---|
[11002] | 60 | bool AreAllStringColumns(IEnumerable<int> columnIndices);
|
---|
[15518] | 61 | #endregion
|
---|
[11068] | 62 |
|
---|
[15518] | 63 | #region Variables
|
---|
[10243] | 64 | IEnumerable<string> VariableNames { get; }
|
---|
[10992] | 65 | IEnumerable<string> GetDoubleVariableNames();
|
---|
[10243] | 66 | string GetVariableName(int columnIndex);
|
---|
[10367] | 67 | int GetColumnIndex(string variableName);
|
---|
| 68 |
|
---|
[11156] | 69 | bool VariableHasType<T>(int columnIndex);
|
---|
[15518] | 70 | Type GetVariableType(int columnIndex);
|
---|
[10159] | 71 |
|
---|
[14381] | 72 | IList<string> InputVariables { get; }
|
---|
| 73 | string TargetVariable { get; } // optional
|
---|
[15518] | 74 | #endregion
|
---|
[14381] | 75 |
|
---|
[15518] | 76 | #region Partitions
|
---|
| 77 | IntRange TrainingPartition { get; }
|
---|
| 78 | IntRange TestPartition { get; }
|
---|
| 79 | #endregion
|
---|
[10163] | 80 |
|
---|
[15518] | 81 | #region Transformations
|
---|
| 82 | IList<ITransformation> Transformations { get; }
|
---|
| 83 | #endregion
|
---|
| 84 |
|
---|
| 85 | #region Validation
|
---|
| 86 | bool Validate(string value, out string errorMessage, int columnIndex);
|
---|
| 87 | #endregion
|
---|
| 88 |
|
---|
| 89 | #region Import & Export
|
---|
| 90 | void Import(IDataAnalysisProblemData problemData);
|
---|
[10220] | 91 | Dataset ExportToDataset();
|
---|
[15518] | 92 | #endregion
|
---|
[10804] | 93 |
|
---|
[15518] | 94 | #region Selection
|
---|
[10978] | 95 | IDictionary<int, IList<int>> Selection { get; set; }
|
---|
[10804] | 96 | void ClearSelection();
|
---|
| 97 |
|
---|
| 98 | event EventHandler SelectionChanged;
|
---|
[15518] | 99 | #endregion
|
---|
| 100 |
|
---|
| 101 | #region Transactions
|
---|
| 102 | event DataPreprocessingChangedEventHandler Changed;
|
---|
| 103 |
|
---|
| 104 | bool IsUndoAvailable { get; }
|
---|
| 105 | void Undo();
|
---|
| 106 | void InTransaction(Action action, DataPreprocessingChangedEventType type = DataPreprocessingChangedEventType.Any);
|
---|
| 107 | void BeginTransaction(DataPreprocessingChangedEventType type);
|
---|
| 108 | void EndTransaction();
|
---|
| 109 | #endregion
|
---|
| 110 |
|
---|
| 111 | #region Statistics
|
---|
| 112 | T GetMin<T>(int columnIndex, bool considerSelection = false, T emptyValue = default(T));
|
---|
| 113 | T GetMax<T>(int columnIndex, bool considerSelection = false, T emptyValue = default(T));
|
---|
| 114 | T GetMean<T>(int columnIndex, bool considerSelection = false, T emptyValue = default(T));
|
---|
| 115 | T GetMedian<T>(int columnIndex, bool considerSelection = false, T emptyValue = default(T)) where T : IComparable<T>;
|
---|
| 116 | T GetMode<T>(int columnIndex, bool considerSelection = false, T emptyValue = default(T)) where T : IEquatable<T>;
|
---|
| 117 | T GetStandardDeviation<T>(int columnIndex, bool considerSelection = false, T emptyValue = default(T));
|
---|
| 118 | T GetVariance<T>(int columnIndex, bool considerSelection = false, T emptyValue = default(T));
|
---|
| 119 | T GetQuantile<T>(double alpha, int columnIndex, bool considerSelection = false, T emptyValue = default(T)) where T : IComparable<T>;
|
---|
| 120 | int GetDistinctValues<T>(int columnIndex, bool considerSelection = false);
|
---|
| 121 |
|
---|
| 122 | int GetMissingValueCount();
|
---|
| 123 | int GetMissingValueCount(int columnIndex);
|
---|
| 124 | int GetRowMissingValueCount(int rowIndex);
|
---|
| 125 | #endregion
|
---|
[10157] | 126 | }
|
---|
| 127 | }
|
---|