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
bae7e627
Commit
bae7e627
authored
Nov 26, 2021
by
Dinithi Anupama
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'IT18116984_WeerasundaraD.A' into 'master'
Ann model changes See merge request
!24
parents
d4a279a3
9dd41308
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
422 additions
and
12 deletions
+422
-12
disease_prediction/chatbot_symptom_disease_model.py
disease_prediction/chatbot_symptom_disease_model.py
+8
-5
disease_prediction/data_pld.csv
disease_prediction/data_pld.csv
+51
-0
disease_prediction/disease_prediction_model.py
disease_prediction/disease_prediction_model.py
+1
-0
disease_prediction/neural network accuracy new.png
disease_prediction/neural network accuracy new.png
+0
-0
disease_prediction/neural network loss new.png
disease_prediction/neural network loss new.png
+0
-0
disease_prediction/pred_api.py
disease_prediction/pred_api.py
+4
-3
disease_prediction/predict_disease.py
disease_prediction/predict_disease.py
+11
-4
disease_prediction/training_log.txt
disease_prediction/training_log.txt
+347
-0
No files found.
disease_prediction/chatbot_symptom_disease_model.py
View file @
bae7e627
...
@@ -10,8 +10,9 @@ from sklearn import preprocessing
...
@@ -10,8 +10,9 @@ from sklearn import preprocessing
def
loadModel
(
model
):
def
loadModel
(
model
):
model
=
tf
.
keras
.
models
.
Sequential
()
model
=
tf
.
keras
.
models
.
Sequential
()
model
.
add
(
tf
.
keras
.
layers
.
Flatten
())
model
.
add
(
tf
.
keras
.
layers
.
Flatten
())
model
.
add
(
tf
.
keras
.
layers
.
Dense
(
25
,
activation
=
tf
.
nn
.
relu
))
model
.
add
(
tf
.
keras
.
layers
.
Dense
(
50
,
activation
=
tf
.
nn
.
relu
))
model
.
add
(
tf
.
keras
.
layers
.
Dense
(
25
,
activation
=
tf
.
nn
.
relu
))
model
.
add
(
tf
.
keras
.
layers
.
Dense
(
50
,
activation
=
tf
.
nn
.
relu
))
model
.
add
(
tf
.
keras
.
layers
.
Dense
(
50
,
activation
=
tf
.
nn
.
relu
))
model
.
add
(
tf
.
keras
.
layers
.
Dense
(
7
,
activation
=
tf
.
nn
.
softmax
))
model
.
add
(
tf
.
keras
.
layers
.
Dense
(
7
,
activation
=
tf
.
nn
.
softmax
))
model
.
compile
(
optimizer
=
'adam'
,
model
.
compile
(
optimizer
=
'adam'
,
...
@@ -23,8 +24,9 @@ def loadModel(model):
...
@@ -23,8 +24,9 @@ def loadModel(model):
def
trainModel
(
model
,
datasetFilePath
):
def
trainModel
(
model
,
datasetFilePath
):
model
=
tf
.
keras
.
models
.
Sequential
()
model
=
tf
.
keras
.
models
.
Sequential
()
model
.
add
(
tf
.
keras
.
layers
.
Flatten
())
model
.
add
(
tf
.
keras
.
layers
.
Flatten
())
model
.
add
(
tf
.
keras
.
layers
.
Dense
(
25
,
activation
=
tf
.
nn
.
relu
))
model
.
add
(
tf
.
keras
.
layers
.
Dense
(
50
,
activation
=
tf
.
nn
.
relu
))
model
.
add
(
tf
.
keras
.
layers
.
Dense
(
25
,
activation
=
tf
.
nn
.
relu
))
model
.
add
(
tf
.
keras
.
layers
.
Dense
(
50
,
activation
=
tf
.
nn
.
relu
))
model
.
add
(
tf
.
keras
.
layers
.
Dense
(
50
,
activation
=
tf
.
nn
.
relu
))
model
.
add
(
tf
.
keras
.
layers
.
Dense
(
7
,
activation
=
tf
.
nn
.
softmax
))
model
.
add
(
tf
.
keras
.
layers
.
Dense
(
7
,
activation
=
tf
.
nn
.
softmax
))
model
.
compile
(
optimizer
=
'adam'
,
model
.
compile
(
optimizer
=
'adam'
,
...
@@ -39,6 +41,7 @@ def trainModel(model, datasetFilePath):
...
@@ -39,6 +41,7 @@ def trainModel(model, datasetFilePath):
leBreeds
=
preprocessing
.
LabelEncoder
()
leBreeds
=
preprocessing
.
LabelEncoder
()
leBreeds
.
fit
(
model_df
[
'Breeds'
])
leBreeds
.
fit
(
model_df
[
'Breeds'
])
print
(
leBreeds
.
classes_
)
model_df
[
'Breeds'
]
=
leBreeds
.
transform
(
model_df
[
'Breeds'
])
model_df
[
'Breeds'
]
=
leBreeds
.
transform
(
model_df
[
'Breeds'
])
dataDf
=
model_df
.
fillna
(
0
)
dataDf
=
model_df
.
fillna
(
0
)
print
(
model_df
.
shape
)
print
(
model_df
.
shape
)
...
@@ -49,7 +52,7 @@ def trainModel(model, datasetFilePath):
...
@@ -49,7 +52,7 @@ def trainModel(model, datasetFilePath):
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
)
history
=
model
.
fit
(
x_train
,
y_train
,
epochs
=
1
5
,
validation_data
=
(
x_test
,
y_test
))
history
=
model
.
fit
(
x_train
,
y_train
,
epochs
=
7
5
,
validation_data
=
(
x_test
,
y_test
))
print
(
"History: "
,
history
)
print
(
"History: "
,
history
)
val_loss
,
val_acc
=
model
.
evaluate
(
x_test
,
y_test
)
val_loss
,
val_acc
=
model
.
evaluate
(
x_test
,
y_test
)
...
...
disease_prediction/data_pld.csv
0 → 100644
View file @
bae7e627
age,symptom1,symptom2,symptom3,symptom4,symptom5,symptom6,symptom7,symptom8,symptom9,symptom10,symptom11,symptom12,symptom13,symptom14,symptom15,symptom16,symptom17,disease
1,1,1,1,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1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,3
1,1,1,1,1,1,1,0,1,0,0,0,0,0,0,0,1,0,3
1,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,3
1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,3
1,1,1,0,1,1,0,0,0,0,1,0,0,0,0,0,0,0,0
1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0
1,1,1,1,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0
1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0
1,1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0
1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
1,1,1,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0
1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0
4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0
4,0,1,1,1,1,1,1,1,1,0,1,1,1,0,1,1,1,0
4,1,1,0,1,1,1,0,1,1,1,1,1,1,1,1,1,1,0
4,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0
4,1,1,1,1,1,0,0,1,0,1,1,1,1,1,1,1,0,2
4,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,2
4,0,0,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,2
4,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,2
4,1,1,0,1,1,1,1,1,1,1,1,0,1,1,1,1,1,2
4,1,1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,2
4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,2
\ No newline at end of file
disease_prediction/disease_prediction_model.py
View file @
bae7e627
...
@@ -5,6 +5,7 @@ from sklearn.model_selection import train_test_split
...
@@ -5,6 +5,7 @@ from sklearn.model_selection import train_test_split
import
matplotlib.pyplot
as
plt
import
matplotlib.pyplot
as
plt
from
sklearn
import
preprocessing
from
sklearn
import
preprocessing
# load the dataset using pandas library
dataDf
=
pd
.
read_csv
(
"data.csv"
)
dataDf
=
pd
.
read_csv
(
"data.csv"
)
leDiseases
=
preprocessing
.
LabelEncoder
()
leDiseases
=
preprocessing
.
LabelEncoder
()
...
...
disease_prediction/neural network accuracy new.png
0 → 100644
View file @
bae7e627
20.5 KB
disease_prediction/neural network loss new.png
0 → 100644
View file @
bae7e627
28.6 KB
disease_prediction/pred_api.py
View file @
bae7e627
...
@@ -15,8 +15,9 @@ def predict():
...
@@ -15,8 +15,9 @@ def predict():
model
=
tf
.
keras
.
models
.
Sequential
()
model
=
tf
.
keras
.
models
.
Sequential
()
model
=
tf
.
keras
.
models
.
Sequential
()
model
=
tf
.
keras
.
models
.
Sequential
()
model
.
add
(
tf
.
keras
.
layers
.
Flatten
())
model
.
add
(
tf
.
keras
.
layers
.
Flatten
())
model
.
add
(
tf
.
keras
.
layers
.
Dense
(
25
,
activation
=
tf
.
nn
.
relu
))
model
.
add
(
tf
.
keras
.
layers
.
Dense
(
50
,
activation
=
tf
.
nn
.
relu
))
model
.
add
(
tf
.
keras
.
layers
.
Dense
(
25
,
activation
=
tf
.
nn
.
relu
))
model
.
add
(
tf
.
keras
.
layers
.
Dense
(
50
,
activation
=
tf
.
nn
.
relu
))
model
.
add
(
tf
.
keras
.
layers
.
Dense
(
50
,
activation
=
tf
.
nn
.
relu
))
model
.
add
(
tf
.
keras
.
layers
.
Dense
(
7
,
activation
=
tf
.
nn
.
softmax
))
model
.
add
(
tf
.
keras
.
layers
.
Dense
(
7
,
activation
=
tf
.
nn
.
softmax
))
model
.
compile
(
optimizer
=
'adam'
,
model
.
compile
(
optimizer
=
'adam'
,
...
@@ -29,4 +30,4 @@ def predict():
...
@@ -29,4 +30,4 @@ def predict():
return
{
"pred"
:
str
(
numpy
.
argmax
(
prediction
))}
return
{
"pred"
:
str
(
numpy
.
argmax
(
prediction
))}
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
app
.
run
(
debug
=
True
,
port
=
5001
)
app
.
run
(
debug
=
True
,
port
=
5001
,
host
=
"0.0.0.0"
)
disease_prediction/predict_disease.py
View file @
bae7e627
...
@@ -17,10 +17,17 @@ model.compile(optimizer='adam',
...
@@ -17,10 +17,17 @@ model.compile(optimizer='adam',
metrics
=
[
'accuracy'
])
metrics
=
[
'accuracy'
])
model
=
load_model
(
'model.h5'
)
model
=
load_model
(
'model.h5'
)
pred
=
model
.
predict
(
numpy
.
array
([[
2
,
0
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
]]))
def
predict
(
data
):
def
predict
(
data
):
return
model
.
predict
(
numpy
.
array
(
data
))
print
(
numpy
.
array
(
data
))
pred
=
model
.
predict
(
numpy
.
array
([[
2
,
0
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
]]))
print
(
pred
)
return
pred
# Test prediction
# Test prediction
print
(
predict
([[
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
]]))
# input = [2,0,1,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,1,0,0,0,1,0,0,0,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(len(input))
print
(
disease_labels
[
numpy
.
argmax
(
predict
([[
1
,
1
,
1
,
1
,
1
,
1
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
]]))])
# print(predict([[2,0,1,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,1,0,0,0,1,0,0,0,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]]))])
disease_prediction/training_log.txt
0 → 100644
View file @
bae7e627
This diff is collapsed.
Click to expand it.
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