lib/rumale/decomposition/fast_ica.rb
# Fit the model with given training data.
#
# @overload fit(x) -> FastICA
#   @param x [Numo::DFloat] (shape: [n_samples, n_features]) The training data to be used for fitting the model.
# @return [FastICA] The learned transformer itself.
Fit the model with given training data.
Fit the model with given training data .
def fit(x, _y = nil)
        x = check_convert_sample_array(x)
        raise 'FastICA#fit requires Numo::Linalg but that is not loaded.' unless enable_linalg?
        @mean, whiten_mat = whitening(x, @params[:n_components]) if @params[:whiten]
        wx = @params[:whiten] ? (x - @mean).dot(whiten_mat.transpose) : x
        unmixing, @n_iter = ica(wx, @params[:fun], @params[:max_iter], @params[:tol], @rng.dup)
        @components = @params[:whiten] ? unmixing.dot(whiten_mat) : unmixing
        @mixing = Numo::Linalg.pinv(@components).dup
        if @params[:n_components] == 1
          @components = @components.flatten.dup
          @mixing = @mixing.flatten.dup
        end
        self
      end
def fit ( x , _y = nil ) x = check_convert_sample_array ( x ) raise 'FastICA#fit requires Numo::Linalg but that is not loaded.' unless enable_linalg? @mean , whiten_mat = whitening ( x , @params [ :n_components ] ) if @params [ :whiten ] wx = @params [ :whiten ] ? ( x - @mean ) . dot ( whiten_mat . transpose ) : x unmixing , @n_iter = ica ( wx , @params [ :fun ] , @params [ :max_iter ] , @params [ :tol ] , @rng . dup ) @components = @params [ :whiten ] ? unmixing . dot ( whiten_mat ) : unmixing @mixing = Numo :: Linalg . pinv ( @components ) . dup if @params [ :n_components ] == 1 @components = @components . flatten . dup @mixing = @mixing . flatten . dup end self end
Fit the model with given training data.
Fit the model with given training data .
The learned transformer itself.
The learned transformer itself .
FastICA
x
<not_specific>
_y
<not_specific>
overload
> FastICA @param x [Numo::DFloat] (shape: [n_samples, n_features]) The training data to be used for fitting the model.
> FastICA @param x [ Numo :: DFloat ] ( shape : [ n_samples n_features ] ) The training data to be used for fitting the model .