Skip to content

Add option to print the true model used during the method #16

@mihaiconstantin

Description

@mihaiconstantin

Would be nice to be able to see what the true model looked like. Currently, we can only extract the true model from StepOne via the $true_model_parameters field.

Some thoughts on this:

  • since powerly will support more types of models, the responsibility for deciding how to plot the true model should lie with the specific model classes (i.e., with the users that propose new models)

  • then, in the plot method of the Method class add an argument model = FALSE that when TRUE will call the plot method of the corresponding model used

powerly/R/Method.R

Lines 233 to 260 in 0dbadcf

if (last) {
# Plot the right step from the last iteration.
if (step == 1) {
plot.StepOne(object$step_1, save = save, path = path, width = width, height = height, ...)
} else if (step == 2) {
plot.StepTwo(object$step_2, save = save, path = path, width = width, height = height, ...)
} else if (step == 3) {
plot.StepThree(object$step_3, save = save, path = path, width = width, height = height, ...)
} else {
stop("Incorrect step specification.")
}
} else {
# Prevent plotting of previous results if it converged on first iteration.
if (object$iteration > 1) {
# Plot the right step from the previous iteration.
if (step == 1) {
plot.StepOne(object$previous$step_2$step_1, save = save, path = path, width = width, height = height, ...)
} else if (step == 2) {
plot.StepTwo(object$previous$step_2, save = save, path = path, width = width, height = height, ...)
} else if (step == 3) {
plot.StepThree(object$previous, save = save, path = path, width = width, height = height, ...)
} else {
stop("Incorrect step specification.")
}
} else {
warning("No previous results. Method converged on first iteration.")
}
}

  • otherwise, the plot will just be one of the method steps

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions