@@ -143,6 +143,25 @@ export default function BiasSettings({
143143 } ;
144144
145145 const onSubmit = ( data : z . infer < typeof FormSchema > ) => {
146+ // Check if data type matches the actual data
147+ const isNumericData = data . data . every ( row => {
148+ return ! isNaN ( parseFloat ( row [ data . targetColumn ] ) ) ;
149+ } ) ;
150+
151+ if ( data . dataType === 'numeric' && ! isNumericData ) {
152+ setPerformanceMetricColumnError (
153+ t ( 'biasSettings.form.errors.numericDataRequired' )
154+ ) ;
155+ return ;
156+ }
157+
158+ if ( data . dataType === 'categorical' && isNumericData ) {
159+ setPerformanceMetricColumnError (
160+ t ( 'biasSettings.form.errors.categoricalDataRequired' )
161+ ) ;
162+ return ;
163+ }
164+
146165 onRun ( {
147166 clusterSize : clusters [ 0 ] ,
148167 iterations : iter [ 0 ] ,
@@ -259,6 +278,55 @@ export default function BiasSettings({
259278 ) }
260279 />
261280 </ div >
281+ < div className = "grid gap-3" >
282+ < FormField
283+ control = { form . control }
284+ name = "dataType"
285+ disabled = { isLoading }
286+ render = { ( { field } ) => (
287+ < FormItem >
288+ < FormLabel >
289+ { t (
290+ 'biasSettings.form.fieldsets.data.dataType'
291+ ) }
292+ </ FormLabel >
293+ < RadioGroup
294+ onValueChange = { field . onChange }
295+ defaultValue = { field . value }
296+ key = { `${ dataKey } _dataType` }
297+ className = "flex flex-col space-y-1"
298+ >
299+ < FormItem className = "flex items-center space-x-3 space-y-0" >
300+ < FormControl >
301+ < RadioGroupItem
302+ value = "categorical"
303+ disabled = { isLoading }
304+ />
305+ </ FormControl >
306+ < FormLabel className = "font-normal" >
307+ { t (
308+ 'biasSettings.form.fieldsets.data.categoricalData'
309+ ) }
310+ </ FormLabel >
311+ </ FormItem >
312+ < FormItem className = "flex items-center space-x-3 space-y-0" >
313+ < FormControl >
314+ < RadioGroupItem
315+ value = "numeric"
316+ disabled = { isLoading }
317+ />
318+ </ FormControl >
319+ < FormLabel className = "font-normal" >
320+ { t (
321+ 'biasSettings.form.fieldsets.data.numericalData'
322+ ) }
323+ </ FormLabel >
324+ </ FormItem >
325+ </ RadioGroup >
326+ </ FormItem >
327+ ) }
328+ />
329+ </ div >
262330 </ fieldset >
263331
264332 < fieldset className = "grid gap-6 rounded-lg border p-4" >
0 commit comments