A pregnant woman can give birth to younger ones with or without a caesarean operation. They depend upon many factors like the age of the woman, what is the delivery number, delivery time (if the pregnant is brought to the hospital at the correct time or not), blood pressure of the patient and if she has a heart problem or not. The dataset is downloaded from here.
- Training data: data which will be used for training the model.
- Validation data: data which will be used for validating the trained data (checking if the trained model is correct or not).
- Testing data: data which is used for testing the model.
- Hidden neurons: Initially,random weights are given to each sample. Then classification is done, and based on the result obtained, weight is adjusted and classified again. Hidden neurons are the number of times the process should run to adjust weights.
Installing project in your pc:
- You need to first have matlab in your pc. Download matlab from this link if you don’t have matlab.
- Then, clone the project from here.
- After cloning, unzip the file. Run “ maincode.m ” in the matlab.
- In the beginning, the file (maindata.txt) in which data is stored is loaded into matlab. The file has 80 rows, that is for 80 different conditions, and has 6 columns in which the first 5 are attributes (age, delivery number, delivery time, blood pressure and heart problem) and the last column is the target column. Target means the expected output, that is 1 if caesarean is required and 0 if not required. Then each column is kept in an array, and the target column is stored in “colyn”.
- After that, data with target 1 are stored in class1data and with target 0 are stored in class2data.
- They both are appended one by one into Z1 vector. Then 46 (length of class1 data) “1” values are appended with 34(length of class1 data) “-1” values and are stored in “TargetVector1”. This is appended to Z1 and are stored in “z”.
- You use these variables for classification according to the requirement.
How to run the code in matlab (for classification learners) :
1.First, run maincode.m in your pc. Then in the apps section click on the dropdown present to the extreme right and then click on classification learner, that is present under “machine learning”.
2.After that, click on new session -> from workspace.
3. In the workspace variable, select ‘z’, and click on start session which is present on the bottom right.
4.Click on the dropdown to select the required classifier and click on “train”. You can also run all classifiers by clicking on “all”. Then click on “Train”. The given dataset will be classified according to the given classifier.
How to run the code in matlab (for neural networking) :
- First, run maincode.m in your pc. Then in the apps section click on the dropdown present to the extreme right and then click on neural network pattern recognition, that is present under “machine learning”.
- Then this appears, click on next, present on bottom right.
- Then, enter “z” as input and “colyn” as target. Don’t forget to change samples as matrix rows from matrix columns. Click on next.
- Adjust Training, Validation and Testing data according to your convenience, or leave it as it is. Click on next.
- Adjust hidden neurons’ value according to your convenience or use the default value. Higher the value, higher the expected accuracy. Click on next.
- Click on train, to train the model. After that, click on plot confusion and plot ROC to plot confusion matrix (matrix which states true and false positives and negatives for the classifications) and ROC curve (curve which illustrates diagnostic ability of a binary classifier, obtained by plotting True positives and False positives bychanging thresholds ). Click on next.
- You can evaluate your network by changing inputs given. Click on next.
- You can deploy the solution in various forms. Click on next.
- You can save the obtained results according to your convenience. Click on finish to close.
Using the given process, we can assess if a pregnant woman requires caesarean for delivery or not. This saves time, especially in case of an emergency. You can always try to classify various problems using this process.