Class: Rumale::LinearModel::BaseLinearModel
- Inherits:
-
Object
- Object
- Rumale::LinearModel::BaseLinearModel
- Includes:
- Base::BaseEstimator
- Defined in:
- lib/rumale/linear_model/base_linear_model.rb
Overview
BaseLinearModel is an abstract class for implementation of linear estimator with mini-batch stochastic gradient descent optimization. This class is used for internal process.
Direct Known Subclasses
Lasso, LinearRegression, LogisticRegression, Ridge, SVC, SVR
Instance Attribute Summary
Attributes included from Base::BaseEstimator
Instance Method Summary collapse
-
#initialize(reg_param: 1.0, fit_bias: false, bias_scale: 1.0, max_iter: 1000, batch_size: 10, optimizer: nil, n_jobs: nil, random_seed: nil) ⇒ BaseLinearModel
constructor
Initialize a linear estimator.
Constructor Details
#initialize(reg_param: 1.0, fit_bias: false, bias_scale: 1.0, max_iter: 1000, batch_size: 10, optimizer: nil, n_jobs: nil, random_seed: nil) ⇒ BaseLinearModel
Initialize a linear estimator.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/rumale/linear_model/base_linear_model.rb', line 27 def initialize(reg_param: 1.0, fit_bias: false, bias_scale: 1.0, max_iter: 1000, batch_size: 10, optimizer: nil, n_jobs: nil, random_seed: nil) @params = {} @params[:reg_param] = reg_param @params[:fit_bias] = fit_bias @params[:bias_scale] = bias_scale @params[:max_iter] = max_iter @params[:batch_size] = batch_size @params[:optimizer] = optimizer @params[:optimizer] ||= Optimizer::Nadam.new @params[:n_jobs] = n_jobs @params[:random_seed] = random_seed @params[:random_seed] ||= srand @weight_vec = nil @bias_term = nil @rng = Random.new(@params[:random_seed]) end |