public final class ApiExperimentImpl extends Object implements ApiExperiment
Experiment that allows to read/update existing experiment synchronously.| Modifier and Type | Class and Description |
|---|---|
static class |
ApiExperimentImpl.ApiExperimentBuilderImpl
The builder to create properly configured ApiExperiment instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addTag(@NonNull String tag)
Synchronous version that waits for result or exception.
|
static ApiExperimentImpl.ApiExperimentBuilderImpl |
builder()
Returns builder to create
Experiment instance. |
static ApiExperimentImpl.ApiExperimentBuilderImpl |
builder(@NonNull String experimentKey)
Returns builder to create
Experiment instance. |
void |
close() |
void |
end()
Tells Comet that the Experiment is complete and release all associated resources.
|
List<LoggedExperimentAsset> |
getAllAssetList()
Get list of all logged experiment assets.
|
LoggedArtifact |
getArtifact(@NonNull String name)
Allows looking for logged artifact using provided search parameters.
|
LoggedArtifact |
getArtifact(@NonNull String name,
@NonNull String workspace)
Allows looking for logged artifact using provided search parameters.
|
LoggedArtifact |
getArtifact(@NonNull String name,
@NonNull String workspace,
@NonNull String versionOrAlias)
Allows looking for logged artifact using provided search parameters.
|
List<LoggedExperimentAsset> |
getAssetList(@NonNull String type)
Get list of the logged experiment assets with particular type.
|
String |
getExperimentKey()
Get the experiment key returned by Comet.
|
Optional<String> |
getExperimentLink()
Get the experiment link returned by Comet.
|
String |
getExperimentName()
Get experiment name.
|
GitMetaData |
getGitMetadata()
Get experiment git metadata.
|
Optional<String> |
getGraph()
Get experiment graph data.
|
Optional<String> |
getHtml()
Get experiment html.
|
protected abstract org.slf4j.Logger |
getLogger()
Returns logger instance associated with particular experiment.
|
List<Value> |
getLogOther()
Get experiment log other data.
|
ExperimentMetadata |
getMetadata()
Get experiment metadata.
|
List<Value> |
getMetrics()
Get experiment metrics.
|
Optional<String> |
getOutput()
Get experiment output data.
|
List<Value> |
getParameters()
Get experiment parameters.
|
String |
getProjectName()
Get project name of the experiment.
|
List<String> |
getTags()
Get experiment tags.
|
String |
getWorkspaceName()
Get workspace name of the experiment.
|
void |
logCode(File file)
Allows you to report code for the experiment.
|
void |
logCode(@NonNull File file,
@NonNull ExperimentContext context)
Allows you to report code for the experiment.
|
void |
logCode(String code,
String logicalPath)
Allows you to report code for the experiment.
|
void |
logCode(@NonNull String code,
@NonNull String logicalPath,
@NonNull ExperimentContext context)
Allows you to report code for the experiment.
|
void |
logCurve(@NonNull Curve curve) |
void |
logCurve(@NonNull Curve curve,
boolean overwrite) |
void |
logCurve(@NonNull Curve curve,
boolean overwrite,
@NonNull ExperimentContext context)
Allows to log x/y curve into your Comet experiment.
|
void |
logEndTime(long endTimeMillis)
Synchronous version that waits for result or exception.
|
void |
logGitMetadata(GitMetaData gitMetaData)
Synchronous version that waits for result or exception.
|
void |
logGraph(@NonNull String graph)
Synchronous version that waits for result or exception.
|
void |
logHtml(@NonNull String html,
boolean override)
Synchronous version that waits for result or exception.
|
void |
logLine(String line,
long offset,
boolean stderr,
String context)
Synchronous version that waits for result or exception.
|
void |
logMetric(@NonNull String metricName,
@NonNull Object metricValue,
@NonNull ExperimentContext context)
Synchronous version that waits for result or exception.
|
void |
logMetric(String metricName,
Object metricValue,
long step,
long epoch)
Logs a metric with Comet.
|
void |
logOther(@NonNull String key,
@NonNull Object value)
Synchronous version that waits for result or exception.
|
void |
logParameter(String parameterName,
Object paramValue,
ExperimentContext context)
Synchronous version that waits for result or exception.
|
void |
logParameter(String parameterName,
Object paramValue,
long step)
Logs a param with Comet.
|
void |
logStartTime(long startTimeMillis)
Synchronous version that waits for result or exception.
|
void |
logText(String text) |
void |
logText(String text,
@NonNull ExperimentContext context) |
void |
logText(@NonNull String text,
@NonNull ExperimentContext context,
Map<String,Object> metadata)
Allows to log additional textual data associated with Comet Experiment.
|
void |
setExperimentName(@NonNull String experimentName)
Sets the experiment name.
|
void |
uploadAsset(@NonNull File asset,
boolean overwrite,
@NonNull ExperimentContext context)
Upload an asset to be associated with the experiment, for example the trained weights of a neural net.
|
void |
uploadAsset(@NonNull File asset,
boolean overwrite,
long step,
long epoch)
Upload an asset to be associated with the experiment, for example the trained weights of a neural net.
|
void |
uploadAsset(@NonNull File file,
@NonNull String logicalPath,
boolean overwrite,
@NonNull ExperimentContext context)
Upload an asset to be associated with the experiment, for example the trained weights of a neural net.
|
void |
uploadAsset(@NonNull File asset,
String logicalPath,
boolean overwrite,
long step,
long epoch)
Upload an asset to be associated with the experiment, for example the trained weights of a neural net.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddTag, getAllAssetList, getArtifact, getArtifact, getArtifact, getAssetList, getExperimentKey, getGitMetadata, getGraph, getHtml, getLogOther, getMetadata, getMetrics, getOutput, getParameters, getTags, logCode, logCode, logCode, logCode, logCurve, logCurve, logCurve, logEndTime, logGitMetadata, logGraph, logHtml, logLine, logMetric, logMetric, logOther, logParameter, logParameter, logStartTime, logText, logText, logText, setExperimentName, uploadAsset, uploadAsset, uploadAsset, uploadAssetpublic String getWorkspaceName()
ExperimentgetWorkspaceName in interface Experimentpublic String getProjectName()
ExperimentgetProjectName in interface Experimentpublic String getExperimentName()
ExperimentgetExperimentName in interface Experimentpublic Optional<String> getExperimentLink()
ExperimentgetExperimentLink in interface Experimentpublic void end()
Experimentend in interface Experimentpublic void close()
close in interface AutoCloseablepublic static ApiExperimentImpl.ApiExperimentBuilderImpl builder(@NonNull @NonNull String experimentKey)
Experiment instance.experimentKey - the unique identifier of the existing experiment.ApiExperimentBuilder instance.public static ApiExperimentImpl.ApiExperimentBuilderImpl builder()
Experiment instance.ApiExperimentBuilder instance.protected abstract org.slf4j.Logger getLogger()
public String getExperimentKey()
ExperimentgetExperimentKey in interface Experimentpublic void setExperimentName(@NonNull
@NonNull String experimentName)
ExperimentsetExperimentName in interface ExperimentexperimentName - The new name for the experimentpublic void logMetric(@NonNull
@NonNull String metricName,
@NonNull
@NonNull Object metricValue,
@NonNull
@NonNull ExperimentContext context)
logMetric in interface ExperimentmetricName - The name for the metric to be loggedmetricValue - The new value for the metric. If the values for a metric are plottable we will plot themcontext - the context to be associated with the parameter.CometApiException - if received response with failure code.public void logMetric(String metricName, Object metricValue, long step, long epoch)
ExperimentlogMetric in interface ExperimentmetricName - The name for the metric to be loggedmetricValue - The new value for the metric. If the values for a metric are plottable we will plot themstep - The current step for this metric, this will set the given step for this experimentepoch - The current epoch for this metric, this will set the given epoch for this experiment.public void logParameter(String parameterName, Object paramValue, ExperimentContext context)
logParameter in interface ExperimentparameterName - The name of the param being loggedparamValue - The value for the param being loggedcontext - the context to be associated with the parameter.public void logParameter(String parameterName, Object paramValue, long step)
ExperimentlogParameter in interface ExperimentparameterName - The name of the param being loggedparamValue - The value for the param being loggedstep - The current step for this metric, this will set the given step for this experiment.public void logLine(String line, long offset, boolean stderr, String context)
logLine in interface Experimentline - Text to be loggedoffset - Offset describes the place for current text to be insertedstderr - the flag to indicate if this is StdErr message.context - the context to be associated with the parameter.public void logHtml(@NonNull
@NonNull String html,
boolean override)
logHtml in interface Experimenthtml - A block of html to be sent to Cometoverride - Whether previous html sent should be deleted.
If true the old html will be deleted.public void logOther(@NonNull
@NonNull String key,
@NonNull
@NonNull Object value)
logOther in interface Experimentkey - The key for the data to be storedvalue - The value for said keypublic void addTag(@NonNull
@NonNull String tag)
addTag in interface Experimenttag - The tag to be addedpublic void logGraph(@NonNull
@NonNull String graph)
logGraph in interface Experimentgraph - The graph to be logged.public void logStartTime(long startTimeMillis)
logStartTime in interface ExperimentstartTimeMillis - When you want to say that the experiment startedpublic void logEndTime(long endTimeMillis)
logEndTime in interface ExperimentendTimeMillis - When you want to say that the experiment endedpublic void logGitMetadata(GitMetaData gitMetaData)
logGitMetadata in interface ExperimentgitMetaData - The Git Metadata for the experiment.public void logCode(@NonNull
@NonNull String code,
@NonNull
@NonNull String logicalPath,
@NonNull
@NonNull ExperimentContext context)
ExperimentlogCode in interface Experimentcode - Code to be sent to CometlogicalPath - Name of source file to be displayed on UI 'code' tabcontext - the context to be associated with the asset.public void logCode(String code, String logicalPath)
ExperimentlogCode in interface Experimentcode - Code to be sent to CometlogicalPath - Name of source file to be displayed on UI 'code' tabpublic void logCode(@NonNull
@NonNull File file,
@NonNull
@NonNull ExperimentContext context)
ExperimentlogCode in interface Experimentfile - Asset with source code to be sentcontext - the context to be associated with the asset.public void logCode(File file)
ExperimentlogCode in interface Experimentfile - Asset with source code to be sentpublic void logText(@NonNull
@NonNull String text,
@NonNull
@NonNull ExperimentContext context,
Map<String,Object> metadata)
ExperimentlogText in interface Experimenttext - the text data to be logged.context - the current experiment context to be associated.metadata - the additional metadata for the text.public void logText(String text, @NonNull @NonNull ExperimentContext context)
logText in interface Experimentpublic void logText(String text)
logText in interface Experimentpublic void logCurve(@NonNull
@NonNull Curve curve,
boolean overwrite,
@NonNull
@NonNull ExperimentContext context)
ExperimentlogCurve in interface Experimentcurve - the Curve object holding the data points.overwrite - allows to override the previously logged curve with the same name.context - the experiment context to be associated with data record (step, epoch, context ID).public void logCurve(@NonNull
@NonNull Curve curve,
boolean overwrite)
logCurve in interface Experimentpublic void logCurve(@NonNull
@NonNull Curve curve)
logCurve in interface Experimentpublic void uploadAsset(@NonNull
@NonNull File file,
@NonNull
@NonNull String logicalPath,
boolean overwrite,
@NonNull
@NonNull ExperimentContext context)
ExperimentuploadAsset in interface Experimentfile - The asset to be storedlogicalPath - The file name under which the asset should be stored in Comet. E.g. "someFile.txt"overwrite - Whether to overwrite files of the same name in Cometcontext - the context to be associated with the asset.public void uploadAsset(@NonNull
@NonNull File asset,
String logicalPath,
boolean overwrite,
long step,
long epoch)
ExperimentuploadAsset in interface Experimentasset - The asset to be storedlogicalPath - The file name under which the asset should be stored in Comet. E.g. "someFile.txt"overwrite - Whether to overwrite files of the same name in Cometstep - the step to be associated with the assetepoch - the epoch to be associated with the assetpublic void uploadAsset(@NonNull
@NonNull File asset,
boolean overwrite,
@NonNull
@NonNull ExperimentContext context)
ExperimentuploadAsset in interface Experimentasset - The file asset to be stored. The name of the file will be used as assets identifier on Comet.overwrite - Whether to overwrite files of the same name in Cometcontext - the context to be associated with the asset.public void uploadAsset(@NonNull
@NonNull File asset,
boolean overwrite,
long step,
long epoch)
ExperimentuploadAsset in interface Experimentasset - The file asset to be stored. The name of the file will be used as assets identifier on Comet.overwrite - Whether to overwrite files of the same name in Cometstep - the step to be associated with the assetepoch - the epoch to be associated with the assetpublic LoggedArtifact getArtifact(@NonNull @NonNull String name, @NonNull @NonNull String workspace, @NonNull @NonNull String versionOrAlias) throws ArtifactException
ExperimentgetArtifact in interface Experimentname - the short name of the artifact like 'artifact-name'.workspace - the workspace where artifact was saved.versionOrAlias - the artifact version or alias to be returned.LoggedArtifact instance.ArtifactException - if failed to get comet artifact.public LoggedArtifact getArtifact(@NonNull @NonNull String name, @NonNull @NonNull String workspace) throws ArtifactException
ExperimentgetArtifact in interface Experimentname - the short name of the artifact like 'artifact-name' or
the name of artifact with version or alias like 'artifact-name:versionOrAlias'.workspace - the workspace where artifact was saved.LoggedArtifact instance.ArtifactException - if failed to get comet artifact.public LoggedArtifact getArtifact(@NonNull @NonNull String name) throws ArtifactException
ExperimentgetArtifact in interface Experimentname - the name of the artifact. This could either be a fully
qualified artifact name like 'workspace/artifact-name:versionOrAlias'
or any short forms like 'artifact-name', 'artifact-name:versionOrAlias'.LoggedArtifact instance.ArtifactException - if failed to get comet artifact.public ExperimentMetadata getMetadata()
ExperimentgetMetadata in interface Experimentpublic GitMetaData getGitMetadata()
ExperimentgetGitMetadata in interface Experimentpublic Optional<String> getHtml()
ExperimentgetHtml in interface Experimentpublic Optional<String> getOutput()
ExperimentgetOutput in interface Experimentpublic Optional<String> getGraph()
ExperimentgetGraph in interface Experimentpublic List<Value> getParameters()
ExperimentgetParameters in interface Experimentpublic List<Value> getMetrics()
ExperimentgetMetrics in interface Experimentpublic List<Value> getLogOther()
ExperimentgetLogOther in interface Experimentpublic List<String> getTags()
ExperimentgetTags in interface Experimentpublic List<LoggedExperimentAsset> getAssetList(@NonNull @NonNull String type)
ExperimentgetAssetList in interface Experimenttype - the type of assets to be included.public List<LoggedExperimentAsset> getAllAssetList()
ExperimentgetAllAssetList in interface ExperimentCopyright © 2022. All rights reserved.