Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant get it to work with custom dataset (Timeseries) #1

Open
Slayingripper opened this issue Nov 1, 2022 · 0 comments
Open

Cant get it to work with custom dataset (Timeseries) #1

Slayingripper opened this issue Nov 1, 2022 · 0 comments

Comments

@Slayingripper
Copy link

I've been trying to implement my own dataset, but keep running into issues when using everwhereml.
I've implemented a decision tree approach using normal SKLearn and works fine.

Example using Standard Sklearn

data=pd.read_csv(config.get('Datasets', 'Minime'), delimiter=',')

# use Decision tree to classify Minime  if it is good or bad
#drop first row
data = data[['Time', 'Flag']]
data['Time'] = data['Time'].str.replace(':', '')
data['Time'] = data['Time'].str.replace('.', '')

X = data.drop('Flag', axis=1)
y = data['Flag']

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.20)
classifier = DecisionTreeClassifier()
classifier.fit(X_train, y_train)


Example using everywhereml SKlearn

data=pd.read_csv(config.get('Datasets', 'Minime'), delimiter=',')

data = data[['Time', 'Flag']]
data['Time'] = data['Time'].str.replace(':', '')
data['Time'] = data['Time'].str.replace('.', '')
X = data.drop('Flag', axis=1)
y = data['Flag']
#X, y = make_blobs(n_samples=100, centers=3, n_features=2, random_state=0)

clf = DecisionTreeClassifier()

clf.fit(X, y)

Gives out this error in python3.9

Traceback (most recent call last):
  File "/home/vasilisieropoulos/gitstuff/IoT-Ai/Machine Learning/thefinish.py", line 32, in <module>
    clf.fit(X, y)
  File "/home/vasilisieropoulos/anaconda3/lib/python3.9/site-packages/everywhereml/sklearn/SklearnBaseClassifier.py", line 95, in fit
    self.dataset = Dataset.from_XY(X, y)
  File "/home/vasilisieropoulos/anaconda3/lib/python3.9/site-packages/everywhereml/data/Dataset.py", line 39, in from_XY
    return Dataset(
  File "/home/vasilisieropoulos/anaconda3/lib/python3.9/site-packages/everywhereml/data/Dataset.py", line 124, in __init__
    self.replace(X=X, y=y, feature_names=feature_names, target_names=target_names)
  File "/home/vasilisieropoulos/anaconda3/lib/python3.9/site-packages/everywhereml/data/Dataset.py", line 195, in replace
    self._update_df()
  File "/home/vasilisieropoulos/anaconda3/lib/python3.9/site-packages/everywhereml/data/Dataset.py", line 285, in _update_df
    data = np.hstack((self.X, self.y.reshape((-1, 1))))
  File "/home/vasilisieropoulos/anaconda3/lib/python3.9/site-packages/pandas/core/generic.py", line 5575, in __getattr__
    return object.__getattribute__(self, name)
AttributeError: 'Series' object has no attribute 'reshape'

Is this due to the python version or something else ? I can't get this to work in python3.10 since the Iterable abstract class was removed from collections in Python 3.10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant