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

ZeroDivisionError when apply pipeline in my data #374

Closed
pjgao opened this issue Mar 23, 2018 · 1 comment
Closed

ZeroDivisionError when apply pipeline in my data #374

pjgao opened this issue Mar 23, 2018 · 1 comment

Comments

@pjgao
Copy link

pjgao commented Mar 23, 2018

pipeline = Pipeline([('augmenter', RelevantFeatureAugmenter(column_id='serial_number', column_sort='date')),
            ('classifier', XGBClassifier())])


X_disk = pd.DataFrame(index=y_disk.index)
xtrain,xtest,ytrain,ytest = train_test_split(X_disk,y_disk,test_size=0.4)
pipeline.set_params(augmenter__timeseries_container=ts_disk)
pipeline.fit(xtrain, ytrain)
confusion_matrix(ytest,pipeline.predict(xtest))

Here is the error info:

ZeroDivisionError Traceback (most recent call last)
in ()
6 xtrain,xtest,ytrain,ytest = train_test_split(X_disk,y_disk,test_size=0.4)
7 pipeline.set_params(augmenter__timeseries_container=ts_disk)
----> 8 pipeline.fit(xtrain, ytrain)
9 confusion_matrix(ytest,pipeline.predict(xtest))

/anaconda3/lib/python3.6/site-packages/tsfresh/transformers/feature_augmenter.py in transform(self, X)
189 profile=self.profile,
190 profiling_filename=self.profiling_filename,
--> 191 profiling_sorting=self.profiling_sorting)
192
193 X = pd.merge(X, extracted_features, left_index=True, right_index=True, how="left")

~/anaconda3/lib/python3.6/site-packages/tsfresh/feature_extraction/extraction.py in extract_features(timeseries_container, default_fc_parameters, kind_to_fc_parameters, column_id, column_sort, column_kind, column_value, chunksize, n_jobs, show_warnings, disable_progressbar, impute_function, profile, profiling_filename, profiling_sorting, distributor)
150 default_fc_parameters=default_fc_parameters,
151 kind_to_fc_parameters=kind_to_fc_parameters,
--> 152 distributor=distributor)
153
154 # Impute the result if requested

~/anaconda3/lib/python3.6/site-packages/tsfresh/feature_extraction/extraction.py in _do_extraction(df, column_id, column_value, column_kind, default_fc_parameters, kind_to_fc_parameters, n_jobs, chunk_size, disable_progressbar, distributor)
231 kwargs = dict(default_fc_parameters=default_fc_parameters, kind_to_fc_parameters=kind_to_fc_parameters)
232 result = distributor.map_reduce(_do_extraction_on_chunk, data=data_in_chunks, chunk_size=chunk_size,
--> 233 function_kwargs=kwargs)
234 distributor.close()
235

~/anaconda3/lib/python3.6/site-packages/tsfresh/utilities/distribution.py in map_reduce(self, map_function, data, function_kwargs, chunk_size, data_length)
140
141 if hasattr(self, "progressbar_title"):
--> 142 total_number_of_expected_results = math.ceil(data_length / chunk_size)
143 result = tqdm(self.distribute(_function_with_partly_reduce, chunk_generator, map_kwargs),
144 total=total_number_of_expected_results,

ZeroDivisionError: division by zero

@MaxBenChrist
Copy link
Collaborator

This looks like your data has a lenght of 0, is the time series container empty?

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

2 participants