|
1 | 1 | <script lang="ts"> |
2 | 2 | // Implement Theme CHanger BY |
3 | 3 | // Changing the html tag data-theme attribute on each select menu click |
4 | | - import { af_enum } from "./NN_classes.ts"; |
| 4 | + import { af_enum, cNeuron, Layer } from "./NN_classes.ts"; |
5 | 5 | import { |
6 | 6 | hiddenLayersCount_store, |
7 | 7 | hiddenLayersNeuronCount_store, |
8 | 8 | selActivaFn_store, |
9 | 9 | randomisedVals_store, |
| 10 | + hidOutLayers_store, |
| 11 | + currentNeuron_store, |
10 | 12 | } from "../store.ts"; |
11 | | - import { setPreference } from "../../lib/db/localStorage.ts"; |
| 13 | + import { |
| 14 | + deleteEverything, |
| 15 | + setPreference, |
| 16 | + } from "../../lib/db/localStorage.ts"; |
12 | 17 | import { onMount } from "svelte"; |
13 | 18 |
|
14 | 19 | let loading = $state(true); |
|
44 | 49 | activationFns.find((fn) => fn.name == $selActivaFn_store)?.theme || "", |
45 | 50 | ); |
46 | 51 | }); |
| 52 | +
|
| 53 | + function resetAllParams() { |
| 54 | + deleteEverything(); |
| 55 | + $hiddenLayersNeuronCount_store = [1]; |
| 56 | + $hiddenLayersCount_store = 1; |
| 57 | + $selActivaFn_store = af_enum.relu; |
| 58 | + $randomisedVals_store = false; |
| 59 | + $hidOutLayers_store.map((layer) => { |
| 60 | + layer.neurons.map((neuron) => { |
| 61 | + neuron.bias = 0; |
| 62 | + neuron.weights.map((weight) => { |
| 63 | + weight = 0; |
| 64 | + }); |
| 65 | + }); |
| 66 | + }); |
| 67 | + $currentNeuron_store = new cNeuron(0, 0); |
| 68 | + } |
47 | 69 | </script> |
48 | 70 |
|
49 | 71 | <div |
50 | | - class="mx-auto w-max rounded-btn grid sm:grid-cols-3 grid-cols-2 sm:gap-12 gap-5 mb-4 *:flex *:flex-col *:justify-between *:h-full *:gap-2" |
| 72 | + class="mx-auto w-max rounded-btn grid sm:grid-cols-4 grid-cols-2 sm:gap-12 gap-5 gap-x-12 mb-4 *:flex *:flex-col *:justify-between *:h-full *:gap-2" |
51 | 73 | > |
52 | | - <div class=""> |
| 74 | + <div class="items-end"> |
53 | 75 | <p class="text-gray-400 text-sm">Hidden layers</p> |
54 | 76 | <div class="relative1 max-w-xs text-gray-300"> |
55 | 77 | <div |
|
141 | 163 | </ul> |
142 | 164 | </div> |
143 | 165 | </div> |
144 | | - <div class=" "> |
| 166 | + <div class="sm:items-center items-end"> |
145 | 167 | <p class="text-gray-400 text-sm">Randomised?</p> |
146 | 168 | <input |
147 | 169 | type="checkbox" |
148 | 170 | class="toggle toggle-lg w-16 h-8" |
149 | 171 | bind:checked={$randomisedVals_store} |
150 | 172 | /> |
151 | 173 | </div> |
| 174 | + <div> |
| 175 | + <p class="text-gray-400 text-sm">Reset All Params</p> |
| 176 | + <button aria-label="Reset" class="btn" onclick={resetAllParams}> |
| 177 | + <div class="i-tabler:reload size-7"></div> |
| 178 | + </button> |
| 179 | + </div> |
152 | 180 | </div> |
0 commit comments