Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/comet-ml/comet-java-sdk
Comet Java SDK
https://github.com/comet-ml/comet-java-sdk
comet-java-sdk comet-ml java java-sdk java-sdk-download machine-learning sdk sdk-api sdk-examples
Last synced: 3 months ago
JSON representation
Comet Java SDK
- Host: GitHub
- URL: https://github.com/comet-ml/comet-java-sdk
- Owner: comet-ml
- License: mit
- Created: 2019-01-18T15:36:36.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-31T15:17:12.000Z (almost 2 years ago)
- Last Synced: 2024-06-11T20:17:29.578Z (8 months ago)
- Topics: comet-java-sdk, comet-ml, java, java-sdk, java-sdk-download, machine-learning, sdk, sdk-api, sdk-examples
- Language: Java
- Homepage: https://www.comet.com
- Size: 11.1 MB
- Stars: 4
- Watchers: 13
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# https://www.comet.com official Java SDK
[![version](https://img.shields.io/github/v/tag/comet-ml/comet-java-sdk.svg?sort=semver)](https://github.com/comet-ml/comet-java-sdk/releases/latest) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/ml.comet/comet-java-client/badge.svg)](https://maven-badges.herokuapp.com/maven-central/ml.comet/comet-java-client) [![license](https://img.shields.io/github/license/comet-ml/comet-java-sdk.svg)](https://github.com/comet-ml/comet-java-sdk/blob/master/LICENSE) [![javadoc](https://javadoc.io/badge2/ml.comet/comet-java-client/javadoc.svg)](https://javadoc.io/doc/ml.comet/comet-java-client)| Branch | Tests | Coverage | Linting | Code Security |
|--------|--------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------|----------------------------------------------------------------------------|
| master | [![CI](https://github.com/comet-ml/comet-java-sdk/actions/workflows/ci-maven.yml/badge.svg)](https://github.com/comet-ml/comet-java-sdk/workflows/ci-maven.yml) | [![codecov](https://codecov.io/gh/comet-ml/comet-java-sdk/branch/master/graph/badge.svg)](https://codecov.io/gh/comet-ml/comet-java-sdk) | [![Lint Code Base](https://github.com/comet-ml/comet-java-sdk/actions/workflows/super-linter.yml/badge.svg)](https://github.com/comet-ml/comet-java-sdk/actions/workflows/super-linter.yml) | [![CodeQL](https://github.com/comet-ml/comet-java-sdk/actions/workflows/codeQL.yml/badge.svg)](https://github.com/comet-ml/comet-java-sdk/actions/workflows/codeQL.yml) |## Using Comet Java SDK
### Add dependency to the pom.xml
```
ml.comet
comet-java-client
1.1.14
```
### Create experiment and log metrics and parameters
```java
OnlineExperiment experiment = ExperimentBuilder.OnlineExperiment()
.withApiKey("someApiKey")
.withProjectName("someProject")
.withWorkspace("someWorkspace")
.build();
experiment.setExperimentName("My experiment");
experiment.logParameter("batch_size", "500");
experiment.logMetric("strMetric", 123);
experiment.end();
```
The ```OnlineExperiment``` also can be used with [try-with-resources](https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html) statement which automatically
handles call to the ```experiment.end()```.
```java
try (OnlineExperiment experiment = ExperimentBuilder.OnlineExperiment()
.withApiKey("someApiKey")
.withProjectName("someProject")
.withWorkspace("someWorkspace")
.build()) {
experiment.setExperimentName("My experiment");
experiment.logParameter("batch_size", "500");
experiment.logMetric("strMetric", 123);
} catch (Exception e) {
e.printStackTrace();
}
```### Configure experiment object
#### Configuration sources hierarchy
The configuration parameters search order as following (first-listed are higher priority):
* system properties or environment variables
* configuration file set by call to [```withConfigOverride(java.io.File)```](comet-java-client/src/main/java/ml/comet/experiment/builder/BaseCometBuilder.java)
* ```application.conf``` (all resources on the classpath with this name)
* ```reference.conf``` (all resources on the classpath with this name)
#### Programmatic configurationIt is possible to override some or all configuration parameters programmatically when
you create a new experiment's instance using [```ExperimentBuilder```](comet-java-client/src/main/java/ml/comet/experiment/ExperimentBuilder.java)
factory.
```java
// Setting specific configuration parameters with builder
ExperimentBuilder.OnlineExperiment().withApiKey("someApiKey").build();// Override configuration file (can have partial keys)
ExperimentBuilder.OnlineExperiment().withConfigOverride(new File("/tmp/comet.conf")).build();// Read from environment variables OR from configuration file in classpath (application.conf)
ExperimentBuilder.OnlineExperiment().build();
```### Full list of environment variables
```text
COMET_API_KEY
COMET_PROJECT_NAME
COMET_WORKSPACE_NAME
COMET_BASE_URL
COMET_MAX_AUTH_RETRIES
```### Examples
* You also can check
* [Sample Online Experiment](comet-examples/src/main/java/ml/comet/examples/OnlineExperimentExample.java)
* [MNIST classification experiment](comet-examples/src/main/java/ml/comet/examples/mnist/MnistExperimentExample.java)
* [Comet artifact examples](comet-examples/src/main/java/ml/comet/examples/ArtifactExample.java)
* [Log model example](comet-examples/src/main/java/ml/comet/examples/LogModelExample.java)
* [Model registry/Comet API example](comet-examples/src/main/java/ml/comet/examples/RegistryModelExample.java)
* [Comet API example](comet-examples/src/main/java/ml/comet/examples/ApiExamples.java)
* For more usage examples refer to [tests](comet-java-client/src/test/java/ml/comet/experiment)