Sha256: 3e0210ccbd9bf9b1ca3c754c4128a89d14e2c8ba9fd277e98a6724010e16c679

Contents?: true

Size: 1.94 KB

Versions: 51

Compression:

Stored size: 1.94 KB

Contents

import React from 'react';
import { SearchableSelect } from '../../SearchableSelect';

interface KFoldSplitterProps {
  type: 'kfold' | 'stratified' | 'group';
  targetColumn?: string;
  groupColumn?: string;
  nSplits: number;
  columns: Array<{ name: string; type: string }>;
  onChange: (config: {
    targetColumn?: string;
    groupColumn?: string;
    nSplits: number;
  }) => void;
}

export function KFoldSplitter({
  type,
  targetColumn,
  groupColumn,
  nSplits,
  columns,
  onChange
}: KFoldSplitterProps) {
  return (
    <div className="space-y-4">
      {(type === 'stratified' || type === 'group') && (
        <div>
          <label className="block text-sm font-medium text-gray-700 mb-1">
            {type === 'stratified' ? 'Target Column' : 'Group Column'}
          </label>
          <SearchableSelect
            options={columns.map(col => ({
              value: col.name,
              label: col.name,
              description: `Type: ${col.type}`
            }))}
            value={type === 'stratified' ? targetColumn : groupColumn}
            onChange={(value) => onChange({
              targetColumn: type === 'stratified' ? value as string : targetColumn,
              groupColumn: type === 'group' ? value as string : groupColumn,
              nSplits
            })}
            placeholder={`Select ${type === 'stratified' ? 'target' : 'group'} column...`}
          />
        </div>
      )}

      <div>
        <label className="block text-sm font-medium text-gray-700 mb-1">
          Number of Splits
        </label>
        <input
          type="number"
          min={2}
          max={10}
          value={nSplits}
          onChange={(e) => onChange({
            targetColumn,
            groupColumn,
            nSplits: parseInt(e.target.value) || 2
          })}
          className="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"
        />
      </div>
    </div>
  );
}

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
easy_ml-0.2.0.pre.rc52 app/frontend/components/dataset/splitters/KFoldSplitter.tsx
easy_ml-0.2.0.pre.rc51 app/frontend/components/dataset/splitters/KFoldSplitter.tsx
easy_ml-0.2.0.pre.rc50 app/frontend/components/dataset/splitters/KFoldSplitter.tsx
easy_ml-0.2.0.pre.rc49 app/frontend/components/dataset/splitters/KFoldSplitter.tsx
easy_ml-0.2.0.pre.rc48 app/frontend/components/dataset/splitters/KFoldSplitter.tsx
easy_ml-0.2.0.pre.rc47 app/frontend/components/dataset/splitters/KFoldSplitter.tsx
easy_ml-0.2.0.pre.rc46 app/frontend/components/dataset/splitters/KFoldSplitter.tsx
easy_ml-0.2.0.pre.rc45 app/frontend/components/dataset/splitters/KFoldSplitter.tsx
easy_ml-0.2.0.pre.rc44 app/frontend/components/dataset/splitters/KFoldSplitter.tsx
easy_ml-0.2.0.pre.rc43 app/frontend/components/dataset/splitters/KFoldSplitter.tsx
easy_ml-0.2.0.pre.rc41 app/frontend/components/dataset/splitters/KFoldSplitter.tsx
easy_ml-0.2.0.pre.rc40 app/frontend/components/dataset/splitters/KFoldSplitter.tsx
easy_ml-0.2.0.pre.rc39 app/frontend/components/dataset/splitters/KFoldSplitter.tsx
easy_ml-0.2.0.pre.rc38 app/frontend/components/dataset/splitters/KFoldSplitter.tsx
easy_ml-0.2.0.pre.rc37 app/frontend/components/dataset/splitters/KFoldSplitter.tsx
easy_ml-0.2.0.pre.rc36 app/frontend/components/dataset/splitters/KFoldSplitter.tsx
easy_ml-0.2.0.pre.rc35 app/frontend/components/dataset/splitters/KFoldSplitter.tsx
easy_ml-0.2.0.pre.rc34 app/frontend/components/dataset/splitters/KFoldSplitter.tsx
easy_ml-0.2.0.pre.rc33 app/frontend/components/dataset/splitters/KFoldSplitter.tsx
easy_ml-0.2.0.pre.rc32 app/frontend/components/dataset/splitters/KFoldSplitter.tsx