thibaud frere commited on
Commit
0c262e2
·
1 Parent(s): 9a962ce

update color palette load

Browse files
app/{src → public}/scripts/color-palettes.js RENAMED
File without changes
app/src/components/Palettes.astro CHANGED
@@ -80,7 +80,7 @@ const rootId = `palettes-${Math.random().toString(36).slice(2)}`;
80
  </div>
81
  </div>
82
  <script type="module" is:inline>
83
- import '/src/scripts/color-palettes.js';
84
  const ROOT_ID = "{rootId}";
85
  (() => {
86
  const cards = [
 
80
  </div>
81
  </div>
82
  <script type="module" is:inline>
83
+ import '/scripts/color-palettes.js';
84
  const ROOT_ID = "{rootId}";
85
  (() => {
86
  const cards = [
app/src/components/TrackioWrapper.astro CHANGED
@@ -20,11 +20,11 @@ import Trackio from './trackio/Trackio.svelte';
20
  </div>
21
  <div class="scale-controls">
22
  <label>
23
- <input type="checkbox" id="log-scale-x">
24
  Log Scale X
25
  </label>
26
  <label>
27
- <input type="checkbox" id="smooth-data">
28
  Smooth
29
  </label>
30
  </div>
@@ -35,7 +35,7 @@ import Trackio from './trackio/Trackio.svelte';
35
  </div>
36
 
37
  <div class="trackio-container">
38
- <Trackio client:load variant="classic" />
39
  </div>
40
  </div>
41
 
@@ -111,6 +111,25 @@ import Trackio from './trackio/Trackio.svelte';
111
  }
112
  });
113
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  // Randomize data handler - now uses the store
115
  randomizeBtn.addEventListener('click', () => {
116
  console.log('Randomize button clicked - triggering jitter via store'); // Debug log
 
20
  </div>
21
  <div class="scale-controls">
22
  <label>
23
+ <input type="checkbox" id="log-scale-x" checked>
24
  Log Scale X
25
  </label>
26
  <label>
27
+ <input type="checkbox" id="smooth-data" checked>
28
  Smooth
29
  </label>
30
  </div>
 
35
  </div>
36
 
37
  <div class="trackio-container">
38
+ <Trackio client:load variant="classic" logScaleX={true} smoothing={true} />
39
  </div>
40
  </div>
41
 
 
111
  }
112
  });
113
 
114
+ // Initialize with default checked states
115
+ setTimeout(() => {
116
+ if (logScaleXCheckbox.checked) {
117
+ const trackioEl = trackioContainer.querySelector('.trackio');
118
+ if (trackioEl && trackioEl.__trackioInstance) {
119
+ console.log('Initializing with log scale X enabled');
120
+ trackioEl.__trackioInstance.setLogScaleX(true);
121
+ }
122
+ }
123
+
124
+ if (smoothDataCheckbox.checked) {
125
+ const trackioEl = trackioContainer.querySelector('.trackio');
126
+ if (trackioEl && trackioEl.__trackioInstance) {
127
+ console.log('Initializing with smoothing enabled');
128
+ trackioEl.__trackioInstance.setSmoothing(true);
129
+ }
130
+ }
131
+ }, 100); // Small delay to ensure Trackio is fully loaded
132
+
133
  // Randomize data handler - now uses the store
134
  randomizeBtn.addEventListener('click', () => {
135
  console.log('Randomize button clicked - triggering jitter via store'); // Debug log
app/src/components/trackio/Trackio.svelte CHANGED
@@ -66,7 +66,13 @@
66
  else wantRuns = 6; // 5% chance
67
  const runsSim = generateRunNames(wantRuns);
68
  const rnd = (min,max)=> Math.floor(min + Math.random()*(max-min+1));
69
- let stepsCount = rnd(80, 240); // Random number of steps
 
 
 
 
 
 
70
  const steps = Array.from({length: stepsCount}, (_,i)=> i+1);
71
  const nextByMetric = new Map();
72
  const TARGET_METRICS = ['epoch', 'train_accuracy', 'train_loss', 'val_accuracy', 'val_loss'];
@@ -193,9 +199,19 @@
193
  else wantRuns = 6; // 5% chance
194
  const runsSim = generateRunNames(wantRuns);
195
  const rnd = (min,max)=> Math.floor(min + Math.random()*(max-min+1));
196
- let stepsCount = 16;
197
- if (cycleIdx === 0) stepsCount = rnd(4, 12); else if (cycleIdx === 1) stepsCount = rnd(16, 48); else stepsCount = rnd(80, 240);
198
- cycleIdx = (cycleIdx + 1) % 3;
 
 
 
 
 
 
 
 
 
 
199
  const steps = Array.from({length: stepsCount}, (_,i)=> i+1);
200
  const nextByMetric = new Map();
201
  const TARGET_METRICS = ['epoch', 'train_accuracy', 'train_loss', 'val_accuracy', 'val_loss'];
 
66
  else wantRuns = 6; // 5% chance
67
  const runsSim = generateRunNames(wantRuns);
68
  const rnd = (min,max)=> Math.floor(min + Math.random()*(max-min+1));
69
+
70
+ // Random number of steps with rare chance of very few steps
71
+ let stepsCount;
72
+ const stepsRand = Math.random();
73
+ if (stepsRand < 0.05) stepsCount = rnd(5, 15); // 5% chance - très peu de steps
74
+ else if (stepsRand < 0.1) stepsCount = rnd(16, 30); // 5% chance - peu de steps
75
+ else stepsCount = rnd(80, 240); // 90% chance - normal
76
  const steps = Array.from({length: stepsCount}, (_,i)=> i+1);
77
  const nextByMetric = new Map();
78
  const TARGET_METRICS = ['epoch', 'train_accuracy', 'train_loss', 'val_accuracy', 'val_loss'];
 
199
  else wantRuns = 6; // 5% chance
200
  const runsSim = generateRunNames(wantRuns);
201
  const rnd = (min,max)=> Math.floor(min + Math.random()*(max-min+1));
202
+
203
+ // Random number of steps with rare chance of very few steps
204
+ let stepsCount;
205
+ const stepsRand = Math.random();
206
+ if (stepsRand < 0.05) stepsCount = rnd(5, 15); // 5% chance - très peu de steps
207
+ else if (stepsRand < 0.1) stepsCount = rnd(16, 30); // 5% chance - peu de steps
208
+ else {
209
+ // Use original cycling logic for normal cases
210
+ if (cycleIdx === 0) stepsCount = rnd(4, 12);
211
+ else if (cycleIdx === 1) stepsCount = rnd(16, 48);
212
+ else stepsCount = rnd(80, 240);
213
+ cycleIdx = (cycleIdx + 1) % 3;
214
+ }
215
  const steps = Array.from({length: stepsCount}, (_,i)=> i+1);
216
  const nextByMetric = new Map();
217
  const TARGET_METRICS = ['epoch', 'train_accuracy', 'train_loss', 'val_accuracy', 'val_loss'];
app/src/pages/index.astro CHANGED
@@ -143,7 +143,7 @@ const licence = (articleFM as any)?.licence ?? (articleFM as any)?.license ?? (a
143
  } catch {}
144
  })();
145
  </script>
146
- <script type="module" src="/src/scripts/color-palettes.js"></script>
147
 
148
  <!-- TO MANAGE PROPERLY -->
149
  <script src="https://cdn.plot.ly/plotly-3.0.0.min.js" charset="utf-8"></script>
 
143
  } catch {}
144
  })();
145
  </script>
146
+ <script type="module" src="/scripts/color-palettes.js"></script>
147
 
148
  <!-- TO MANAGE PROPERLY -->
149
  <script src="https://cdn.plot.ly/plotly-3.0.0.min.js" charset="utf-8"></script>