Skip to content

Commit

Permalink
without parallelization
Browse files Browse the repository at this point in the history
  • Loading branch information
mufwan authored and fzoepffel committed Feb 20, 2024
1 parent b3d52ee commit 711b766
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions scripts/keywordSpotting.dml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ y_shuffled = Xy_shuffled[,num_col] # Labels, the last column
[X_train, X_test, y_train, y_test] = split(X=X_shuffled, Y=y_shuffled, seed= 13)

# Preprocess with fft Optionally move before split.
[X_train_re, X_train_im] = stft(X_train, 256, 128)
[X_test_re, X_test_im] = stft(X_test, 256, 128)
[X_train_re, X_train_im] = stft(X_train, 4, 2)
[X_test_re, X_test_im] = stft(X_test, 4, 2)


X_train_re_sq = X_train_re^2
Expand All @@ -38,15 +38,15 @@ magnitudes_test = sqrt(sum_X_test_sq)
bias = lm(X=magnitudes_train, y=y_train, reg=1e-1, maxi=10, verbose=TRUE)
predictions = lmPredict(X=magnitudes_test, B=bias, verbose=FALSE)

sign_predictions = sign(predictions)
sign_Y = sign(y_test)
#sign_predictions = sign(predictions)
#sign_Y = sign(y_test)

correct = sum(sign_predictions == sign_Y)
total = nrow(y_test)
accuracy = correct / total
#correct = sum(sign_predictions == sign_Y)
#total = nrow(y_test)
#accuracy = correct / total

#print(toString(predictions))
print(toString(accuracy))
#print(toString(accuracy))

R = lmPredictStats(yhat=predictions, ytest=y_test, lm=TRUE)
print(toString(R))
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public static MatrixBlock[] stft(MatrixBlock re, MatrixBlock im, int windowSize,
double[] re_inter = new double[out_len];
double[] im_inter = new double[out_len];

ExecutorService pool = CommonThreadPool.get(1);
//ExecutorService pool = CommonThreadPool.get(1);

final ExecutorService pool = CommonThreadPool.get(threads);

Expand Down

0 comments on commit 711b766

Please sign in to comment.