Edit model card

Buy Me a Coffee at ko-fi.com

What it is

This is a simple, bare-bones Multi Layer Perceptron trained on the Heart Disease Dataset. This model was trained using ANNA(Asadullah's Neural Network Architecture)(written in pure C++), a simple headers-only, no-dependency library developed by us, XeTute Technologies.
The MSE(Mean Squared Error) of the trained model is < 0.2
The model is less than 15kB in size(if you're searching in 'Files', it's 'HDN.anna'), one of the smallest Artificial Neural Network's we've published, and it really can be deployed almost anywhere because of this. We also uploaded the code used to train this network, you can find the library on GitHub.

Training

For training, following C++ loop was utilized:

float mse = 1.0f;
for (std::size_t e = 0; mse > 0.2; ++e)
{
    for (std::size_t s = 0; s < ms; ++s)
    {
        HDN.forward(d[0][s]); // HDN is the model, d[0] is the input vector, d[0][s] is the input for s sample
        HDN.backward(d[1][s]); // d[1] is the output vector, d[1][s] is the output for s sample
    }
    mse = HDN.getMSE(d);
    std::cout << "MSE: " << mse << " for Epoch " << e << '\n';
}

And for test inference, following was added at the end of the main() function:

counter error = 0;
for (std::size_t s = 0; s < d[0].size(); ++s)
{
    HDN.forward(d[0][s]);
    std::cout
        << "\nGiven the input of: \n"
        << "- Age: " << d[0][s][0]
        << "\n- Sex: " << (d[0][s][1] ? "Male" : "Female")
        << "\n- Chest Pain Type: " << d[0][s][2]
        << "\n- Resting Blood Pressure (in mm Hg on admission to the hospital): " << d[0][s][3]
        << "\n- Serum Cholestoral in mg/dl: " << d[0][s][4]
        << "\n- Fasting Blood Sugar?: " << (d[0][s][5] ? "Yes" : "No")
        << "\n- Resting Electrocardiographic Results: " << d[0][s][6]
        << "\n- Maximum Heart Rate Achieved: " << d[0][s][7]
        << "\n- Exercise Induced Angina?: " << (d[0][s][8] ? "Yes" : "No")
        << "\n- ST Depression induced by Exercise relative to Rest: " << d[0][s][9]
        << "\n- Slope of the Peak Exercise ST Segment: " << d[0][s][10]
        << "\n- Number of Major Vessels(0-3) colored by Flourosopy: " << d[0][s][11]
        << "\n- Thal(1: Normal, 2: Fixed Defect, 3: Reversable Defect): " << d[0][s][12]
        << "\nThe models output was: " << ((HDN.getOutput()[0] >= 0.5) ? "Heart Disease" : "No Heart Disease")
        << "\nThe correct output is: " << (d[1][s][0] ? "Heart Disease" : "No Heart Disease") << '\n';
    if (((HDN.getOutput()[0] >= 0.5) ? 1 : 0) != d[1][s][0]) ++error;
}
std::cout << "Wrong Predictions: " << error << "\nCorrect Predications: " << d[0].size() - error << '\n';

Which logged:

[...]
Given the input of:
- Age: 47
- Sex: Male
- Chest Pain Type: 0
- Resting Blood Pressure (in mm Hg on admission to the hospital): 110
- Serum Cholestoral in mg/dl: 275
- Fasting Blood Sugar?: No
- Resting Electrocardiographic Results: 0
- Maximum Heart Rate Achieved: 118
- Exercise Induced Angina?: Yes
- ST Depression induced by Exercise relative to Rest: 1
- Slope of the Peak Exercise ST Segment: 1
- Number of Major Vessels(0-3) colored by Flourosopy: 1
- Thal(1: Normal, 2: Fixed Defect, 3: Reversable Defect): 2
The models output was: No Heart Disease
The correct output is: No Heart Disease

Given the input of:
- Age: 50
- Sex: Female
- Chest Pain Type: 0
- Resting Blood Pressure (in mm Hg on admission to the hospital): 110
- Serum Cholestoral in mg/dl: 254
- Fasting Blood Sugar?: No
- Resting Electrocardiographic Results: 0
- Maximum Heart Rate Achieved: 159
- Exercise Induced Angina?: No
- ST Depression induced by Exercise relative to Rest: 0
- Slope of the Peak Exercise ST Segment: 2
- Number of Major Vessels(0-3) colored by Flourosopy: 0
- Thal(1: Normal, 2: Fixed Defect, 3: Reversable Defect): 2
The models output was: Heart Disease
The correct output is: Heart Disease

[...]
// And, of course, because of the lack of training data and because of the small size of the model, it might also generate false data. Doesn't happen to often though.
Given the input of:
- Age: 41
- Sex: Male
- Chest Pain Type: 0
- Resting Blood Pressure (in mm Hg on admission to the hospital): 110
- Serum Cholestoral in mg/dl: 172
- Fasting Blood Sugar?: No
- Resting Electrocardiographic Results: 0
- Maximum Heart Rate Achieved: 158
- Exercise Induced Angina?: No
- ST Depression induced by Exercise relative to Rest: 0
- Slope of the Peak Exercise ST Segment: 2
- Number of Major Vessels(0-3) colored by Flourosopy: 0
- Thal(1: Normal, 2: Fixed Defect, 3: Reversable Defect): 3
The models output was: Heart Disease
The correct output is: No Heart Disease

[...] // ~70% accuracy
Wrong Predictions: 310
Correct Predications: 715

Notice

As you may have noticed, this model was trained on a dataset with only 1025 samples. The model itself is not large with ~3.5k(3.583 to be exact) parameters. This is because this model is NOT designed FOR PRODUCATION of any sort. We're only testing our library to make it producation ready as soon as possible.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference API
Unable to determine this model's library. Check the docs .