Created
November 20, 2017 11:15
-
-
Save fedden/9f259ea301724379ffb8cf628b4067ed to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
# Create some random MFCC shaped features as a sequence of 10 values | |
feature_sequence = np.random.random((10, 13)) | |
# Get the standard deviation | |
stddev_features = np.std(feature_sequence, axis=0) | |
# Get the mean | |
mean_features = np.mean(feature_sequence, axis=0) | |
# Get the average difference of the features | |
average_difference_features = np.zeros((16,)) | |
for i in range(0, len(feature_sequence) - 2, 2): | |
average_difference_features += feature_sequence[i] - feature_sequence[i+1] | |
average_difference_features /= (len(feature_sequence) // 2) | |
average_difference_features = np.array(average_difference_features) | |
# Concatenate the features to a single feature vector | |
concat_features_features = np.hstack((stddev_features, mean_features)) | |
concat_features_features = np.hstack((concat_features_features, average_difference_features)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment