% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/visualization.R
\name{plot_inter_effect}
\alias{plot_inter_effect}
\title{Plot Interaction Effect}
\usage{
plot_inter_effect(
  object,
  feature1,
  feature2,
  interpolate = FALSE,
  labs = NULL,
  custom_colors = "spectral",
  n_interpolate = 200,
  include_main = FALSE
)
}
\arguments{
\item{object}{Either model of class \code{onam} as returned from \link{onam} or
model evaluation outcome as returned from \link{predict.onam}}

\item{feature1, feature2}{Effects to be plotted.}

\item{interpolate}{If TRUE, values will be interpolated for a smooth plot.
If FALSE (default), only observations in the data will be plotted.}

\item{labs}{An optional named vector that can contain axis labels and the
name of the effect. Expected vector names are 'xlab', 'ylab' and 'effect'.}

\item{custom_colors}{color palette object for the interaction plot. Default
is "spectral", returning a color palette based on the spectral theme.}

\item{n_interpolate}{number of values per coordinate axis to interpolate.
Ignored if 'interpolate = FALSE'.}

\item{include_main}{If TRUE, main effects for features feature1 and feature2
will be added to the interaction term to give combined effect of main and
interaction effects. Default is FALSE.}
}
\value{
Returns a 'ggplot2' object of the specified effect interaction
}
\description{
Plot Interaction Effect
}
\examples{
\dontshow{if (reticulate::py_module_available(tensorflow)) withAutoprint(\{ # examplesIf}
# Basic example for a simple ONAM-model
# Create training data
n <- 1000
x1 <- runif(n, -2, 2)
x2 <- runif(n, -2, 2)
y <- sin(x1) + ifelse(x2 > 0, pweibull(x2, shape = 3),
  pweibull(-x2, shape = 0.5)) +
  x1 * x2
data_train <- cbind(x1, x2, y)
# Define model
model_formula <- y ~ mod1(x1) + mod1(x2) +
  mod1(x1, x2)
mod1 <- function(inputs) {
  outputs <- inputs \%>\%
    layer_dense(units = 16, activation = "relu") \%>\%
    layer_dense(units = 8, activation = "linear",
                use_bias = TRUE) \%>\%
    layer_dense(units = 1, activation = "linear",
                use_bias = TRUE)
  keras_model(inputs, outputs)
}
list_of_deep_models <- list(mod1 = mod1)
# Fit model
mod <- onam(model_formula, list_of_deep_models,
            data_train, n_ensemble = 1, epochs = 10)
plot_inter_effect(mod, "x1", "x2")
\dontshow{\}) # examplesIf}
}
