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: grid_search_cv.rb
    path of file: ./repos/rumale/rumale-model_selection/lib/rumale/model_selection
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

require 'rumale/base/estimator'
require 'rumale/model_selection/cross_validation'

module Rumale
  module ModelSelection
    # GridSearchCV is a class that performs hyperparameter optimization with grid search method.
    #
    # @example

    
      def fit(x, y)
        init_attrs

        param_combinations.each do |prm_set|
          prm_set.each do |prms|
            report = perform_cross_validation(x, y, prms)
            store_cv_result(prms, report)
          end
        end

        find_best_params

        @best_estimator = configurated_estimator(@best_params)
        @best_estimator.fit(x, y)
        self
      end