UNPKG

federer

Version:

Experiments in asynchronous federated learning and decentralized learning

58 lines 2.35 kB
import { DataSubsetFilepaths } from "../../common"; import { DataDistributionStats } from "./distribution-stats"; export interface PreprocessedDataPathsJSON { testSetFiles: DataSubsetFilepaths; clientTrainFiles: DataSubsetFilepaths[]; dataDistribution: { [K in keyof DataDistributionStats]: string; }; } /** * We cache the results of preprocessing in files. * * This class represents the contents of the JSON file. The JSON file should be * saved with relative paths, so that it is portable (i.e. can be generated * locally, but used in a Docker container or another machine). */ declare abstract class PreprocessedDataPaths { readonly json: PreprocessedDataPathsJSON; constructor(json: PreprocessedDataPathsJSON); protected checkAbsolute(): boolean; protected checkRelative(): boolean; /** * Returns JSON string representation of the object. * @param pretty Whether to return pretty-printed JSON (indented) */ protected getJSON(pretty?: boolean): string; /** * Map values in this object to new values, using the given mapping function. * * @param fn Mapping function * @returns Object with values that are the result of applying `fn` to the * current object's values. */ protected mapValues(fn: (filepath: string) => string): PreprocessedDataPathsJSON; /** * Returns whether a given predicate holds for all values in this object. * * @param predicate Function returning a boolean indicating whether the * condition to check holds. * * @returns `true` if `predicate` returns `true` on all values in the object, * `false` if it returns `false` on at least one value. */ protected every(predicate: (filepath: string) => boolean): boolean; } export declare class AbsoluteDataPaths extends PreprocessedDataPaths { constructor(json: PreprocessedDataPathsJSON); toRelative(parentDir: string): RelativeDataPaths; } export declare class RelativeDataPaths extends PreprocessedDataPaths { private readonly rootDir; constructor(json: PreprocessedDataPathsJSON, rootDir: string); toAbsolute(): AbsoluteDataPaths; static load(filepath: string): Promise<RelativeDataPaths>; save(filepath: string): Promise<void>; } export {}; //# sourceMappingURL=PreprocessedDataPaths.d.ts.map