You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: Nystroem.m
    path of file: ./repos/sklearn-matlab/lib/kernel_approximation
    
    the code of the file until where you have to start completion: classdef Nystroem < BaseEstimator & TransformerMixin
    % Nystr
    
function fit(obj,X,~)
            if ~isempty(obj.random_state)
                rng('default')
                rng(obj.random_state);
            end
            n_samples = size(X,1);
            
            % get basis vectors
            if obj.n_components > n_samples
                n_components_ = n_samples;
            else
                n_components_ = obj.n_components;
            end