1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
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 |
|
---|
22 | using System;
|
---|
23 | using System.Collections.Generic;
|
---|
24 | using HeuristicLab.Core;
|
---|
25 | using HeuristicLab.Data;
|
---|
26 | using HeuristicLab.Problems.DataAnalysis;
|
---|
27 | using HEAL.Attic;
|
---|
28 |
|
---|
29 | namespace HeuristicLab.DataPreprocessing {
|
---|
30 | [StorableType("1fd88253-ae07-415f-81df-5b73c61fd495")]
|
---|
31 | public interface IPreprocessingData : INamedItem {
|
---|
32 | #region Cells
|
---|
33 | bool IsCellEmpty(int columnIndex, int rowIndex);
|
---|
34 | T GetCell<T>(int columnIndex, int rowIndex);
|
---|
35 |
|
---|
36 | void SetCell<T>(int columnIndex, int rowIndex, T value);
|
---|
37 |
|
---|
38 | string GetCellAsString(int columnIndex, int rowIndex);
|
---|
39 |
|
---|
40 | IList<T> GetValues<T>(int columnIndex, bool considerSelection = false);
|
---|
41 |
|
---|
42 | void SetValues<T>(int columnIndex, IList<T> values);
|
---|
43 | bool SetValue(string value, int columnIndex, int rowIndex);
|
---|
44 |
|
---|
45 | int Columns { get; }
|
---|
46 | int Rows { get; }
|
---|
47 | #endregion
|
---|
48 |
|
---|
49 | #region Rows
|
---|
50 | void InsertRow(int rowIndex);
|
---|
51 | void DeleteRow(int rowIndex);
|
---|
52 | void DeleteRowsWithIndices(IEnumerable<int> rows);
|
---|
53 | void InsertColumn<T>(string variableName, int columnIndex);
|
---|
54 |
|
---|
55 | void DeleteColumn(int columnIndex);
|
---|
56 |
|
---|
57 | void RenameColumn(int columnIndex, string name);
|
---|
58 | void RenameColumns(IList<string> names);
|
---|
59 |
|
---|
60 | bool AreAllStringColumns(IEnumerable<int> columnIndices);
|
---|
61 | #endregion
|
---|
62 |
|
---|
63 | #region Variables
|
---|
64 | IEnumerable<string> VariableNames { get; }
|
---|
65 | IEnumerable<string> GetDoubleVariableNames();
|
---|
66 | string GetVariableName(int columnIndex);
|
---|
67 | int GetColumnIndex(string variableName);
|
---|
68 |
|
---|
69 | bool VariableHasType<T>(int columnIndex);
|
---|
70 | Type GetVariableType(int columnIndex);
|
---|
71 |
|
---|
72 | IList<string> InputVariables { get; }
|
---|
73 | string TargetVariable { get; } // optional
|
---|
74 | #endregion
|
---|
75 |
|
---|
76 | #region Partitions
|
---|
77 | IntRange TrainingPartition { get; }
|
---|
78 | IntRange TestPartition { get; }
|
---|
79 | #endregion
|
---|
80 |
|
---|
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);
|
---|
91 | Dataset ExportToDataset();
|
---|
92 | #endregion
|
---|
93 |
|
---|
94 | #region Selection
|
---|
95 | IDictionary<int, IList<int>> Selection { get; set; }
|
---|
96 | void ClearSelection();
|
---|
97 |
|
---|
98 | event EventHandler SelectionChanged;
|
---|
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
|
---|
126 | }
|
---|
127 | }
|
---|