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
30f512e9
Commit
30f512e9
authored
Jul 05, 2021
by
dinithi1997
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changes
parent
0ccb1ce0
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
1062 additions
and
0 deletions
+1062
-0
disease_prediction/.gitignore
disease_prediction/.gitignore
+1
-0
disease_prediction/data.csv
disease_prediction/data.csv
+1001
-0
disease_prediction/disease_prediction_model.py
disease_prediction/disease_prediction_model.py
+36
-0
disease_prediction/predict_disease.py
disease_prediction/predict_disease.py
+24
-0
No files found.
disease_prediction/.gitignore
0 → 100644
View file @
30f512e9
.idea
\ No newline at end of file
disease_prediction/data.csv
0 → 100644
View file @
30f512e9
This diff is collapsed.
Click to expand it.
disease_prediction/disease_prediction_model.py
0 → 100644
View file @
30f512e9
import
numpy
import
pandas
as
pd
import
tensorflow
as
tf
from
sklearn.model_selection
import
train_test_split
model
=
tf
.
keras
.
models
.
Sequential
()
def
trainModel
(
model
,
datasetFilePath
):
model
.
add
(
tf
.
keras
.
layers
.
Flatten
())
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
(
46
,
activation
=
tf
.
nn
.
softmax
))
model
.
compile
(
optimizer
=
'adam'
,
loss
=
'sparse_categorical_crossentropy'
,
metrics
=
[
'accuracy'
])
model_df
=
pd
.
read_csv
(
datasetFilePath
)
X
=
model_df
.
values
[:,
0
:
15
]
y
=
model_df
.
values
[:,
15
]
print
(
y
)
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_test
=
tf
.
keras
.
utils
.
normalize
(
x_test
,
axis
=
1
)
model
.
fit
(
x_train
,
y_train
,
epochs
=
3
)
val_loss
,
val_acc
=
model
.
evaluate
(
x_test
,
y_test
)
print
(
val_loss
)
print
(
val_acc
)
model
.
save
(
'model.h5'
)
return
model
def
predict
(
model
,
data
):
return
model
.
predict
(
numpy
.
array
(
data
))
trainModel
(
model
,
"data.csv"
)
disease_prediction/predict_disease.py
0 → 100644
View file @
30f512e9
disease_labels
=
[
"Canine Scabies"
,
"Canine demodicosis"
,
"Fungal dermatitis"
,
"Allergic dermatitis"
,
"Ehrlichiosis"
,
"Canine babesiosis"
,
"Immune Mediated Haemolytic Anaemia"
,
"Acquired Thrombocytopenia"
,
"Hypoglycemia"
,
"Hypocalcemia"
,
"Canine parvo virus infection"
,
"Canine corona virus infection"
,
"Sphingomyelinase"
,
"Rabies"
,
"Bacterial prostatitis"
,
"Balanoposthitis"
,
"Canine brucellosis"
,
"Canine Cirrhosis"
,
"Bang's Disease"
,
"Candidiasis"
,
"Canine distemper"
,
"Canine influenza"
,
"Canine lymphoma"
,
"Lyme disease"
,
"Kidney disease"
,
"Kennel Cough"
,
"Diarrhoea"
,
"Gastritis"
,
"Gastroenteritis"
,
"Hepatitis"
,
"Giardia infection"
,
"Canine herpes virus"
,
"Galucoma"
,
"Gastric ulcer"
,
"Hepatic Encephalopathy"
,
"Hepatic lipidosis"
,
"Pneumonia"
,
"Diabetes"
,
"Ear infections"
,
"Heartworm"
,
"Anemia"
,
"Canine Leptospirosis"
,
"HEATSTROKE"
,
"Canine Hip Dysplasia"
,
"Canine Elbow Dysplasia"
]
print
(
len
(
disease_labels
))
import
numpy
import
tensorflow
as
tf
from
tensorflow.keras.models
import
load_model
model
=
tf
.
keras
.
models
.
Sequential
()
model
=
tf
.
keras
.
models
.
Sequential
()
model
.
add
(
tf
.
keras
.
layers
.
Flatten
())
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
(
46
,
activation
=
tf
.
nn
.
softmax
))
model
.
compile
(
optimizer
=
'adam'
,
loss
=
'sparse_categorical_crossentropy'
,
metrics
=
[
'accuracy'
])
model
=
load_model
(
'model.h5'
)
def
predict
(
data
):
return
model
.
predict
(
numpy
.
array
(
data
))
# Test prediction
print
(
numpy
.
argmax
(
predict
([[
1
,
3
,
1
,
1
,
1
,
0
,
0
,
1
,
1
,
0
,
1
,
0
,
0
,
1
,
1
]])))
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