Commit 4c3ab957 authored by Peter Shevchenko's avatar Peter Shevchenko
Browse files

add feature_names, feature_types & categorical_features_map to Data class

No related merge requests found
Showing with 13 additions and 0 deletions
+13 -0
......@@ -4,6 +4,7 @@ import glob
import os
from copy import copy, deepcopy
from dataclasses import dataclass, field
from enum import Enum
from typing import List, Optional, Tuple, Union, Iterable, Any
import numpy as np
......@@ -33,6 +34,12 @@ POSSIBLE_TS_IDX_KEYWORDS = ['datetime', 'date', 'time', 'unnamed: 0']
PathType = Union[os.PathLike, str]
class FeatureType(Enum):
numerical = 'numerical'
categorical = 'categorical'
other = 'other'
@dataclass
class Data:
"""
......@@ -44,6 +51,8 @@ class Data:
data_type: DataTypesEnum
features: np.ndarray
target: Optional[np.ndarray] = None
feature_names: Optional[List[str]] = None
feature_types: Optional[List[FeatureType]] = None
# Object with supplementary info
supplementary_data: SupplementaryData = field(default_factory=SupplementaryData)
......@@ -373,6 +382,10 @@ class Data:
dataframe['target'] = self.target
dataframe.to_csv(path_to_save)
@property
def categorical_features_map(self) -> List[bool]:
return [feature_type is FeatureType.categorical for feature_type in self.feature_types]
@dataclass
class InputData(Data):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment