public class OnlineExperimentImpl extends BaseExperiment implements OnlineExperiment
| Modifier and Type | Class and Description |
|---|---|
static class |
OnlineExperimentImpl.OnlineExperimentBuilderImpl
The builder to create properly configured instance of the OnlineExperimentImpl.
|
| Constructor and Description |
|---|
OnlineExperimentImpl()
Default constructor which reads all configuration parameters of the experiment either from configuration file
or from environment variables.
|
| Modifier and Type | Method and Description |
|---|---|
static OnlineExperimentImpl.OnlineExperimentBuilderImpl |
builder()
Returns builder to be used to create properly configured instance of this class.
|
void |
end()
Tells Comet that the Experiment is complete and release all associated resources.
|
protected Connection |
getConnection()
Returns connection associated with particular experiment.
|
String |
getContext()
Gets the current context as recorded in the Experiment object locally.
|
long |
getEpoch()
Gets the current epoch as recorded by the Experiment object locally.
|
String |
getExperimentKey()
Get the experiment key returned by Comet.
|
Optional<String> |
getExperimentLink()
Get the experiment link returned by Comet.
|
String |
getExperimentName()
Get experiment name.
|
protected org.slf4j.Logger |
getLogger()
Returns logger instance associated with particular experiment.
|
long |
getStep()
Gets the current step as recorded by the Experiment object locally.
|
void |
logLine(String line,
long offset,
boolean stderr)
Send logs to Comet.
|
void |
logMetric(@NonNull String metricName,
@NonNull Object metricValue) |
void |
logMetric(@NonNull String metricName,
@NonNull Object metricValue,
long step)
Logs a metric with Comet under the current experiment step.
|
void |
logMetric(@NonNull String metricName,
@NonNull Object metricValue,
long step,
long epoch)
Logs a metric with Comet.
|
void |
logParameter(@NonNull String parameterName,
@NonNull Object paramValue)
Logs a param with Comet under the current experiment step.
|
void |
logParameter(@NonNull String parameterName,
@NonNull Object paramValue,
long step)
Logs a param with Comet.
|
void |
nextEpoch()
Increments the epoch that the experiment is on.
|
void |
nextStep()
Increments the step that the experiment is on.
|
protected void |
sendHeartbeat() |
void |
setContext(String context)
Sets the context for any logs and uploaded files.
|
void |
setEpoch(long epoch)
Sets the current epoch for the experiment.
|
void |
setInterceptStdout()
Turn on intercept of stdout and stderr and the logging of both in Comet.
|
void |
setStep(long step)
Sets the current step for the experiment.
|
void |
stopInterceptStdout()
Turn off intercept of stdout and stderr and turns off their logging in Comet.
|
void |
uploadAsset(@NonNull File asset,
boolean overwrite) |
void |
uploadAsset(@NonNull File asset,
@NonNull String fileName,
boolean overwrite) |
void |
uploadAsset(@NonNull File asset,
@NonNull String fileName,
boolean overwrite,
long step)
Upload an asset under the current experiment step to be associated with the experiment,
for example the trained weights of a neural net.
|
addTag, getAssetList, getGitMetadata, getGraph, getHtml, getLogOther, getMetadata, getMetrics, getOutput, getParameters, getTags, logCode, logCode, logEndTime, logGitMetadata, logGraph, logHtml, logOther, logStartTime, setExperimentName, uploadAsset, uploadAssetclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddTag, getAssetList, getGitMetadata, getGraph, getHtml, getLogOther, getMetadata, getMetrics, getOutput, getParameters, getProjectName, getTags, getWorkspaceName, logCode, logCode, logEndTime, logGitMetadata, logGraph, logHtml, logOther, logStartTime, setExperimentName, uploadAsset, uploadAssetpublic OnlineExperimentImpl()
throws ConfigException
ConfigException - If the Comet API key, project name, and workspace are missing from the configuration
source or wrong types of the values defined.public String getExperimentName()
ExperimentgetExperimentName in interface Experimentpublic static OnlineExperimentImpl.OnlineExperimentBuilderImpl builder()
protected Connection getConnection()
BaseExperimentgetConnection in class BaseExperimentprotected org.slf4j.Logger getLogger()
BaseExperimentgetLogger in class BaseExperimentpublic void end()
Experimentend in interface Experimentpublic void setInterceptStdout()
throws IOException
OnlineExperimentsetInterceptStdout in interface OnlineExperimentIOException - if an I/O exception occurs.public void stopInterceptStdout()
throws IOException
OnlineExperimentstopInterceptStdout in interface OnlineExperimentIOException - if an I/O exception occurs.public void logLine(String line, long offset, boolean stderr)
OnlineExperimentlogLine in interface OnlineExperimentline - Text to be loggedoffset - Offset describes the place for current text to be insertedstderr - the flag to indicate if this is StdErr message.public void setStep(long step)
OnlineExperimentsetStep in interface OnlineExperimentstep - the current step of the experiment.public void nextStep()
OnlineExperimentnextStep in interface OnlineExperimentpublic long getStep()
OnlineExperimentgetStep in interface OnlineExperimentpublic void setEpoch(long epoch)
OnlineExperimentsetEpoch in interface OnlineExperimentepoch - the current epoch for the experiment.public void nextEpoch()
OnlineExperimentnextEpoch in interface OnlineExperimentpublic long getEpoch()
OnlineExperimentgetEpoch in interface OnlineExperimentpublic void setContext(String context)
OnlineExperimentsetContext in interface OnlineExperimentcontext - the context to be associated with any log records, files, and assets.public String getContext()
BaseExperimentgetContext in interface OnlineExperimentgetContext in class BaseExperimentpublic String getExperimentKey()
ExperimentgetExperimentKey in interface Experimentpublic Optional<String> getExperimentLink()
ExperimentgetExperimentLink in interface Experimentpublic void logMetric(@NonNull
@NonNull String metricName,
@NonNull
@NonNull Object metricValue,
long step)
OnlineExperimentlogMetric in interface OnlineExperimentmetricName - 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 them.step - The step to be associated with this metricpublic void logMetric(@NonNull
@NonNull String metricName,
@NonNull
@NonNull Object metricValue)
logMetric in interface OnlineExperimentpublic void logMetric(@NonNull
@NonNull String metricName,
@NonNull
@NonNull Object metricValue,
long step,
long epoch)
ExperimentlogMetric in interface ExperimentlogMetric in class BaseExperimentmetricName - 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 experimentpublic void logParameter(@NonNull
@NonNull String parameterName,
@NonNull
@NonNull Object paramValue)
OnlineExperimentlogParameter in interface OnlineExperimentparameterName - The name of the param being loggedparamValue - The value for the param being loggedpublic void logParameter(@NonNull
@NonNull String parameterName,
@NonNull
@NonNull Object paramValue,
long step)
ExperimentlogParameter in interface ExperimentlogParameter in class BaseExperimentparameterName - 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 experimentpublic void uploadAsset(@NonNull
@NonNull File asset,
@NonNull
@NonNull String fileName,
boolean overwrite,
long step)
OnlineExperimentuploadAsset in interface OnlineExperimentasset - The asset to be storedfileName - 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 assetpublic void uploadAsset(@NonNull
@NonNull File asset,
boolean overwrite)
uploadAsset in interface OnlineExperimentpublic void uploadAsset(@NonNull
@NonNull File asset,
@NonNull
@NonNull String fileName,
boolean overwrite)
uploadAsset in interface OnlineExperimentprotected void sendHeartbeat()
Copyright © 2021. All rights reserved.