#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# This file is auto-generated by h2o-3/h2o-bindings/bin/gen_python.py
# Copyright 2016 H2O.ai;  Apache License Version 2.0 (see LICENSE for details)
#
from .estimator_base import H2OEstimator


class H2OGeneralizedLowRankEstimator(H2OEstimator):
    """
    Generalized Low Rank Modeling

    Builds a generalized low rank model of a H2O dataset.

    Parameters
    ----------
      model_id : str
        Destination id for this model; auto-generated if not specified.

      training_frame : str
        Id of the training data frame (Not required, to allow initial validation of model parameters).

      validation_frame : str
        Id of the validation data frame.

      ignored_columns : list(str)
        Names of columns to ignore for training.

      ignore_const_cols : bool
        Ignore constant columns.
        Default: True

      score_each_iteration : bool
        Whether to score during each iteration of model training.
        Default: False

      loading_name : str
        Frame key to save resulting X

      transform : "NONE" | "STANDARDIZE" | "NORMALIZE" | "DEMEAN" | "DESCALE"
        Transformation of training data
        Default: "NONE"

      k : int, required
        Rank of matrix approximation
        Default: 1

      loss : "Quadratic" | "Absolute" | "Huber" | "Poisson" | "Hinge" | "Logistic" | "Periodic"
        Numeric loss function
        Default: "Quadratic"

      loss_by_col : list("Quadratic" | "Absolute" | "Huber" | "Poisson" | "Hinge" | "Logistic" | "Periodic" |
                    "Categorical" | "Ordinal")
        Loss function by column (override)

      loss_by_col_idx : list(int)
        Loss function by column index (override)

      multi_loss : "Categorical" | "Ordinal"
        Categorical loss function
        Default: "Categorical"

      period : int
        Length of period (only used with periodic loss function)
        Default: 1

      regularization_x : "None" | "Quadratic" | "L2" | "L1" | "NonNegative" | "OneSparse" | "UnitOneSparse" | "Simplex"
        Regularization function for X matrix
        Default: "None"

      regularization_y : "None" | "Quadratic" | "L2" | "L1" | "NonNegative" | "OneSparse" | "UnitOneSparse" | "Simplex"
        Regularization function for Y matrix
        Default: "None"

      gamma_x : float
        Regularization weight on X matrix
        Default: 0.0

      gamma_y : float
        Regularization weight on Y matrix
        Default: 0.0

      max_iterations : int
        Maximum number of iterations
        Default: 1000

      max_updates : int
        Maximum number of updates
        Default: 2000

      init_step_size : float
        Initial step size
        Default: 1.0

      min_step_size : float
        Minimum step size
        Default: 0.0001

      seed : int
        RNG seed for initialization
        Default: -1

      init : "Random" | "SVD" | "PlusPlus" | "User"
        Initialization mode
        Default: "PlusPlus"

      svd_method : "GramSVD" | "Power" | "Randomized"
        Method for computing SVD during initialization (Caution: Power and Randomized are currently experimental and
        unstable)
        Default: "Randomized"

      user_y : str
        User-specified initial Y

      user_x : str
        User-specified initial X

      expand_user_y : bool
        Expand categorical columns in user-specified initial Y
        Default: True

      impute_original : bool
        Reconstruct original training data by reversing transform
        Default: False

      recover_svd : bool
        Recover singular values and eigenvectors of XY
        Default: False

      max_runtime_secs : float
        Maximum allowed runtime in seconds for model training. Use 0 to disable.
        Default: 0.0

    """
    def __init__(self, **kwargs):
        super(H2OGeneralizedLowRankEstimator, self).__init__()
        self._parms = {}
        for name in ["model_id", "training_frame", "validation_frame", "ignored_columns", "ignore_const_cols",
                     "score_each_iteration", "loading_name", "transform", "k", "loss", "loss_by_col", "loss_by_col_idx",
                     "multi_loss", "period", "regularization_x", "regularization_y", "gamma_x", "gamma_y",
                     "max_iterations", "max_updates", "init_step_size", "min_step_size", "seed", "init", "svd_method",
                     "user_y", "user_x", "expand_user_y", "impute_original", "recover_svd", "max_runtime_secs"]:
            pname = name[:-1] if name[-1] == '_' else name
            self._parms[pname] = kwargs[name] if name in kwargs else None
        self._parms["_rest_version"] = 3

    @property
    def training_frame(self):
        return self._parms["training_frame"]

    @training_frame.setter
    def training_frame(self, value):
        self._parms["training_frame"] = value

    @property
    def validation_frame(self):
        return self._parms["validation_frame"]

    @validation_frame.setter
    def validation_frame(self, value):
        self._parms["validation_frame"] = value

    @property
    def ignored_columns(self):
        return self._parms["ignored_columns"]

    @ignored_columns.setter
    def ignored_columns(self, value):
        self._parms["ignored_columns"] = value

    @property
    def ignore_const_cols(self):
        return self._parms["ignore_const_cols"]

    @ignore_const_cols.setter
    def ignore_const_cols(self, value):
        self._parms["ignore_const_cols"] = value

    @property
    def score_each_iteration(self):
        return self._parms["score_each_iteration"]

    @score_each_iteration.setter
    def score_each_iteration(self, value):
        self._parms["score_each_iteration"] = value

    @property
    def loading_name(self):
        return self._parms["loading_name"]

    @loading_name.setter
    def loading_name(self, value):
        self._parms["loading_name"] = value

    @property
    def transform(self):
        return self._parms["transform"]

    @transform.setter
    def transform(self, value):
        self._parms["transform"] = value

    @property
    def k(self):
        return self._parms["k"]

    @k.setter
    def k(self, value):
        self._parms["k"] = value

    @property
    def loss(self):
        return self._parms["loss"]

    @loss.setter
    def loss(self, value):
        self._parms["loss"] = value

    @property
    def loss_by_col(self):
        return self._parms["loss_by_col"]

    @loss_by_col.setter
    def loss_by_col(self, value):
        self._parms["loss_by_col"] = value

    @property
    def loss_by_col_idx(self):
        return self._parms["loss_by_col_idx"]

    @loss_by_col_idx.setter
    def loss_by_col_idx(self, value):
        self._parms["loss_by_col_idx"] = value

    @property
    def multi_loss(self):
        return self._parms["multi_loss"]

    @multi_loss.setter
    def multi_loss(self, value):
        self._parms["multi_loss"] = value

    @property
    def period(self):
        return self._parms["period"]

    @period.setter
    def period(self, value):
        self._parms["period"] = value

    @property
    def regularization_x(self):
        return self._parms["regularization_x"]

    @regularization_x.setter
    def regularization_x(self, value):
        self._parms["regularization_x"] = value

    @property
    def regularization_y(self):
        return self._parms["regularization_y"]

    @regularization_y.setter
    def regularization_y(self, value):
        self._parms["regularization_y"] = value

    @property
    def gamma_x(self):
        return self._parms["gamma_x"]

    @gamma_x.setter
    def gamma_x(self, value):
        self._parms["gamma_x"] = value

    @property
    def gamma_y(self):
        return self._parms["gamma_y"]

    @gamma_y.setter
    def gamma_y(self, value):
        self._parms["gamma_y"] = value

    @property
    def max_iterations(self):
        return self._parms["max_iterations"]

    @max_iterations.setter
    def max_iterations(self, value):
        self._parms["max_iterations"] = value

    @property
    def max_updates(self):
        return self._parms["max_updates"]

    @max_updates.setter
    def max_updates(self, value):
        self._parms["max_updates"] = value

    @property
    def init_step_size(self):
        return self._parms["init_step_size"]

    @init_step_size.setter
    def init_step_size(self, value):
        self._parms["init_step_size"] = value

    @property
    def min_step_size(self):
        return self._parms["min_step_size"]

    @min_step_size.setter
    def min_step_size(self, value):
        self._parms["min_step_size"] = value

    @property
    def seed(self):
        return self._parms["seed"]

    @seed.setter
    def seed(self, value):
        self._parms["seed"] = value

    @property
    def init(self):
        return self._parms["init"]

    @init.setter
    def init(self, value):
        self._parms["init"] = value

    @property
    def svd_method(self):
        return self._parms["svd_method"]

    @svd_method.setter
    def svd_method(self, value):
        self._parms["svd_method"] = value

    @property
    def user_y(self):
        return self._parms["user_y"]

    @user_y.setter
    def user_y(self, value):
        self._parms["user_y"] = value

    @property
    def user_x(self):
        return self._parms["user_x"]

    @user_x.setter
    def user_x(self, value):
        self._parms["user_x"] = value

    @property
    def expand_user_y(self):
        return self._parms["expand_user_y"]

    @expand_user_y.setter
    def expand_user_y(self, value):
        self._parms["expand_user_y"] = value

    @property
    def impute_original(self):
        return self._parms["impute_original"]

    @impute_original.setter
    def impute_original(self, value):
        self._parms["impute_original"] = value

    @property
    def recover_svd(self):
        return self._parms["recover_svd"]

    @recover_svd.setter
    def recover_svd(self, value):
        self._parms["recover_svd"] = value

    @property
    def max_runtime_secs(self):
        return self._parms["max_runtime_secs"]

    @max_runtime_secs.setter
    def max_runtime_secs(self, value):
        self._parms["max_runtime_secs"] = value

