Skip to content

Commit

Permalink
Tuning/Validation updates to GUI.
Browse files Browse the repository at this point in the history
  • Loading branch information
gjwgit committed Jan 14, 2025
1 parent 9fd6dd2 commit a5cded7
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 4 deletions.
40 changes: 37 additions & 3 deletions lib/features/evaluate/config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import 'package:rattle/constants/spacing.dart';
import 'package:rattle/constants/style.dart';
import 'package:rattle/providers/evaluate.dart';
import 'package:rattle/providers/page_controller.dart';
import 'package:rattle/providers/settings.dart';
import 'package:rattle/r/source.dart';
import 'package:rattle/utils/check_function_executed.dart';
import 'package:rattle/widgets/activity_button.dart';
Expand Down Expand Up @@ -218,6 +219,7 @@ class EvaluateConfigState extends ConsumerState<EvaluateConfig> {
final templateMap = {
'Training': 'evaluate_template_tr',
'Tuning': 'evaluate_template_tu',
'Validation': 'evaluate_template_tu',
'Testing': 'evaluate_template_te',
'Complete': 'evaluate_template_tc',
};
Expand Down Expand Up @@ -430,10 +432,42 @@ class EvaluateConfigState extends ConsumerState<EvaluateConfig> {
children: [
configLeftGap,
Text('Evaluation Dataset: '),
// Widget to display dataset type selection as choice chips with tooltips.

ChoiceChipTip<String>(
options: datasetTypes.keys.toList(),
selectedOption: datasetType,
tooltips: datasetTypes,
// Generate list of dataset type options, replacing 'Tuning' with 'Validation'
// if validation setting is enabled.

options: datasetTypes.keys
.map(
(key) => key == 'Tuning' &&
ref.watch(useValidationSettingProvider)
? 'Validation'
: key,
)
.toList(),
// Set selected option, handling Tuning/Validation text swap.

selectedOption: datasetType == 'Tuning' &&
ref.watch(useValidationSettingProvider)
? 'Validation'
: datasetType,
// Create tooltips map, replacing 'Tuning' key with 'Validation'
// when validation is enabled.

tooltips: Map.fromEntries(
datasetTypes.entries.map(
(entry) => MapEntry(
entry.key == 'Tuning' &&
ref.watch(useValidationSettingProvider)
? 'Validation'
: entry.key,
entry.value,
),
),
),
// Handle selection changes by updating state and provider.

onSelected: (chosen) {
setState(() {
if (chosen != null) {
Expand Down
5 changes: 4 additions & 1 deletion lib/features/evaluate/display.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/// License: GNU General Public License, Version 3 (the "License")
/// https://www.gnu.org/licenses/gpl-3.0.en.html
//
// Time-stamp: <Sunday 2025-01-05 21:23:01 +1100 Graham Williams>
// Time-stamp: <Tuesday 2025-01-14 13:27:09 +1100 Graham Williams>
//
// This program is free software: you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
Expand All @@ -32,6 +32,7 @@ import 'package:rattle/constants/markdown.dart';
import 'package:rattle/constants/temp_dir.dart';
import 'package:rattle/providers/evaluate.dart';
import 'package:rattle/providers/page_controller.dart';
import 'package:rattle/providers/settings.dart';
import 'package:rattle/providers/stdout.dart';
import 'package:rattle/r/extract_evaluate.dart';
import 'package:rattle/utils/image_exists.dart';
Expand Down Expand Up @@ -60,6 +61,8 @@ class _EvaluateDisplayState extends ConsumerState<EvaluateDisplay> {
String stdout = ref.watch(stdoutProvider);

String datasetType = ref.watch(datasetTypeProvider).toUpperCase();
bool useV = ref.watch(useValidationSettingProvider);
if (datasetType == 'Tuning' && useV) datasetType = 'Validation';

List<Widget> pages = [showMarkdownFile(context, evaluateIntroFile)];

Expand Down

0 comments on commit a5cded7

Please sign in to comment.