Open WenJieh616 opened 2 weeks ago
Please give me an answer, thank you.
Please give me an answer. Thank you.
Hi @WenJieh616, I appreciate you taking the time to look over my work.
In the context of the same heart disease prediction code/project, an example of a regression problem could be predicting the risk score or probability of heart disease rather than simply classifying whether an individual has heart disease or not. Instead of predicting a binary outcome (presence or absence of heart disease), we could modify the project to predict a continuous value, such as a risk score ranging from 0 to 1, representing the probability or severity of heart disease. To achieve this, we must make a few significant changes to a number of different components, including the target variable, loss function, and output layer.
Output Layer: Change the output layer of the neural network to have a single neuron with a linear activation function (instead of a sigmoid function), as this will generate a continuous value.
Loss Function: We have to use a regression loss function such as mean squared error (MSE) or mean absolute error (MAE) instead of binary cross-entropy.
Target Variable: Instead of a binary target variable (0 or 1), our target would be a continuous value representing the risk score, which could be derived from existing medical data or created by combining multiple risk factors.
I will demonstrate a few sample code modifications for you:
model.add(Dense(1, activation='linear')) # For regression, use 'linear' activation
model.compile(optimizer=optimizer, loss='mean_squared_error', metrics=['mae'])
Please do not hesitate to get in touch with me if you have any questions or would like the complete code.
Hello rawat28,
I have read the Hear-disease-prediction-Using-PSO (https://github.com/rawat28/Hear-disease-prediction-Using-PSO) that you uploaded to Github, and I have a question for you. It is an example of classification, can you upload another example for regression problems? Thank you!