我收到了一个AssertionError:
形状沿轴0不匹配:(107,13); (0,535)
运行以下代码进行分类。
n_samples = 535,n_features = 13,n_classes = 7
非常感谢任何帮助。
import theanets
from sklearn.metrics import confusion_matrix
import scipy.io
import numpy
X = scipy.io.loadmat('berlinFeaturesCAFE.mat')
X_F = X['featureContainer'];
X_F_A = numpy.require(X_F, dtype=numpy.float32, requirements=None)
y = scipy.io.loadmat('convertLabel.mat')
y_F = y['xdNew']
cut = int(len(X_F_A) * 0.8) # training / validation split
train = X_F_A[:cut], y_F[:cut]
valid = X_F_A[cut:], y_F[cut:]
net = theanets.Classifier([13, 7])
# Train the model using SGD with momentum.
net.train(train, valid, algo='sgd', learning_rate=1e-4, momentum=0.9)
# Show confusion matrices on the training/validation splits.
for label, (X, y) in (('training:', train), ('validation:', valid)):
print(label)
print(confusion_matrix(y, net.predict(X)))