-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopulation.ts
39 lines (35 loc) · 1.3 KB
/
population.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { getAllModels, Model } from "./model";
import { CalibrationMethod } from "./calibrate";
export class Population {
population: ModelPopulation[] = [];
constructor() {
this.population = [];
}
public addModel(model: Model, repetitions: number, calibrationMethod: CalibrationMethod) {
let currentRepetitions = this.population.find((m) => m.model === model)?.repetitions;
if (currentRepetitions) {
repetitions += currentRepetitions;
}
else {
this.population.push({ model, repetitions, calibrationMethod });
}
}
public addAllModels(repetitions: number, calibrationMethod: CalibrationMethod) {
for (let model of getAllModels()) {
this.addModel(model as Model, repetitions, calibrationMethod);
}
}
public addStrongModels(repetitions: number, calibrationMethod: CalibrationMethod) {
this.addModel(Model.GPT4, repetitions, calibrationMethod);
this.addModel(Model.CLAUDE_OPUS, repetitions, calibrationMethod);
this.addModel(Model.GEMINI_PRO, repetitions, calibrationMethod);
}
public get(): ModelPopulation[] {
return this.population;
}
}
type ModelPopulation = {
model: Model;
repetitions: number;
calibrationMethod: CalibrationMethod;
}