diff --git a/krishnamathur00@gmail.com/Project/krishna submission b/krishnamathur00@gmail.com/Project/krishna submission new file mode 100644 index 000000000..e69de29bb diff --git a/krishnamathur00@gmail.com/Project/krishna submission:Comparing performance of three different clustering algorithms on IRIS Dataset b/krishnamathur00@gmail.com/Project/krishna submission:Comparing performance of three different clustering algorithms on IRIS Dataset deleted file mode 100644 index 8b1378917..000000000 --- a/krishnamathur00@gmail.com/Project/krishna submission:Comparing performance of three different clustering algorithms on IRIS Dataset +++ /dev/null @@ -1 +0,0 @@ - diff --git a/sainitushar18899@gmail.com/Project/Tushar submission b/sainitushar18899@gmail.com/Project/Tushar submission new file mode 100644 index 000000000..e69de29bb diff --git a/sainitushar18899@gmail.com/Project/Tushar submission: Comparing SVM with 3 layer Neural Network on Titanic Dataset b/sainitushar18899@gmail.com/Project/Tushar submission: Comparing SVM with 3 layer Neural Network on Titanic Dataset deleted file mode 100644 index ea87e0afd..000000000 --- a/sainitushar18899@gmail.com/Project/Tushar submission: Comparing SVM with 3 layer Neural Network on Titanic Dataset +++ /dev/null @@ -1 +0,0 @@ -Tushar submission: Comparing SVM with 3 layer Neural Network on Titanic Dataset diff --git a/sanjushekhawt57@gmail.com/report.pdf b/sanjushekhawt57@gmail.com/report.pdf new file mode 100644 index 000000000..82290edf2 Binary files /dev/null and b/sanjushekhawt57@gmail.com/report.pdf differ diff --git a/sanjushekhawt57@gmail.com/sanju_cnn.ipynb b/sanjushekhawt57@gmail.com/sanju_cnn.ipynb new file mode 100644 index 000000000..2ec4ee4e3 --- /dev/null +++ b/sanjushekhawt57@gmail.com/sanju_cnn.ipynb @@ -0,0 +1,153 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import tensorflow\n", + "import tensorflow.keras\n", + "from tensorflow.keras.models import Sequential\n", + "from tensorflow.keras.layers import Convolution2D\n", + "from tensorflow.keras.layers import MaxPooling2D\n", + "from tensorflow.keras.layers import Flatten\n", + "from tensorflow.keras.layers import Dense\n", + "from tensorflow.keras.layers import Reshape\n", + "\n", + "classifier = Sequential()\n", + "\n", + "classifier.add(Convolution2D(32,(3,3),input_shape=(64,64,3),activation='relu'))\n", + "classifier.add(MaxPooling2D(pool_size=(2,2)))\n", + "\n", + "classifier.add(Convolution2D(32,(3,3),input_shape=(64,64,3),activation='relu'))\n", + "classifier.add(MaxPooling2D(pool_size=(2,2)))\n", + "\n", + "classifier.add(Convolution2D(32,(3,3),input_shape=(64,64,3),activation='relu'))\n", + "classifier.add(MaxPooling2D(pool_size=(2,2)))\n", + "\n", + "\n", + "classifier.add(Convolution2D(32,(3,3),input_shape=(64,64,3),activation='relu'))\n", + "classifier.add(MaxPooling2D(pool_size=(2,2)))\n", + "\n", + "\n", + "classifier.add(Flatten())\n", + "classifier.add(Dense(units=128,activation='relu'))\n", + "classifier.add(Dense(units=1,activation='sigmoid'))\n", + "classifier.compile(optimizer='adam',loss='binary_crossentropy',metrics=['accuracy'])\n", + "\n", + "print(classifier.summary())\n", + "\n", + "from tensorflow.keras.preprocessing.image import ImageDataGenerator\n", + "\n", + "train_datagen=ImageDataGenerator(rescale=1/1.255,shear_range=0.2,zoom_range=0.2,horizontal_flip=True)\n", + "test_datagen = ImageDataGenerator(rescale=1./255)\n", + "training_set = train_datagen.flow_from_directory(\n", + " 'C:/Users/rishi/OneDrive/Desktop/chest_xray/chest_xray/train',\n", + " target_size=(64, 64),\n", + " batch_size=32,\n", + " class_mode='binary')\n", + "\n", + "test_set = train_datagen.flow_from_directory(\n", + " 'C:/Users/rishi/OneDrive/Desktop/chest_xray/chest_xray/test',\n", + " target_size=(64, 64),\n", + " batch_size=32,\n", + " class_mode='binary')\n", + "\n", + "val_set = train_datagen.flow_from_directory(\n", + " 'C:/Users/rishi/OneDrive/Desktop/chest_xray/chest_xray/val',\n", + " target_size=(64, 64),\n", + " batch_size=32,\n", + " class_mode='binary')\n", + "\n", + "cl=classifier.fit_generator(\n", + " training_set,\n", + " steps_per_epoch=163,\n", + " epochs=10,\n", + " validation_data=test_set,\n", + " validation_steps=624/32)\n", + " \n", + "\n", + "from sklearn.metrics import classification_report, confusion_matrix\n", + "\n", + "\n", + "\n", + "\n", + "labels = test_set.class_indices\n", + "\n", + "labels = {v: k for k, v in labels.items()}\n", + "\n", + "classes = list(labels.values())\n", + "\n", + "y_pred = classifier.predict(test_set)\n", + "\n", + "y_pred =(y_pred>0.5)\n", + "\n", + "print(confusion_matrix(test_set.classes, y_pred))\n", + "\n", + "print(classification_report(test_set.classes, y_pred, target_names=classes))\n", + "print(labels)\n", + "\n", + "\n", + "test_accuracy=classifier.evaluate_generator(test_set,624)\n", + "print(\"Test accuracy:\",test_accuracy[1]*100,'%')\n", + "\n", + "\n", + "from sklearn.metrics import accuracy_score\n", + "print(accuracy_score(test_set.classes, y_pred))\n", + "\n", + "from sklearn.metrics import recall_score\n", + "recall_score(test_set.classes, y_pred)\n", + "\n", + "from sklearn.metrics import precision_score\n", + "precision_score(test_set.classes, y_pred)\n", + "\n", + "from sklearn.metrics import f1_score\n", + "f1_score(test_set.classes, y_pred)\n", + "\n", + "\n", + "\n", + "\n", + "import matplotlib.pyplot as plt\n", + "\n", + "plt.plot(cl.history['acc'])\n", + "plt.plot(cl.history['val_acc'])\n", + "plt.title('Model Accuracy')\n", + "plt.ylabel('Accuracy')\n", + "plt.xlabel('Epoch')\n", + "plt.legend(['training_set', 'test_set'], loc='upper left')\n", + "plt.show()\n", + "\n", + "#Loss\n", + "plt.plot(cl.history['loss'])\n", + "plt.plot(cl.history['val_loss'])\n", + "plt.title('Loss')\n", + "plt.ylabel('Loss')\n", + "plt.xlabel('Epoch')\n", + "plt.legend(['training_set', 'test_set'], loc='upper left')\n", + "plt.show()\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.3" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}