I have a matrix for diseases associated to their symptoms, the columns represent symptoms each row is a disease. the labels 1 and 0 in the matrix data sets represent when a disease i related to specific symptoms j in the matrix[i, j] give 1 otherwise 0 if not related. the goal of this work is to implement the SVM method for classifying disease and use symptoms to generate patients for predicting the most likely diseases. then calculating the performance of model precision, recall, and F1Score.
GM = {{{1, 1, 0, 1, 1, 0, 0} ->
"rare disease", {0, 0, 0, 0, 0, 0, 0} ->
"rare disease", {0, 0, 0, 0, 0, 0, 0} ->
"rare disease", {0, 0, 0, 0, 0, 0, 0} ->
"rare disease", {1, 1, 1, 1, 0, 1, 1} ->
"rare disease", {0, 1, 1, 1, 0, 0, 0} ->
"rare disease", {1, 1, 0, 0, 0, 0, 1} ->
"rare disease", {0, 1, 0, 0, 0, 0, 1} ->
"rare disease", {0, 0, 1, 1, 0, 0, 1} ->
"rare disease", {0, 0, 0, 0, 0, 0, 0} ->
"rare disease", {0, 0, 0, 0, 0, 0, 0} ->
"rare disease", {0, 0, 0, 0, 0, 0, 0} ->
"rare disease", {1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0} ->
"comon disease", {0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1} ->
"comon disease", {0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1} ->
"comon disease", {0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1} ->
"comon disease", {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ->
"comon disease", {0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0} ->
"comon disease"}, {{1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1} ->
"comon disease", {0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1} ->
"comon disease", {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ->
"comon disease", {0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1} ->
"comon disease", {1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0} ->
"comon disease", {1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0} ->
"comon disease"}}
here i tried to train and test the SVM classifier
{trainset, testset} = TakeDrop[GM, 18];
SVM = Classify[trainset, Method -> "SupportVectorMachine"]
(then i genereted new matrix for patients from evry disease in the origin dataset)
Dsymp = Select[
Table[{i, Position[GM[[i]], 1] // Flatten}, {i, 1,
Dimensions[GM][[1]]}], (#[[2]] != {}) &];
for more info, the output above represented the patients which are a sets of symptoms that are related to each disease in the matrix. i need to implement the SVM method to predict the most likely disease for each patient and test the performance ,
here i generated a random sets of 10 patients to predict the most likely diseases
Samp = Table[Random[Integer, {1, Dimensions[Dsymp][[1]]}], {i, 1, 10}];
with i knowked their disease
Thank so much you for any insight guys