I'm working on a project that involves having to work with preprocessed data in the following form.
Data explanation has been given above too. The goal is to predict whether a written digit matches the audio of said digit or not. First I transform the spoken arrays of form (N,13) to the means over the time axis as such:
This creates a consistent length of (1,13) for every array within spoken. In order to test this in a simple vanilla algorithm I zip the two arrays together such that we create an array of the form (45000, 2), when I insert this into the fit function of the LogisticRegression class it throws me the following error:
What am I doing wrong?
Code:
import numpy as np
from sklearn.linear_model import LogisticRegression
match = np.load("/srv/digits/match_train.npy")
spoken = np.load("/srv/digits/spoken_train.npy")
written = np.load("/srv/digits/written_train.npy")
print(match.shape, spoken.shape, written.shape)
print(spoken[0].shape, spoken[1].shape)
def features(signal, function):
new = np.copy(signal)
for i in range(len(signal)):
new[i] = function(new[i], axis=0)
return new
spokenMean = features(spoken, np.mean)
print(spokenMean.shape, spokenMean[0])
result = np.array(list(zip(spokenMean,written)))
print(result.shape)
X_train, X_val, y_train, y_val = train_test_split(result, match, test_size =
0.33, random_state = 123)
model = LogisticRegression()
print(X_train.shape, y_train.shape)
model.fit(X_train, y_train)
yh_val = model.predict(X_val)