features.py 536 B

1234567891011121314151617181920212223242526
  1. # main imports
  2. import numpy as np
  3. import sys
  4. # config and modules imports
  5. sys.path.insert(0, '') # trick to enable import of main folder module
  6. import custom_config as cfg
  7. def compute_feature(feature_choice, samples):
  8. data = []
  9. if feature_choice == 'samples':
  10. data = samples
  11. if feature_choice == 'variances':
  12. incr_samples = []
  13. # evolution of variance
  14. for sample in samples:
  15. incr_samples.append(sample)
  16. data.append(np.var(incr_samples))
  17. return data