Closed MBSMGW closed 3 years ago
@MBSMGW a stack size of 1 with skip_connections should definitely work! By default the stack_size is 1. Try to use the TCN object instead of using compiled_tcn.
Here is an example that works with compiled_tcn (your case): https://github.com/philipperemy/keras-tcn/blob/1b2c1a6baaefc4a4fac88a74868a23845fb81495/tasks/copy_memory/main.py#L23
@MBSMGW a stack size of 1 with skip_connections should definitely work! By default the stack_size is 1. Try to use the TCN object instead of using compiled_tcn.
Here is an example that works with compiled_tcn (your case):
Yeah great suggestion, really should have embraced it at the start of thesis instead of trying to wrangle the compiled_tcn function (Which is great, especially starting..)
Thanks!
When using a stack size of 1, is there an issue with also using skip connections? It just throws an error. I am not sure if it needs to be a bug report or a feature request for automatically deffering to no skip connections for a stack size of 1? anyway, here is the code to reproduce the error:
`def model_create(nb_filters, kernel_size, dropout_rate, lr, dilation):
model_grid = KerasClassifier(build_fn=model_create, epochs=15, verbose=0)
search_space['nb_filters'] = 12, 14, 16, 18, 20 search_space['kernel_size'] = 3, 5, 16, 64, 128 search_space['dropout_rate'] = 0.01, 0.03, 0.05, 0.10, 0.15 search_space['lr'] = 0.001, 0.005, 0.010, 0.015 search_space['dilation'] = 1, 3, 7, 9
param_grid = dict(nb_filters = search_space['nb_filters'], kernel_size = search_space['kernel_size'], dropout_rate = search_space['dropout_rate'], lr = search_space['lr'], dilation = search_space['dilation'])
cv = RepeatedStratifiedKFold(n_splits=5, n_repeats=2, random_state=1) search = HalvingGridSearchCV(estimator = model_grid, param_grid = search_space,n_jobs=1, min_resources="exhaust", factor=3, cv = cv)
result = search.fit(xy_t[0][0], xy_t[0][1], batch_size=512)`
my data is 2400 sequence points long univariate time sequences of vibration data. and the following is the error received when running:
`/usr/local/share/anaconda3/lib/python3.7/site-packages/sklearn/model_selection/_validation.py:614: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: Traceback (most recent call last): File "/usr/local/share/anaconda3/lib/python3.7/site-packages/sklearn/model_selection/_validation.py", line 593, in _fit_and_score estimator.fit(X_train, y_train, fit_params) File "/usr/local/share/anaconda3/lib/python3.7/site-packages/tensorflow/python/keras/wrappers/scikit_learn.py", line 223, in fit return super(KerasClassifier, self).fit(x, y, kwargs) File "/usr/local/share/anaconda3/lib/python3.7/site-packages/tensorflow/python/keras/wrappers/scikit_learn.py", line 157, in fit self.model = self.build_fn(*self.filter_sk_params(self.build_fn)) File "", line 27, in model_create
use_weight_norm=use_weight_norm)
File "/home/ubuntu/tcn_ed.py", line 422, in compiled_tcn
use_weight_norm, name=name)(input_layer)
File "/usr/local/share/anaconda3/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py", line 926, in call
input_list)
File "/usr/local/share/anaconda3/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py", line 1117, in _functional_construction_call
outputs = call_fn(cast_inputs, args, **kwargs)
File "/usr/local/share/anaconda3/lib/python3.7/site-packages/tensorflow/python/autograph/impl/api.py", line 258, in wrapper
raise e.ag_error_metadata.to_exception(e)
ValueError: in user code: