code: def hyper_parameter_search(
              self,
              param_distributions,
              n_iter=10,
              scoring=None,
              fit_params={},
              n_jobs=1,
              iid=True,
              refit=True,
              cv=None,
              verbose=0,
              pre_dispatch='2*njobs',
              random_state=None,
              error_score='raise',
              return_train_score=True,
              test=True,
              score=True,
              save=True,
              custom_data=None
      ):
          
          params = locals()
          params.pop('self')
  
          self.fitting = lore.metadata.Fitting.create(
              model=self.name,
              custom_data=custom_data,
              snapshot=lore.metadata.Snapshot(pipeline=self.pipeline.name,
                                              head=str(self.pipeline.training_data.head(2)),
                                              tail=str(self.pipeline.training_data.tail(2))
                                              )
          )
  
          result = RandomizedSearchCV(
              self.estimator,
              param_distributions,
              n_iter=n_iter,
              scoring=scoring,
              n_jobs=n_jobs,
              iid=iid,
              refit=refit,
              cv=cv,
              verbose=verbose,
              pre_dispatch=pre_dispatch,
              random_state=random_state,
              error_score=error_score,
              return_train_score=return_train_score
          ).fit(
              self.pipeline.encoded_training_data.x,
              y=self.pipeline.encoded_training_data.y,
              validation_x=self.pipeline.encoded_validation_data.x,
              validation_y=self.pipeline.encoded_validation_data.y,
              **fit_params
          )
          self.estimator = result.best_estimator_
          self.stats = {}
          self.estimator_kwargs = self.estimator.__getstate__()
  
          if test:
              self.stats['test'] = self.evaluate(self.pipeline.test_data)
  
          if score:
              self.stats['score'] = self.score(self.pipeline.test_data)
  
          self.complete_fitting()
  
          if save:
              self.save()
          return result
docs: Random search hyper params