> ## Documentation Index
> Fetch the complete documentation index at: https://docs.blindsight.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate Splits

> Generate balanced train/val/test splits for a playground session.



## OpenAPI

````yaml /api-reference/openapi.json post /api/playground/sessions/{session_id}/splits
openapi: 3.1.0
info:
  title: Blindsight API
  version: 0.1.0
servers: []
security: []
paths:
  /api/playground/sessions/{session_id}/splits:
    post:
      tags:
        - playground
      summary: Generate Splits
      description: Generate balanced train/val/test splits for a playground session.
      operationId: generate_splits_api_playground_sessions__session_id__splits_post
      parameters:
        - name: session_id
          in: path
          required: true
          schema:
            type: string
            title: Session Id
        - name: X-API-Key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Api-Key
        - name: blindsight_session
          in: cookie
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Blindsight Session
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateSplitsRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SplitSummaryResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    GenerateSplitsRequest:
      properties:
        target_column:
          type: string
          minLength: 1
          title: Target Column
        target_label_column:
          anyOf:
            - type: string
            - type: 'null'
          title: Target Label Column
          default: target_label
        split_column:
          type: string
          minLength: 1
          title: Split Column
          default: split
        include_train:
          type: boolean
          title: Include Train
          default: true
        include_val:
          type: boolean
          title: Include Val
          default: true
        include_test:
          type: boolean
          title: Include Test
          default: true
        train_ratio:
          type: number
          exclusiveMinimum: 0
          title: Train Ratio
          default: 0.7
        val_ratio:
          type: number
          exclusiveMinimum: 0
          title: Val Ratio
          default: 0.15
        test_ratio:
          type: number
          exclusiveMinimum: 0
          title: Test Ratio
          default: 0.15
        random_state:
          type: integer
          title: Random State
          default: 42
      type: object
      required:
        - target_column
      title: GenerateSplitsRequest
    SplitSummaryResponse:
      properties:
        session_id:
          type: string
          title: Session Id
        row_count:
          type: integer
          title: Row Count
        target_column:
          type: string
          title: Target Column
        target_label_column:
          type: string
          title: Target Label Column
        split_column:
          type: string
          title: Split Column
        splits:
          items:
            type: string
          type: array
          title: Splits
        split_counts:
          additionalProperties:
            type: integer
          type: object
          title: Split Counts
        split_ratios:
          additionalProperties:
            type: number
          type: object
          title: Split Ratios
        overall_target_distribution:
          additionalProperties:
            type: number
          type: object
          title: Overall Target Distribution
        target_distribution_by_split:
          additionalProperties:
            additionalProperties:
              type: number
            type: object
          type: object
          title: Target Distribution By Split
        split_balance:
          additionalProperties:
            additionalProperties:
              type: number
            type: object
          type: object
          title: Split Balance
        balance_quality:
          type: string
          title: Balance Quality
        balance_score:
          type: number
          title: Balance Score
        balance_feedback:
          type: string
          title: Balance Feedback
        worst_split:
          anyOf:
            - type: string
            - type: 'null'
          title: Worst Split
        worst_split_tvd:
          anyOf:
            - type: number
            - type: 'null'
          title: Worst Split Tvd
        worst_split_gap:
          anyOf:
            - type: number
            - type: 'null'
          title: Worst Split Gap
        stratified:
          type: boolean
          title: Stratified
        warning:
          anyOf:
            - type: string
            - type: 'null'
          title: Warning
      type: object
      required:
        - session_id
        - row_count
        - target_column
        - target_label_column
        - split_column
        - splits
        - split_counts
        - split_ratios
        - overall_target_distribution
        - target_distribution_by_split
        - split_balance
        - balance_quality
        - balance_score
        - balance_feedback
        - stratified
      title: SplitSummaryResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````