Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions R/commonMachineLearningClassification.R
Original file line number Diff line number Diff line change
Expand Up @@ -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 <i>%1$s</i>.", basename(options[["savePath"]])))
} else if (options[["saveModel"]] && !validNames) {
} else if (options[["savePath"]] != "" && !validNames) {
table$addFootnote(gettext("The trained model is <b>not</b> 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
Expand Down
8 changes: 4 additions & 4 deletions R/commonMachineLearningRegression.R
Original file line number Diff line number Diff line change
Expand Up @@ -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 <i>%1$s</i>.", basename(options[["savePath"]])))
} else if (options[["saveModel"]] && !validNames) {
} else if (options[["savePath"]] != "" && !validNames) {
table$addFootnote(gettext("The trained model is <b>not</b> 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
Expand Down
26 changes: 11 additions & 15 deletions inst/qml/common/ui/ExportResults.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
}
}
}
}
Loading