TSFEL custom features #127
Unanswered
mkatgithub123
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I started using tsfel. My main goal is custom feature creation. I could not make this work. I want to use both the built-in features AND custom features in addition / jointly.
I tried:
1) "pip install tsfel"
Creating a custom feature json works with
and creates the desired, non-empty json:
This resulted in a custom feature json as intended based on the following custom feature
custom_features.py
file I provide the feature_path to:Calling tsfel by
runs through and then yields all the standard tsfel features, but not my custom p2p feature - I cannot retrieve my custom feature. There is no error message or warning.
2) Downloading the tsfel repository and run it via "pip install --editable ."
I tried this for debugging/to see where things get lost. There were several issues with this approach:
I use the same function calls as described in 1). To install the package, I had to first add
package_dir={"":"tsfel"}
to the setup.py file. Otherwise it would not install.Calling
tsfel.add_feature_json(features_path, json_path)
then surprisingly failed upon the complexity computationcompute_complexity
call inadd_personal_features.py
, line 102 . Tracing down the issue incompute_complexity
, I can see that my custom feature is accessed and computed with the wave function test signal incalculate_complexity.py
. There,compute_complexity
is executed and in line 124:calc_window_features(one_feat_dict, wave[: int(ti)], fs, features_path=features_path)
is called. This produces an error in `calc_features.py', line 470 that says "invalid index to scalar variable".
I can confirm that
eval_result = locals()[func_total](signal_window, **parameters_total)
in line 465 ofcalc_features.py
yields the proper output for my custom feature, a scalar with value "1" (i.e. the peak to peak value for a wave signal with unit amplitude). In line 470 that scalar then is indexed vialen(eval_result[ax].shape)
and naturally, that scalar value of "1" cannot be indexed. If, instead of just returning the p2p value in my custom feature definition, I returnnp.array([p2p])
, I can circumvent that issue, but it seems unnatural to manipulate the return from my custom feature definition into this. Also, for the built-in features, this does not seem necessary either.However, from 1) I do have a valid json file that I can use as a workaround for the above error. Still, this behaviour is surprising, at least to me.
domain_feats = dict_features[_type].keys()
does not show my custom feature "p2p". In order to have it computed in the following feature computation loop, it should be included in domain_feats, if I understand the code correctly. Between lines 405 and 430, there is no code for integrating any custom features into "domain_feats" which I take as that custom features cannot be computed as of today.
Can you confirm this? If so, why is this not apparent from the docs?
Beta Was this translation helpful? Give feedback.
All reactions