Skip to content

Commit f2c7964

Browse files
committed
Added some filtering and mathjax
1 parent 5f406c8 commit f2c7964

2 files changed

Lines changed: 45 additions & 4 deletions

File tree

src/analysis-breakdown.md

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,29 @@ const filters = view(Inputs.form({
8989
``` -->
9090

9191
```js
92-
const filters = Inputs.form()
92+
const algo_filters = view(Inputs.form({
93+
94+
//branching_capable: Inputs.toggle(
95+
// {
96+
// label: "Capable of branching execution",
97+
// value: false
98+
// }
99+
//),
100+
acceptable_separability: Inputs.checkbox(
101+
["fully", "iterative", "none"],
102+
{
103+
label: "Acceptable separability",
104+
value: ["fully"]
105+
}
106+
),
107+
acceptableCommunicationDirection: Inputs.checkbox(
108+
["client to aggregator", "bidirectional"],
109+
{
110+
label: "Acceptable communication directions",
111+
value: ["client to aggregator"]
112+
}
113+
),
114+
}));
93115
```
94116

95117
```js
@@ -99,6 +121,21 @@ const algorithmList = algorithms.map(
99121
algo.addObservables(observableData);
100122
return algo
101123
}
124+
).filter(
125+
d => {
126+
// Separability check
127+
if (!algo_filters.acceptable_separability.includes(d.separability)){
128+
return false;
129+
};
130+
// Branching execution - not relevant until I have examples
131+
//if (d.requiresBranching && !algo_filters.branching_capable){
132+
// return false;
133+
//};
134+
if (!algo_filters.acceptableCommunicationDirection.includes(d.communicationDirection)){
135+
return false;
136+
};
137+
return true;
138+
}
102139
);
103140

104141
const statisticsList = statistics.map(
@@ -110,9 +147,11 @@ const statisticsList = statistics.map(
110147
return stat
111148
}
112149
}
113-
);
150+
).filter(stat => stat != null);
114151
```
115152

153+
There are ${statisticsList.length} compatible statistics, implemented with ${algorithmList.length} total algorithms.
154+
116155
```js
117156
html`${statisticsList.map(stat => stat ? stat.display(): "")}`
118157
```

src/components/display_statistic.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ export class Algorithm {
226226
this.mathjax = algorithmField.mathjax;
227227
this.communicationRounds = algorithmField.communication_rounds;
228228
this.adaptiveRounds = algorithmField.adaptive_rounds === "true";
229-
this.communicationDirection = algorithmField.communication_direction.replace("_", " ");
229+
this.communicationDirection = algorithmField.communication_direction.replaceAll("_", " ");
230230
this.requiresBranching = algorithmField.requires_branching === "true";
231231
this.requiresPersistence = algorithmField.requires_persistence === "true";
232232
this.differentialPrivacy = algorithmField.differential_privacy;
@@ -357,9 +357,11 @@ export class Algorithm {
357357
${getSeparabilityString(this.separability)}
358358
</span>
359359
</div>
360-
360+
361361
<p style="color: #4b5563; margin: 0.5rem 0 1rem 0; font-size: 0.95rem;">${this.description}</p>
362362
363+
${htmlUnsafe(marked.parse(this.mathjax))}
364+
363365
<div style="
364366
display: flex;
365367
flex-wrap: wrap;

0 commit comments

Comments
 (0)