/**
 * Given a dictionary containing patient data, extract the features of the patients and normalize the values.
 *
 * @param patientData A dictionary containing patient data, where the keys represent the patients and the values
 * represent the respective data.
 * @return A dictionary mapping each patient to a list of normalized feature values.
 */
fun extractFeatures(patientData: Map<String, List<Double>>): Map<String, List<Double>> {

    val features = mutableMapOf<String, List<Double>>()

    // Iterate over each patient in patientData dictionary
    for ((patient, data) in patientData) {
        // Initialize a list to store the normalized feature values
        val normalizedFeatures = mutableListOf<Double>()

        // Find the maximum value in the feature set
        val maxData = data.maxOrNull() ?: 1.0

        // Iterate over each feature value for the current patient
        for (value in data) {
            // Normalize the value by dividing it by the maximum value in the feature set
            val normalizedValue = value / maxData

            // Add the normalized feature value to the list
            normalizedFeatures.add(normalizedValue)
        }

        // Update the features map with the normalized feature values for the current patient
        features[patient] = normalizedFeatures
    }

    return features
}
/**
 * Given a dictionary containing patient data, extract the features of the patients and normalize the values.
 *
 * @param patientData A dictionary containing patient data, where the keys represent the patients and the values
 * represent the respective data.
 * @return A dictionary mapping each patient to a list of normalized feature values.
 */
fun extractFeatures(patientData: Map<String, List<Double>>): Map<String, List<Double>> {
/**
 * Given a dictionary containing patient data, extract the features of the patients and normalize the values.
 *
 * @param patientData A dictionary containing patient data, where the keys represent the patients and the values
 * represent the respective data.
 * @return A dictionary mapping each patient to a list of normalized feature values.
 */
fun extractFeatures(patientData: Map<String, List<Double>>): Map<String, List<Double>> {

    val features = mutableMapOf<String, List<Double>>()

    // Iterate over each patient in patientData dictionary
    for ((patient, data) in patientData) {
        // Initialize a list to store the normalized feature values
        val normalizedFeatures = mutableListOf<Double>()

        // Find the maximum value in the feature set
        val maxData = data.maxOrNull() ?: 1.0

        // Iterate over each feature value for the current patient
        for (value in data) {
            // Normalize the value by dividing it by the maximum value in the feature set
            val normalizedValue = value / maxData

            // Add the normalized feature value to the list
            normalizedFeatures.add(normalizedValue)
        }

        // Update the features map with the normalized feature values for the current patient
        features[patient] = normalizedFeatures
    }

    return features
}