Skip to content

Commit

Permalink
Generate training and validation sets
Browse files Browse the repository at this point in the history
  • Loading branch information
AnanthVivekanand committed Oct 16, 2020
1 parent bd023cb commit 5743b6c
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion main.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,34 @@
"#featuresdf = pd.DataFrame(features, columns=['feature','class_label'])\n",
"#np.save('features.npy', features)\n",
"\n",
"print('Finished feature extraction from ', len(features), ' files')"
"print('Finished feature extraction from ', len(features), ' files')\n",
"\n",
"X = np.asarray(features)\n",
"y = np.asarray(labels)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"X = (features)\n",
"y = (labels)\n",
"\n",
"# Encode the classification labels\n",
"le = LabelEncoder()\n",
"yy = to_categorical(le.fit_transform(y)) \n",
"\n",
"# split the dataset \n",
"from sklearn.model_selection import train_test_split \n",
"\n",
"x_train, x_test, y_train, y_test = train_test_split(X, yy, test_size=0.2, random_state = 42)\n",
"\n",
"#x_train = x_train.reshape(x_train.shape[0], x_train[0].shape[0], x_train[0].shape[1], x_train[0].shape[2])\n",
"#x_test = x_test.reshape(x_test.shape[0], x_test[0].shape[0], x_test[0].shape[1], x_test[0].shape[2])\n",
"\n",
"#print(x_train[0].shape)"
]
}
],
Expand Down

0 comments on commit 5743b6c

Please sign in to comment.