-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added: unit-test and integration, docstrings, init input_data method
cleaned up TimeSeriesClassifier_Preset
- Loading branch information
1 parent
b6545a5
commit 0912891
Showing
18 changed files
with
450 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import numpy as np | ||
import pandas as pd | ||
from fedot.core.data.data import InputData | ||
from fedot.core.repository.dataset_types import DataTypesEnum | ||
from fedot.core.repository.tasks import Task, TaskTypesEnum | ||
|
||
|
||
def init_input_data(X: pd.DataFrame, y: np.ndarray) -> InputData: | ||
"""Method for initialization of InputData object from pandas DataFrame and numpy array with target values. | ||
Args: | ||
X: pandas DataFrame with features | ||
y: numpy array with target values | ||
Returns: | ||
InputData object convenient for FEDOT framework | ||
""" | ||
is_multivariate_data = True if isinstance(X.iloc[0, 0], pd.Series) else False | ||
if is_multivariate_data: | ||
input_data = InputData(idx=np.arange(len(X)), | ||
features=np.array(X.values.tolist()), | ||
target=y.reshape(-1, 1), | ||
task=Task(TaskTypesEnum.classification), | ||
data_type=DataTypesEnum.image) | ||
else: | ||
input_data = InputData(idx=np.arange(len(X)), | ||
features=X.values, | ||
target=np.ravel(y).reshape(-1, 1), | ||
task=Task(TaskTypesEnum.classification), | ||
data_type=DataTypesEnum.table) | ||
|
||
return input_data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.