Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2021-210
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2021-210
2021-210
Commits
875c95ef
Commit
875c95ef
authored
Sep 27, 2021
by
dinithi1997
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add the required accuracy graph to the research paper
parent
30f512e9
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
105 additions
and
1010 deletions
+105
-1010
disease_prediction/.gitignore
disease_prediction/.gitignore
+0
-1
disease_prediction/.idea/.gitignore
disease_prediction/.idea/.gitignore
+2
-0
disease_prediction/.idea/inspectionProfiles/profiles_settings.xml
...prediction/.idea/inspectionProfiles/profiles_settings.xml
+6
-0
disease_prediction/.idea/modules.xml
disease_prediction/.idea/modules.xml
+8
-0
disease_prediction/.idea/vcs.xml
disease_prediction/.idea/vcs.xml
+6
-0
disease_prediction/data.csv
disease_prediction/data.csv
+51
-1001
disease_prediction/disease_prediction_model.py
disease_prediction/disease_prediction_model.py
+28
-6
disease_prediction/model.h5
disease_prediction/model.h5
+0
-0
disease_prediction/neural network accuracy.png
disease_prediction/neural network accuracy.png
+0
-0
disease_prediction/neural network loss.png
disease_prediction/neural network loss.png
+0
-0
disease_prediction/predict_disease.py
disease_prediction/predict_disease.py
+4
-2
No files found.
disease_prediction/.gitignore
deleted
100644 → 0
View file @
30f512e9
.idea
\ No newline at end of file
disease_prediction/.idea/.gitignore
0 → 100644
View file @
875c95ef
# Default ignored files
/workspace.xml
disease_prediction/.idea/inspectionProfiles/profiles_settings.xml
0 → 100644
View file @
875c95ef
<component
name=
"InspectionProjectProfileManager"
>
<settings>
<option
name=
"USE_PROJECT_PROFILE"
value=
"false"
/>
<version
value=
"1.0"
/>
</settings>
</component>
\ No newline at end of file
disease_prediction/.idea/modules.xml
0 → 100644
View file @
875c95ef
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"ProjectModuleManager"
>
<modules>
<module
fileurl=
"file://$PROJECT_DIR$/.idea/disease_prediction.iml"
filepath=
"$PROJECT_DIR$/.idea/disease_prediction.iml"
/>
</modules>
</component>
</project>
\ No newline at end of file
disease_prediction/.idea/vcs.xml
0 → 100644
View file @
875c95ef
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"VcsDirectoryMappings"
>
<mapping
directory=
"$PROJECT_DIR$/.."
vcs=
"Git"
/>
</component>
</project>
\ No newline at end of file
disease_prediction/data.csv
View file @
875c95ef
This diff is collapsed.
Click to expand it.
disease_prediction/disease_prediction_model.py
View file @
875c95ef
...
@@ -2,6 +2,7 @@ import numpy
...
@@ -2,6 +2,7 @@ import numpy
import
pandas
as
pd
import
pandas
as
pd
import
tensorflow
as
tf
import
tensorflow
as
tf
from
sklearn.model_selection
import
train_test_split
from
sklearn.model_selection
import
train_test_split
import
matplotlib.pyplot
as
plt
model
=
tf
.
keras
.
models
.
Sequential
()
model
=
tf
.
keras
.
models
.
Sequential
()
...
@@ -9,28 +10,49 @@ def trainModel(model, datasetFilePath):
...
@@ -9,28 +10,49 @@ def trainModel(model, datasetFilePath):
model
.
add
(
tf
.
keras
.
layers
.
Flatten
())
model
.
add
(
tf
.
keras
.
layers
.
Flatten
())
model
.
add
(
tf
.
keras
.
layers
.
Dense
(
256
,
activation
=
tf
.
nn
.
relu
))
model
.
add
(
tf
.
keras
.
layers
.
Dense
(
256
,
activation
=
tf
.
nn
.
relu
))
model
.
add
(
tf
.
keras
.
layers
.
Dense
(
128
,
activation
=
tf
.
nn
.
relu
))
model
.
add
(
tf
.
keras
.
layers
.
Dense
(
128
,
activation
=
tf
.
nn
.
relu
))
model
.
add
(
tf
.
keras
.
layers
.
Dense
(
46
,
activation
=
tf
.
nn
.
softmax
))
model
.
add
(
tf
.
keras
.
layers
.
Dense
(
11
,
activation
=
tf
.
nn
.
softmax
))
model
.
compile
(
optimizer
=
'adam'
,
model
.
compile
(
optimizer
=
'adam'
,
loss
=
'sparse_categorical_crossentropy'
,
loss
=
'sparse_categorical_crossentropy'
,
metrics
=
[
'accuracy'
])
metrics
=
[
'accuracy'
])
model_df
=
pd
.
read_csv
(
datasetFilePath
)
model_df
=
pd
.
read_csv
(
datasetFilePath
)
X
=
model_df
.
values
[:,
0
:
15
]
print
(
model_df
.
shape
)
y
=
model_df
.
values
[:,
15
]
X
=
model_df
.
values
[:,
0
:
18
]
y
=
model_df
.
values
[:,
18
]
print
(
y
)
print
(
y
)
x_train
,
x_test
,
y_train
,
y_test
=
train_test_split
(
X
,
y
,
stratify
=
y
,
test_size
=
0.2
)
x_train
,
x_test
,
y_train
,
y_test
=
train_test_split
(
X
,
y
,
stratify
=
y
,
test_size
=
0.2
)
x_train
=
tf
.
keras
.
utils
.
normalize
(
x_train
,
axis
=
1
)
x_train
=
tf
.
keras
.
utils
.
normalize
(
x_train
,
axis
=
1
)
x_test
=
tf
.
keras
.
utils
.
normalize
(
x_test
,
axis
=
1
)
x_test
=
tf
.
keras
.
utils
.
normalize
(
x_test
,
axis
=
1
)
model
.
fit
(
x_train
,
y_train
,
epochs
=
3
)
history
=
model
.
fit
(
x_train
,
y_train
,
epochs
=
50
,
validation_data
=
(
x_test
,
y_test
)
)
val_loss
,
val_acc
=
model
.
evaluate
(
x_test
,
y_test
)
val_loss
,
val_acc
=
model
.
evaluate
(
x_test
,
y_test
)
print
(
val_loss
)
print
(
"Loss: "
,
val_loss
)
print
(
val_acc
)
print
(
"Accuracy: "
,
val_acc
*
100
,
"
%
"
)
model
.
save
(
'model.h5'
)
model
.
save
(
'model.h5'
)
print
(
history
.
history
)
# summarize history for accuracy
plt
.
plot
(
history
.
history
[
'acc'
])
plt
.
plot
(
history
.
history
[
'val_acc'
])
plt
.
title
(
'model accuracy'
)
plt
.
ylabel
(
'accuracy'
)
plt
.
xlabel
(
'epoch'
)
plt
.
legend
([
'train'
,
'test'
],
loc
=
'upper left'
)
plt
.
show
()
# summarize history for loss
plt
.
plot
(
history
.
history
[
'loss'
])
plt
.
plot
(
history
.
history
[
'val_loss'
])
plt
.
title
(
'model loss'
)
plt
.
ylabel
(
'loss'
)
plt
.
xlabel
(
'epoch'
)
plt
.
legend
([
'train'
,
'test'
],
loc
=
'upper left'
)
plt
.
show
()
return
model
return
model
def
predict
(
model
,
data
):
def
predict
(
model
,
data
):
return
model
.
predict
(
numpy
.
array
(
data
))
return
model
.
predict
(
numpy
.
array
(
data
))
trainModel
(
model
,
"data.csv"
)
trainModel
(
model
,
"data.csv"
)
disease_prediction/model.h5
0 → 100644
View file @
875c95ef
File added
disease_prediction/neural network accuracy.png
0 → 100644
View file @
875c95ef
29.2 KB
disease_prediction/neural network loss.png
0 → 100644
View file @
875c95ef
27.3 KB
disease_prediction/predict_disease.py
View file @
875c95ef
...
@@ -10,7 +10,7 @@ model = tf.keras.models.Sequential()
...
@@ -10,7 +10,7 @@ model = tf.keras.models.Sequential()
model
.
add
(
tf
.
keras
.
layers
.
Flatten
())
model
.
add
(
tf
.
keras
.
layers
.
Flatten
())
model
.
add
(
tf
.
keras
.
layers
.
Dense
(
256
,
activation
=
tf
.
nn
.
relu
))
model
.
add
(
tf
.
keras
.
layers
.
Dense
(
256
,
activation
=
tf
.
nn
.
relu
))
model
.
add
(
tf
.
keras
.
layers
.
Dense
(
128
,
activation
=
tf
.
nn
.
relu
))
model
.
add
(
tf
.
keras
.
layers
.
Dense
(
128
,
activation
=
tf
.
nn
.
relu
))
model
.
add
(
tf
.
keras
.
layers
.
Dense
(
46
,
activation
=
tf
.
nn
.
softmax
))
model
.
add
(
tf
.
keras
.
layers
.
Dense
(
11
,
activation
=
tf
.
nn
.
softmax
))
model
.
compile
(
optimizer
=
'adam'
,
model
.
compile
(
optimizer
=
'adam'
,
loss
=
'sparse_categorical_crossentropy'
,
loss
=
'sparse_categorical_crossentropy'
,
...
@@ -21,4 +21,6 @@ def predict(data):
...
@@ -21,4 +21,6 @@ def predict(data):
return
model
.
predict
(
numpy
.
array
(
data
))
return
model
.
predict
(
numpy
.
array
(
data
))
# Test prediction
# Test prediction
print
(
numpy
.
argmax
(
predict
([[
1
,
3
,
1
,
1
,
1
,
0
,
0
,
1
,
1
,
0
,
1
,
0
,
0
,
1
,
1
]])))
print
(
predict
([[
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
]]))
print
(
numpy
.
argmax
(
predict
([[
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
]])))
print
(
disease_labels
[
numpy
.
argmax
(
predict
([[
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
]]))])
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment