diff --git a/R/commonMachineLearningClassification.R b/R/commonMachineLearningClassification.R index 54568626..26752790 100644 --- a/R/commonMachineLearningClassification.R +++ b/R/commonMachineLearningClassification.R @@ -167,14 +167,14 @@ if (!ready) { table$addFootnote(gettextf("Please provide a target variable and at least %i feature variable(s).", if (type == "knn" || type == "neuralnet" || type == "rpart" || type == "svm" || type == "logistic") 1L else 2L)) } - if (options[["savePath"]] != "") { + if (options[["saveModel"]]) { validNames <- (length(grep(" ", decodeColNames(colnames(dataset)))) == 0) && (length(grep("_", decodeColNames(colnames(dataset)))) == 0) - if (options[["saveModel"]] && validNames) { + if (options[["savePath"]] != "" && validNames) { table$addFootnote(gettextf("The trained model is saved as %1$s.", basename(options[["savePath"]]))) - } else if (options[["saveModel"]] && !validNames) { + } else if (options[["savePath"]] != "" && !validNames) { table$addFootnote(gettext("The trained model is not saved because the some of the variable names in the model contain spaces (i.e., ' ') or underscores (i.e., '_'). Please remove all such characters from the variable names and try saving the model again.")) } else { - table$addFootnote(gettext("The trained model is not saved until 'Save trained model' is checked.")) + table$addFootnote(gettext("The trained model is not saved until a file name is specified under 'Save as'.")) } } jaspResults[["classificationTable"]] <- table diff --git a/R/commonMachineLearningRegression.R b/R/commonMachineLearningRegression.R index 90013c24..03a2c70a 100644 --- a/R/commonMachineLearningRegression.R +++ b/R/commonMachineLearningRegression.R @@ -336,14 +336,14 @@ if (!ready) { table$addFootnote(gettextf("Please provide a target variable and at least %d feature variable(s).", if (type == "knn" || type == "neuralnet" || type == "rpart" || type == "svm" || type == "lm") 1L else 2L)) } - if (options[["savePath"]] != "") { + if (options[["saveModel"]]) { validNames <- (length(grep(" ", decodeColNames(colnames(dataset)))) == 0) && (length(grep("_", decodeColNames(colnames(dataset)))) == 0) - if (options[["saveModel"]] && validNames) { + if (options[["savePath"]] != "" && validNames) { table$addFootnote(gettextf("The trained model is saved as %1$s.", basename(options[["savePath"]]))) - } else if (options[["saveModel"]] && !validNames) { + } else if (options[["savePath"]] != "" && !validNames) { table$addFootnote(gettext("The trained model is not saved because the some of the variable names in the model contain spaces (i.e., ' ') or underscores (i.e., '_'). Please remove all such characters from the variable names and try saving the model again.")) } else { - table$addFootnote(gettext("The trained model is not saved until 'Save trained model' is checked.")) + table$addFootnote(gettext("The trained model is not saved until a file name is specified under 'Save as'.")) } } jaspResults[["regressionTable"]] <- table diff --git a/inst/qml/common/ui/ExportResults.qml b/inst/qml/common/ui/ExportResults.qml index 13389d47..9002096d 100644 --- a/inst/qml/common/ui/ExportResults.qml +++ b/inst/qml/common/ui/ExportResults.qml @@ -61,26 +61,22 @@ Group { id: saveGroup - FileSelector - { - id: savePath - name: "savePath" - label: qsTr("Save as") - placeholderText: qsTr("e.g., location/model.jaspML") - filter: "*.jaspML" - save: true - fieldWidth: 180 * preferencesModel.uiScale - info: qsTr("The file path for the saved model.") - } - CheckBox { - id: saveModel name: "saveModel" text: qsTr("Save trained model") - enabled: showSave && savePath.value != "" - Layout.leftMargin: 10 * preferencesModel.uiScale info: qsTr("When clicked, the model is exported to the specified file path.") + + FileSelector + { + name: "savePath" + label: qsTr("Save as") + placeholderText: qsTr("e.g., location/model.jaspML") + filter: "*.jaspML" + save: true + fieldWidth: 180 * preferencesModel.uiScale + info: qsTr("The file path for the saved model.") + } } } }