I’m using a ‘Brain Tumor Overall Survival Prediction’ using BraTS20 Dataset.
The output from the model is a binary array, but how to predict the survival time of a patient?
Why are the predicted results binary?
How can I interpret these binary results in the context of brain tumor survival time?
Are there any specific adjustments I need to make to my model or post-processing steps?
I want to predict the survival time duration when I give an MRI input to the model, I have to design a web application for that, where the user gives the MRI to get the Overall Survival Time.
Here is where the data is converted into arrays
def getListAgeDays(id_list): # create only age: category data
x_val = [] # Initialize an empty list to store feature data
y_val = [] # Initialize an empty list to store category labels
for i in id_list:
if (i not in age_dict): # Check if 'i' exists in the 'age_dict' dictionary
continue
masks = getMaskSizesForVolume(nib.load(TRAIN_DATASET_PATH + f'\\BraTS20_Training_{i[-3:]}/BraTS20_Training_{i[-3:]}_seg.nii').get_fdata())
# Load a segmentation mask and extract its size information
brain_vol = getBrainSizeForVolume(nib.load(TRAIN_DATASET_PATH + f'\\BraTS20_Training_{i[-3:]}/BraTS20_Training_{i[-3:]}_t1.nii').get_fdata())
# Load a brain volume image and extract its size information
masks[1] = masks[1]/brain_vol # Normalize the size of the mask
masks[2] = masks[2]/brain_vol
masks[3] = masks[3]/brain_vol
merged = [age_dict[i], masks[1], masks[2], masks[3]]
# Create a feature vector by combining 'age_dict[i]' with mask size values
radiomics_values = df_radiomics.loc[df_radiomics['target'] == str(i)]
# Query a DataFrame 'df_radiomics' for radiomics values associated with 'i'
if radiomics_values.empty:
continue # Skip this iteration if there are no radiomics values
merged.extend(radiomics_values.values.tolist()[0][:-1])
# Add radiomics values to the feature vector 'merged' excluding the last value
x_val.append(merged) # Append the feature vector to 'x_val'
if (days_dict[i] < 250):
y_val.append([1, 0, 0]) # Append category labels based on 'days_dict' conditions
elif (days_dict[i] >= 250 and days_dict[i] < 450):
y_val.append([0, 1, 0])
else:
y_val.append([0, 0, 1])
return np.array(x_val), np.array(y_val) # Return feature data and category labels as NumPy arrays
X_all, y_all = getListAgeDays(brats_ids) # Call the function with 'train_and_test_ids'
print(f'X_test: {X_all.shape}') # Print the shape of the feature data
Here’s the X_test
going into the model:
array([[0.424, 0.385, 0.725, 0.262, 0.304, 0.352, 0.555, 0.368, 0.276,
0.531, 0.054, 0.286, 0.337, 0.447, 0.464, 0.334, 0.235, 0.607,
0.789, 0.569, 0.849],
[0.691, 0.066, 0.026, 0.165, 0.019, 0.063, 0.209, 0.81 , 0. ,
0.419, 0. , 1. , 0.383, 0.335, 0.36 , 0.392, 0.335, 0.429,
0.381, 0.255, 0.257]....
Saved the model in Joblib
joblib.dump(model, 'model_joblib')
mj = joblib.load('model_joblib')
Here are the predictions
mj.predict(X_test)
output is:
array([0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0])
your question needs more clarity. Do you want to get the probability of each label prediction?
I want to predict the survival time duration when I give an MRI input to the model, I have to design a web application for that, where the user gives the MRI to get the Overall Survival Time.
Please note that interpreting results is not a programming question and off-topic in Stack Overflow.
The critical parts are missing. How is the model defined and how is y going into the training?