Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
ITMO-NSS-team
FEDOT
Commits
4c3ab957
Commit
4c3ab957
authored
1 year ago
by
Peter Shevchenko
Browse files
Options
Download
Email Patches
Plain Diff
add feature_names, feature_types & categorical_features_map to Data class
parent
a2da8405
1136-upgrade-input-data-class
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fedot/core/data/data.py
+13
-0
fedot/core/data/data.py
with
13 additions
and
0 deletions
+13
-0
fedot/core/data/data.py
View file @
4c3ab957
...
...
@@ -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
):
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help