federer
Version:
Experiments in asynchronous federated learning and decentralized learning
59 lines • 2.55 kB
TypeScript
import AwaitLock from "await-lock";
import { Logger } from "winston";
import { RoundResults, StopCondition } from "./Coordinator";
import { CoordinatorOptions } from "./options/coordinator";
import { IPCServer } from "./network/IPCServer";
/**
* Models the result of a completed experiment run.
*
* A run consists of the particular coordinator options that were used, and of
* the {@link RoundResults} of the best round.
*
* @typeParam Options - The type of coordinator options with which we ran the
* experiment.
*/
export declare class ExperimentResults<Options extends CoordinatorOptions> {
readonly options: Readonly<Options>;
readonly results?: Readonly<RoundResults> | undefined;
constructor(options: Readonly<Options>, results?: Readonly<RoundResults> | undefined);
betterThan(that: ExperimentResults<Options>): boolean;
toJSON(): ExperimentResultsJSON<Options>;
}
interface ExperimentResultsJSON<Options extends CoordinatorOptions> {
readonly options: Readonly<Options>;
readonly results?: Readonly<RoundResults>;
}
/** Object describing when an experiment should be stopped. */
export interface ExperimentStopOptions {
/** The accuracy at which we can stop the experiment. */
targetAccuracy: number;
/**
* The max number of epochs to run; if we don't hit the `targetAccuracy`, we
* will stop after `maxEpochs` epochs have run.
*/
maxEpochs: number;
}
/**
* Abstract class defining the boilerplate for how to run grid search.
* Concrete subclasses must define how to run a single experiment.
*/
export declare abstract class GridSearch<Options extends CoordinatorOptions> {
protected readonly stopOptions: Readonly<ExperimentStopOptions>;
protected readonly searchSpace: Options[];
bestResults: ExperimentResults<Options>;
protected runLock: AwaitLock;
constructor(stopOptions: Readonly<ExperimentStopOptions>, searchSpace: Options[]);
/** Run grid search. Returns a Promise of the best results. */
run(): Promise<ExperimentResults<Options>>;
/**
* Run a single run of an experiment, with given options.
*
* @param options The specific options with which to run the experiment
* @param stopCondition The stop condition, indicating when the experiment can
* be stopped
*/
protected abstract runExperiment(options: Options, ipc: IPCServer, logger: Logger, stopCondition: StopCondition): Promise<ExperimentResults<Options>>;
private writeBestResults;
}
export {};
//# sourceMappingURL=grid-search.d.ts.map