# Variable cross_validation`Const`

cross_validation: { GridSearch: any; cross_validate_score: ((options?: {}) => any[]); cross_validation_split: ((dataset?: never[], options?: { folds: number; random_state: number }) => Data[]); grid_search: ((options?: any) => any); kfolds: ((dataset?: never[], options?: { folds: number; random_state: number }) => Data[]); train_test_split: ((dataset?: Data, options?: TrainTestSplitOptions) => Data[] | { test: Data; train: Data }) } = ...

### See

https://machinelearningmastery.com/implement-resampling-methods-scratch-python/

#### Type declaration

- ##### GridSearch: any

- ##### cross_validate_score: ((options?: {}) => any[])

  - - (options?: {}): any[]

    - Used to test variance and bias of a prediction

      ### Member Of

      cross_validation

      ### Returns

      Array of accucracy calculations

      #### Parameters

      - ##### options: {} = {}

      #### Returns any[]

- ##### cross_validation_split: ((dataset?: never[], options?: { folds: number; random_state: number }) => Data[])

  - - (dataset?: never[], options?: { folds: number; random_state: number }): Data[]

    - Provides train/test indices to split data in train/test sets. Split dataset into k consecutive folds. Each fold is then used once as a validation while the k - 1 remaining folds form the training set.

      ### Member Of

      cross_validation

      ### Example

          const testArray = [20, 25, 10, 33, 50, 42, 19, 34, 90, 23, ];
          // [ [ 50, 20, 34, 33, 10 ], [ 23, 90, 42, 19, 25 ] ]
          const crossValidationArrayKFolds = ms.cross_validation.cross_validation_split(testArray, { folds: 2, random_state: 0, });

      ### Returns

      returns dataset split into k consecutive folds

      #### Parameters

      - ##### dataset: never[] = []

        array of data to split

      - ##### options: { folds: number; random_state: number } = ...

        - ##### folds: number

          Number of folds

        - ##### random_state: number

          the seed used by the random number generator

      #### Returns Data[]

- ##### grid_search: ((options?: any) => any)

  - - (options?: any): any

    - Used to test variance and bias of a prediction with parameter tuning

      ### Member Of

      cross_validation

      ### Returns

      Array of accucracy calculations

      #### Parameters

      - ##### options: any = {}

      #### Returns any

- ##### kfolds: ((dataset?: never[], options?: { folds: number; random_state: number }) => Data[])

  - - (dataset?: never[], options?: { folds: number; random_state: number }): Data[]

    - Provides train/test indices to split data in train/test sets. Split dataset into k consecutive folds. Each fold is then used once as a validation while the k - 1 remaining folds form the training set.

      ### Member Of

      cross_validation

      ### Example

          const testArray = [20, 25, 10, 33, 50, 42, 19, 34, 90, 23, ];
          // [ [ 50, 20, 34, 33, 10 ], [ 23, 90, 42, 19, 25 ] ]
          const crossValidationArrayKFolds = ms.cross_validation.cross_validation_split(testArray, { folds: 2, random_state: 0, });

      ### Returns

      returns dataset split into k consecutive folds

      #### Parameters

      - ##### dataset: never[] = []

        array of data to split

      - ##### options: { folds: number; random_state: number } = ...

        - ##### folds: number

          Number of folds

        - ##### random_state: number

          the seed used by the random number generator

      #### Returns Data[]

- ##### train_test_split: ((dataset?: Data, options?: TrainTestSplitOptions) => Data[] | { test: Data; train: Data })

  - - (dataset?: Data, options?: TrainTestSplitOptions): Data[] | { test: Data; train: Data }

    - Split arrays into random train and test subsets

      ### Member Of

      cross_validation

      ### Example

          const testArray = [20, 25, 10, 33, 50, 42, 19, 34, 90, 23, ];
          // { train: [ 50, 20, 34, 33, 10, 23, 90, 42 ], test: [ 25, 19 ] }
          const trainTestSplit = ms.cross_validation.train_test_split(testArray,{ test_size:0.2, random_state: 0, });

      ### Returns

      returns training and test arrays either as an object or arrays

      #### Parameters

      - ##### dataset: Data = []

        array of data to split

      - ##### options: TrainTestSplitOptions = ...

      #### Returns Data[] | { test: Data; train: Data }

- Defined in src/cross_validation.ts:244