Ejemplo n.º 1
0
 def test_minmax(self):
     data = [[-1, 2], [-0.5, 6], [0, 10], [1, 18]]
     standard = Scaler(scheme='minmax')
     self.assertEqual(
         standard.fit_transform(data).tolist(),
         np.array([[0., 0.], [0.25, 0.25], [0.5, 0.5], [1., 1.]]).tolist())
     self.assertEqual(
         standard.transform([[2, 2]]).tolist(),
         np.array([[1.5, 0.]]).tolist())
Ejemplo n.º 2
0
 def test_standard(self):
     data = np.array([[0, 0], [0, 0], [1, 1], [1, 1]])
     standard = Scaler(scheme='standard')
     self.assertEqual(
         standard.fit_transform(data).tolist(),
         np.array([[-1., -1.], [-1., -1.], [1., 1.], [1., 1.]]).tolist())
     self.assertEqual(
         standard.transform([[2, 2]]).tolist(),
         np.array([[3., 3.]]).tolist())
Ejemplo n.º 3
0
# Creating a Neural Networks Model
model = Sequential()
model.add(Dense(28, input_shape=(X.shape[1], ), activation='relu'))
model.add(Dense(256, activation='relu'))
model.add(Dropout(0.25))
model.add(Dense(1024, activation='relu'))
model.add(Dropout(0.5))
model.add(Dense(2048, activation='relu'))
model.add(Dense(10, activation='softmax'))

# Compiling Neural Networks Model
model.compile(loss='categorical_crossentropy',
              optimizer="adam",
              metrics=["acc"])

X_trainMatrix = scaler.transform(X)
results = model.fit(X_trainMatrix, y_categorical, epochs=20, batch_size=128)

plt.title('Loss')
plt.plot(results.history['loss'])
plt.show()

plt.title('Accuracy')
plt.plot(results.history['acc'])
plt.show()

classic_data = pd.read_csv('Dataset/classical.csv')

print(classic_data.groupby('genre').size())

X_classic = classic_data.ix[:, 'tempo':]