Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabled training page tabs when knn model is disabled #507

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/pages/training/KnnModelTrainingPageView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
{#if $filters.length == 2}
<KnnModelGraph />
{:else}
<div class="m-auto">
<div class="max-w-[450px] flex flex-col justify-center">
<p class="max-w-80 text-md font-bold text-center">
{$t('menu.trainer.knn.onlyTwoFilters')}
</p>
Expand Down
7 changes: 6 additions & 1 deletion src/pages/training/TrainingPageModelView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,16 @@
import KnnModelTrainingPageView from './KnnModelTrainingPageView.svelte';
import ModelRegistry from '../../script/domain/ModelRegistry';
import NeuralNetworkTrainingPageView from './NeuralNetworkTrainingPageView.svelte';
import { Feature, hasFeature } from '../../script/FeatureToggles';

const showFilterList = hasFeature(Feature.KNN_MODEL);
</script>

<div class="flex flex-col h-full justify-center">
<div class="flex flex-row p-2">
<FiltersList />
{#if showFilterList}
<FiltersList />
{/if}
{#if $selectedModel.id === ModelRegistry.KNN.id}
<KnnModelTrainingPageView />
{:else if $selectedModel.id === ModelRegistry.NeuralNetwork.id}
Expand Down
69 changes: 48 additions & 21 deletions src/pages/training/TrainingPageTabs.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,18 @@
SPDX-License-Identifier: MIT
-->
<script lang="ts">
import StandardButton from '../../components/buttons/StandardButton.svelte';
import ControlBar from '../../components/control-bar/ControlBar.svelte';
import { navigate, Paths } from '../../router/paths';
import ModelRegistry from '../../script/domain/ModelRegistry';
import { Feature, hasFeature } from '../../script/FeatureToggles';
import { selectedModel } from '../../script/stores/uiStore';
import { t } from '../../i18n';

const showTabBar = hasFeature(Feature.KNN_MODEL);
if (!showTabBar) {
$selectedModel = ModelRegistry.NeuralNetwork;
}

const onSelectNeuralNetwork = () => {
$selectedModel = ModelRegistry.NeuralNetwork;
Expand All @@ -19,25 +28,43 @@
};
</script>

<ControlBar expanded shadows={false}>
<div class="flex flex-row flex-grow h-full">
<!--Left controlbar-->
<div
on:click={onSelectNeuralNetwork}
class:to-secondary={isSelected('NN')}
class:to-primary={!isSelected('NN')}
class:shadow-md={!isSelected('NN')}
class="flex flex-col border-l-2 border-b-2 border-secondary justify-center cursor-pointer h-full self-center flex-1 bg-gradient-to-r via-primary from-primary text-secondarytext">
<p class="text-center font-bold">Neural Network</p>
</div>
<!--Right controlbar-->
<div
on:click={onSelectKnn}
class:to-secondary={isSelected('KNN')}
class:to-primary={!isSelected('KNN')}
class:shadow-md={!isSelected('KNN')}
class="flex border-r-2 border-b-2 border-secondary flex-col justify-center cursor-pointer h-full self-center flex-1 bg-gradient-to-l via-primary from-primary text-secondarytext">
<p class="text-center font-bold">KNN Model</p>
{#if showTabBar}
<ControlBar expanded shadows={false}>
<div class="flex flex-row flex-grow h-full">
<!--Left controlbar-->
<div
on:click={onSelectNeuralNetwork}
class:to-secondary={isSelected('NN')}
class:to-primary={!isSelected('NN')}
class:shadow-md={!isSelected('NN')}
class="flex flex-col border-l-2 border-b-2 border-secondary justify-center cursor-pointer h-full self-center flex-1 bg-gradient-to-r via-primary from-primary text-secondarytext">
<p class="text-center font-bold">Neural Network</p>
</div>
<!--Right controlbar-->
<div
on:click={onSelectKnn}
class:to-secondary={isSelected('KNN')}
class:to-primary={!isSelected('KNN')}
class:shadow-md={!isSelected('KNN')}
class="flex border-r-2 border-b-2 border-secondary flex-col justify-center cursor-pointer h-full self-center flex-1 bg-gradient-to-l via-primary from-primary text-secondarytext">
<p class="text-center font-bold">KNN Model</p>
</div>
</div>
</div>
</ControlBar>
</ControlBar>
{:else}
<ControlBar>
<div class="min-h-12" />
<StandardButton
fillOnHover
small
outlined
bold={false}
shadows={false}
color={'primary'}
onClick={() => {
navigate(Paths.FILTERS);
}}>
{$t('content.trainer.controlbar.filters')}
</StandardButton>
</ControlBar>
{/if}
5 changes: 0 additions & 5 deletions src/script/utils/graphUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,3 @@ export const distanceBetween = (point1: Point3D, point2: Point3D): number => {

return Math.sqrt(squaredDistance);
};

export type LossTrainingIteration = {
loss: number;
epoch: number;
};