{"id":4143,"date":"2022-10-20T13:35:57","date_gmt":"2022-10-20T21:35:57","guid":{"rendered":"https:\/\/live-cometml.pantheonsite.io\/?p=4143"},"modified":"2025-04-24T17:17:00","modified_gmt":"2025-04-24T17:17:00","slug":"writing-a-classification-task-using-comet-and-java","status":"publish","type":"post","link":"https:\/\/www.comet.com\/site\/blog\/writing-a-classification-task-using-comet-and-java\/","title":{"rendered":"Writing a Classification Task using Comet and Java"},"content":{"rendered":"\n<div class=\"ir is it iu iv\">\n<p id=\"a91c\" class=\"pw-post-body-paragraph lm ln iy bm b lo lp ki lq lr ls kl lt lu lv lw lx ly lz ma mb mc md me mf mg ir ga\" data-selectable-paragraph=\"\"><a class=\"au ll\" href=\"https:\/\/www.comet.com\/\" target=\"_blank\" rel=\"noopener ugc nofollow\">Comet<\/a>&nbsp;is an experimentation platform that permits you to track and monitor experiments. You can write your Comet experiments using your preferred language including Python, R, and Java.<\/p>\n<p id=\"08f0\" class=\"pw-post-body-paragraph lm ln iy bm b lo lp ki lq lr ls kl lt lu lv lw lx ly lz ma mb mc md me mf mg ir ga\" data-selectable-paragraph=\"\">In this tutorial, I describe how to write a Comet experiment in Java. In particular, I will use the Comet Java library and the weka library, to achieve this objective.<\/p>\n<p id=\"2140\" class=\"pw-post-body-paragraph lm ln iy bm b lo lp ki lq lr ls kl lt lu lv lw lx ly lz ma mb mc md me mf mg ir ga\" data-selectable-paragraph=\"\">The article is organized as follows:<\/p>\n<ul class=\"\">\n<li id=\"12ca\" class=\"mh mi iy bm b lo lp lr ls lu mj ly mk mc ml mg mm mn mo mp ga\" data-selectable-paragraph=\"\">Environment setup<\/li>\n<li id=\"4076\" class=\"mh mi iy bm b lo mq lr mr lu ms ly mt mc mu mg mm mn mo mp ga\" data-selectable-paragraph=\"\">Dataset loading<\/li>\n<li id=\"0fd0\" class=\"mh mi iy bm b lo mq lr mr lu ms ly mt mc mu mg mm mn mo mp ga\" data-selectable-paragraph=\"\">Model classification and evaluation<\/li>\n<li id=\"cdb2\" class=\"mh mi iy bm b lo mq lr mr lu ms ly mt mc mu mg mm mn mo mp ga\" data-selectable-paragraph=\"\">Results in Comet<\/li>\n<\/ul>\n<h2 id=\"f45b\" class=\"mv mw iy bm mx my mz na nb nc nd ne nf kn ng ko nh kq ni kr nj kt nk ku nl nm ga\">Environment Setup<\/h2>\n<p id=\"3109\" class=\"pw-post-body-paragraph lm ln iy bm b lo nn ki lq lr no kl lt lu np lw lx ly nq ma mb mc nr me mf mg ir ga\" data-selectable-paragraph=\"\">Firstly, I need to install the Comet Java library. I download it from the&nbsp;<a class=\"au ll\" href=\"https:\/\/github.com\/comet-ml\/comet-java-sdk\/releases\" target=\"_blank\" rel=\"noopener ugc nofollow\">Comet official Web site<\/a>&nbsp;and I install it through Maven:<\/p>\n<pre class=\"kx ky kz la gx ns bs nt\"><span id=\"43dd\" class=\"ga nu mw iy nv b dm nw nx l ny\" data-selectable-paragraph=\"\">mvn clean install<\/span><\/pre>\n<p id=\"8675\" class=\"pw-post-body-paragraph lm ln iy bm b lo lp ki lq lr ls kl lt lu lv lw lx ly lz ma mb mc md me mf mg ir ga\" data-selectable-paragraph=\"\">Then, I download weka from&nbsp;<a class=\"au ll\" href=\"https:\/\/waikato.github.io\/weka-wiki\/maven\/\" target=\"_blank\" rel=\"noopener ugc nofollow\">its official website<\/a>, and I install it, by following the described procedure.<\/p>\n<p id=\"97ea\" class=\"pw-post-body-paragraph lm ln iy bm b lo lp ki lq lr ls kl lt lu lv lw lx ly lz ma mb mc md me mf mg ir ga\" data-selectable-paragraph=\"\">Now, I create a new maven project by running the following command in a terminal:<\/p>\n<pre class=\"kx ky kz la gx ns bs nt\">mvn archetype:generate \\\n  -DgroupId=ml.example \\\n  -DartifactId=comet-classification \\\n  -DarchetypeArtifactId=maven-archetype-quickstart \\\n  -DarchetypeVersion=1.4 \\\n  -DinteractiveMode=false<\/pre>\n<p id=\"ff2c\" class=\"pw-post-body-paragraph lm ln iy bm b lo lp ki lq lr ls kl lt lu lv lw lx ly lz ma mb mc md me mf mg ir ga\" data-selectable-paragraph=\"\">I enter the created directory and I edit the&nbsp;<code class=\"fp nz oa ob nv b\">pom.xml<\/code>&nbsp;file by adding the list of dependencies in the&nbsp;<code class=\"fp nz oa ob nv b\">dependencies<\/code>&nbsp;section, as follows:<\/p>\n<pre class=\"kx ky kz la gx ns bs nt\"><span id=\"3944\" class=\"ga nu mw iy nv b dm nw nx l ny\" data-selectable-paragraph=\"\">&lt;dependency&gt;\n   &lt;groupId&gt;ml.comet&lt;\/groupId&gt;\n   &lt;artifactId&gt;<strong class=\"nv ji\">comet-java-client<\/strong>&lt;\/artifactId\n   &lt;version&gt;1.1.10&lt;\/version&gt;\n&lt;\/dependency&gt;<\/span><span id=\"4e5b\" class=\"ga nu mw iy nv b dm oc od oe of og nx l ny\" data-selectable-paragraph=\"\">&lt;dependency&gt;\n   &lt;groupId&gt;nz.ac.waikato.cms.weka&lt;\/groupId&gt;\n   &lt;artifactId&gt;<strong class=\"nv ji\">weka-stable<\/strong>&lt;\/artifactId&gt;\n   &lt;version&gt;3.8.6&lt;\/version&gt;\n&lt;\/dependency&gt;<\/span><\/pre>\n<p id=\"c34a\" class=\"pw-post-body-paragraph lm ln iy bm b lo lp ki lq lr ls kl lt lu lv lw lx ly lz ma mb mc md me mf mg ir ga\" data-selectable-paragraph=\"\">Now, I create a new project in Comet, and I copy the API KEY. I create a directory, named&nbsp;<code class=\"fp nz oa ob nv b\">config<\/code>&nbsp;with a new file, named&nbsp;<code class=\"fp nz oa ob nv b\">applications.conf<\/code>, and I put it in the main directory of the project. In the&nbsp;<code class=\"fp nz oa ob nv b\">applications.conf<\/code>&nbsp;file I save the information to access Comet:<\/p>\n<pre class=\"kx ky kz la gx ns bs nt\"><span id=\"1f79\" class=\"ga nu mw iy nv b dm nw nx l ny\" data-selectable-paragraph=\"\">comet {\n     baseUrl = \"<a class=\"au ll\" href=\"https:\/\/www.comet.com\/\" target=\"_blank\" rel=\"noopener ugc nofollow\">https:\/\/www.comet.com<\/a>\"\n     apiKey = \"MY API KEY\"\n     project = \"MY PROJECT NAME\"\n     workspace = \"MY WORKSPACE\"\n}<\/span><\/pre>\n<p id=\"a214\" class=\"pw-post-body-paragraph lm ln iy bm b lo lp ki lq lr ls kl lt lu lv lw lx ly lz ma mb mc md me mf mg ir ga\" data-selectable-paragraph=\"\">I edit the&nbsp;<code class=\"fp nz oa ob nv b\">pom.xml<\/code>&nbsp;file, by adding the&nbsp;<code class=\"fp nz oa ob nv b\">config<\/code>&nbsp;directory to the project classpath:<\/p>\n<pre class=\"kx ky kz la gx ns bs nt\"><span id=\"2b2e\" class=\"ga nu mw iy nv b dm nw nx l ny\" data-selectable-paragraph=\"\">&lt;resources&gt;\n  &lt;resource&gt;\n    &lt;directory&gt;src\/main\/config&lt;\/directory&gt;\n  &lt;\/resource&gt;\n&lt;\/resources&gt;<\/span><\/pre>\n<p id=\"c445\" class=\"pw-post-body-paragraph lm ln iy bm b lo lp ki lq lr ls kl lt lu lv lw lx ly lz ma mb mc md me mf mg ir ga\" data-selectable-paragraph=\"\">Now, I\u2019m ready to run my experiment!<\/p>\n<\/div>\n\n\n\n<div class=\"ir is it iu iv\">\n<p id=\"9842\" class=\"op oq iy bm or os ot ou ov ow ox mg cn\" data-selectable-paragraph=\"\"><strong>Students and start ups can use Comet for free!&nbsp;<a class=\"au ll\" href=\"https:\/\/www.comet.com\/site\/\" target=\"_blank\" rel=\"noopener ugc nofollow\">Sign up today and get started.<\/a><\/strong><\/p>\n<\/div>\n\n\n\n<div class=\"ir is it iu iv\">\n<h2 id=\"a9c0\" class=\"mv mw iy bm mx my oy na nb nc oz ne nf kn pa ko nh kq pb kr nj kt pc ku nl nm ga\">Dataset Loading<\/h2>\n<p id=\"0278\" class=\"pw-post-body-paragraph lm ln iy bm b lo nn ki lq lr no kl lt lu np lw lx ly nq ma mb mc nr me mf mg ir ga\" data-selectable-paragraph=\"\">As a use case, I will use the&nbsp;<a class=\"au ll\" href=\"https:\/\/www.kaggle.com\/datasets\/yasserh\/breast-cancer-dataset\" target=\"_blank\" rel=\"noopener ugc nofollow\">breast cancer dataset<\/a>&nbsp;available on Kaggle under the CC0 public license. The idea is to build a classification task which returns the diagnosis (benign\/malignant) given some input features. I will implement a KNN classifier to solve this task.<\/p>\n<p id=\"bdf4\" class=\"pw-post-body-paragraph lm ln iy bm b lo lp ki lq lr ls kl lt lu lv lw lx ly lz ma mb mc md me mf mg ir ga\" data-selectable-paragraph=\"\">I open the&nbsp;<code class=\"fp nz oa ob nv b\">App.java<\/code>&nbsp;file, located under main \u2192 java \u2192 ml \u2192 example, and I edit the&nbsp;<code class=\"fp nz oa ob nv b\">App<\/code>&nbsp;class by adding the main method. I write all the following code in the main method of the&nbsp;<code class=\"fp nz oa ob nv b\">App<\/code>&nbsp;class.<\/p>\n<p id=\"c3f3\" class=\"pw-post-body-paragraph lm ln iy bm b lo lp ki lq lr ls kl lt lu lv lw lx ly lz ma mb mc md me mf mg ir ga\" data-selectable-paragraph=\"\">I wrap all the following code in a&nbsp;<code class=\"fp nz oa ob nv b\">try<\/code>&nbsp;\u2014<code class=\"fp nz oa ob nv b\">&nbsp;catch<\/code>&nbsp;block, which I omit for simplicity.<\/p>\n<p id=\"ed66\" class=\"pw-post-body-paragraph lm ln iy bm b lo lp ki lq lr ls kl lt lu lv lw lx ly lz ma mb mc md me mf mg ir ga\" data-selectable-paragraph=\"\">Firstly, I load the dataset:<\/p>\n<pre class=\"kx ky kz la gx ns bs nt\"><span id=\"adaa\" class=\"ga nu mw iy nv b dm nw nx l ny\" data-selectable-paragraph=\"\">CSVLoader loader = new CSVLoader();\nloader.setSource(new File(\"src\/main\/source\/breast-cancer.csv\"));\nInstances data = loader.getDataSet();<\/span><\/pre>\n<p id=\"6e66\" class=\"pw-post-body-paragraph lm ln iy bm b lo lp ki lq lr ls kl lt lu lv lw lx ly lz ma mb mc md me mf mg ir ga\" data-selectable-paragraph=\"\">Then, I set the target class to the second column of the dataset:<\/p>\n<pre class=\"kx ky kz la gx ns bs nt\"><span id=\"b1ff\" class=\"ga nu mw iy nv b dm nw nx l ny\" data-selectable-paragraph=\"\">data.setClassIndex(1);<\/span><\/pre>\n<p id=\"880c\" class=\"pw-post-body-paragraph lm ln iy bm b lo lp ki lq lr ls kl lt lu lv lw lx ly lz ma mb mc md me mf mg ir ga\" data-selectable-paragraph=\"\">I split the dataset into training and test sets:<\/p>\n<pre class=\"kx ky kz la gx ns bs nt\"><span id=\"e98b\" class=\"ga nu mw iy nv b dm nw nx l ny\" data-selectable-paragraph=\"\">int trainSize = (int) Math.round(data.numInstances() * 0.7);\nint testSize = data.numInstances() - trainSize;\n<\/span><span id=\"9d1d\" class=\"ga nu mw iy nv b dm oc od oe of og nx l ny\" data-selectable-paragraph=\"\">Instances train_set = new Instances(data, 0, trainSize);\nInstances test_set = new Instances(data, trainSize, testSize);<\/span><\/pre>\n<p id=\"f2a9\" class=\"pw-post-body-paragraph lm ln iy bm b lo lp ki lq lr ls kl lt lu lv lw lx ly lz ma mb mc md me mf mg ir ga\" data-selectable-paragraph=\"\">Now, I create the Comet experiment:<\/p>\n<pre class=\"kx ky kz la gx ns bs nt\"><span id=\"02c6\" class=\"ga nu mw iy nv b dm nw nx l ny\" data-selectable-paragraph=\"\">OnlineExperiment exp = ExperimentBuilder.OnlineExperiment().build();\nexp.setExperimentName(\"Decision Tree\");<\/span><\/pre>\n<h2 id=\"ff26\" class=\"mv mw iy bm mx my mz na nb nc nd ne nf kn ng ko nh kq ni kr nj kt nk ku nl nm ga\">Model Classification and Evaluation<\/h2>\n<p id=\"5512\" class=\"pw-post-body-paragraph lm ln iy bm b lo nn ki lq lr no kl lt lu np lw lx ly nq ma mb mc nr me mf mg ir ga\" data-selectable-paragraph=\"\">I\u2019m ready to train the model. I build a Decision Tree classifier and I train it on the training set:<\/p>\n<pre class=\"kx ky kz la gx ns bs nt\"><span id=\"0176\" class=\"ga nu mw iy nv b dm nw nx l ny\" data-selectable-paragraph=\"\">Classifier cls = new J48();\ncls.buildClassifier(train_set);<\/span><\/pre>\n<p id=\"61e7\" class=\"pw-post-body-paragraph lm ln iy bm b lo lp ki lq lr ls kl lt lu lv lw lx ly lz ma mb mc md me mf mg ir ga\" data-selectable-paragraph=\"\">I evaluate the model on the test set:<\/p>\n<pre class=\"kx ky kz la gx ns bs nt\"><span id=\"dbe9\" class=\"ga nu mw iy nv b dm nw nx l ny\" data-selectable-paragraph=\"\">Evaluation eval = new Evaluation(test_set);\neval.evaluateModel(cls,test_set);\n<\/span><span id=\"5eb0\" class=\"ga nu mw iy nv b dm oc od oe of og nx l ny\" data-selectable-paragraph=\"\">double precision = eval.precision(1);\ndouble recall = eval.recall(1);\ndouble accuracy = eval.pctCorrect();<\/span><\/pre>\n<p id=\"8655\" class=\"pw-post-body-paragraph lm ln iy bm b lo lp ki lq lr ls kl lt lu lv lw lx ly lz ma mb mc md me mf mg ir ga\" data-selectable-paragraph=\"\">I log the evaluation metrics in Comet:<\/p>\n<pre class=\"kx ky kz la gx ns bs nt\"><span id=\"07de\" class=\"ga nu mw iy nv b dm nw nx l ny\" data-selectable-paragraph=\"\">exp.logMetric(\"precision\", precision);\nexp.logMetric(\"recall\", recall);\nexp.logMetric(\"accuracy\", accuracy);<\/span><\/pre>\n<p id=\"edd0\" class=\"pw-post-body-paragraph lm ln iy bm b lo lp ki lq lr ls kl lt lu lv lw lx ly lz ma mb mc md me mf mg ir ga\" data-selectable-paragraph=\"\">Finally, I terminate the experiment:<\/p>\n<pre class=\"kx ky kz la gx ns bs nt\"><span id=\"32f6\" class=\"ga nu mw iy nv b dm nw nx l ny\" data-selectable-paragraph=\"\">exp.end();<\/span><\/pre>\n<p id=\"dea9\" class=\"pw-post-body-paragraph lm ln iy bm b lo lp ki lq lr ls kl lt lu lv lw lx ly lz ma mb mc md me mf mg ir ga\" data-selectable-paragraph=\"\">Now I run all the experiments from the project main directory as follows:<\/p>\n<pre class=\"kx ky kz la gx ns bs nt\"><span id=\"8534\" class=\"ga nu mw iy nv b dm nw nx l ny\" data-selectable-paragraph=\"\">mvn clean compile exec:java -Dexec.mainClass=\"ml.example.App\"<\/span><\/pre>\n<h2 id=\"bc86\" class=\"mv mw iy bm mx my mz na nb nc nd ne nf kn ng ko nh kq ni kr nj kt nk ku nl nm ga\">Results in Comet<\/h2>\n<p id=\"ec0a\" class=\"pw-post-body-paragraph lm ln iy bm b lo nn ki lq lr no kl lt lu np lw lx ly nq ma mb mc nr me mf mg ir ga\" data-selectable-paragraph=\"\">Once the experiment terminates, I can see the results in Comet. The following figure shows the Comet dashboard when the experiment is completed:<\/p>\n<figure class=\"kx ky kz la gx lb gl gm paragraph-image\">\n<div class=\"lc ld do le ce lf\" tabindex=\"0\" role=\"button\">\n<figure><img loading=\"lazy\" decoding=\"async\" class=\"ce lg lh c aligncenter\" role=\"presentation\" src=\"https:\/\/miro.medium.com\/max\/1050\/1*Iz9-471uCswvNZsN8dg07w.png\" alt=\"\" width=\"700\" height=\"326\"><\/figure><div class=\"gl gm pd\"><picture><source srcset=\"https:\/\/miro.medium.com\/max\/640\/1*Iz9-471uCswvNZsN8dg07w.png 640w, https:\/\/miro.medium.com\/max\/720\/1*Iz9-471uCswvNZsN8dg07w.png 720w, https:\/\/miro.medium.com\/max\/750\/1*Iz9-471uCswvNZsN8dg07w.png 750w, https:\/\/miro.medium.com\/max\/786\/1*Iz9-471uCswvNZsN8dg07w.png 786w, https:\/\/miro.medium.com\/max\/828\/1*Iz9-471uCswvNZsN8dg07w.png 828w, https:\/\/miro.medium.com\/max\/1100\/1*Iz9-471uCswvNZsN8dg07w.png 1100w, https:\/\/miro.medium.com\/max\/1400\/1*Iz9-471uCswvNZsN8dg07w.png 1400w\" sizes=\"(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 700px\" data-testid=\"og\"><\/picture><\/div>\n<\/div>\n<\/figure>\n<p style=\"text-align: center;\" data-selectable-paragraph=\"\">Image by Author<\/p>\n<p id=\"bd26\" class=\"pw-post-body-paragraph lm ln iy bm b lo lp ki lq lr ls kl lt lu lv lw lx ly lz ma mb mc md me mf mg ir ga\" data-selectable-paragraph=\"\">Comet has produced the precision, recall, and accuracy graphs automatically!<\/p>\n<h2 id=\"ba83\" class=\"mv mw iy bm mx my mz na nb nc nd ne nf kn ng ko nh kq ni kr nj kt nk ku nl nm ga\">Summary<\/h2>\n<p id=\"f367\" class=\"pw-post-body-paragraph lm ln iy bm b lo nn ki lq lr no kl lt lu np lw lx ly nq ma mb mc nr me mf mg ir ga\" data-selectable-paragraph=\"\">Congratulations! You have just learned how to run a Comet experiment in Java, using the weka library. For more details on the functions provided by the Comet Java library, you can refer to the&nbsp;<a class=\"au ll\" href=\"https:\/\/www.comet.com\/docs\/java-sdk\/getting-started\/\" target=\"_blank\" rel=\"noopener ugc nofollow\">Comet official documentation<\/a>.<\/p>\n<p id=\"bf91\" class=\"pw-post-body-paragraph lm ln iy bm b lo lp ki lq lr ls kl lt lu lv lw lx ly lz ma mb mc md me mf mg ir ga\" data-selectable-paragraph=\"\">You can download the full code of this tutorial from my&nbsp;<a class=\"au ll\" href=\"https:\/\/github.com\/alod83\/data-science-java\/tree\/main\/comet-classification\" target=\"_blank\" rel=\"noopener ugc nofollow\">Github repository<\/a>. You only need to configure the&nbsp;<code class=\"fp nz oa ob nv b\">applications.conf<\/code>&nbsp;file! In addition, you can see the live experiment directly in Comet, at&nbsp;<a class=\"au ll\" href=\"https:\/\/www.comet.com\/comet-examples\/java-classification\/\" target=\"_blank\" rel=\"noopener ugc nofollow\">this link<\/a>.<\/p>\n<p id=\"ab2f\" class=\"pw-post-body-paragraph lm ln iy bm b lo lp ki lq lr ls kl lt lu lv lw lx ly lz ma mb mc md me mf mg ir ga\" data-selectable-paragraph=\"\">Happy coding! Happy Comet!<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Comet&nbsp;is an experimentation platform that permits you to track and monitor experiments. You can write your Comet experiments using your preferred language including Python, R, and Java. In this tutorial, I describe how to write a Comet experiment in Java. In particular, I will use the Comet Java library and the weka library, to achieve [&hellip;]<\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"customer_name":"","customer_description":"","customer_industry":"","customer_technologies":"","customer_logo":"","footnotes":""},"categories":[6,9],"tags":[],"coauthors":[132],"class_list":["post-4143","post","type-post","status-publish","format-standard","hentry","category-machine-learning","category-product"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.9 (Yoast SEO v25.9) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Writing a Classification Task using Comet and Java<\/title>\n<meta name=\"description\" content=\"Read this step-by-step tutorial on how to build a Comet Experiment with the Comet Java library and the weka library.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.comet.com\/site\/blog\/writing-a-classification-task-using-comet-and-java\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Writing a Classification Task using Comet and Java\" \/>\n<meta property=\"og:description\" content=\"Read this step-by-step tutorial on how to build a Comet Experiment with the Comet Java library and the weka library.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.comet.com\/site\/blog\/writing-a-classification-task-using-comet-and-java\/\" \/>\n<meta property=\"og:site_name\" content=\"Comet\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/cometdotml\" \/>\n<meta property=\"article:published_time\" content=\"2022-10-20T21:35:57+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-24T17:17:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/miro.medium.com\/max\/1050\/1*Iz9-471uCswvNZsN8dg07w.png\" \/>\n<meta name=\"author\" content=\"Angelica Lo Duca\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@Cometml\" \/>\n<meta name=\"twitter:site\" content=\"@Cometml\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Angelica Lo Duca\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Writing a Classification Task using Comet and Java","description":"Read this step-by-step tutorial on how to build a Comet Experiment with the Comet Java library and the weka library.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.comet.com\/site\/blog\/writing-a-classification-task-using-comet-and-java\/","og_locale":"en_US","og_type":"article","og_title":"Writing a Classification Task using Comet and Java","og_description":"Read this step-by-step tutorial on how to build a Comet Experiment with the Comet Java library and the weka library.","og_url":"https:\/\/www.comet.com\/site\/blog\/writing-a-classification-task-using-comet-and-java\/","og_site_name":"Comet","article_publisher":"https:\/\/www.facebook.com\/cometdotml","article_published_time":"2022-10-20T21:35:57+00:00","article_modified_time":"2025-04-24T17:17:00+00:00","og_image":[{"url":"https:\/\/miro.medium.com\/max\/1050\/1*Iz9-471uCswvNZsN8dg07w.png","type":"","width":"","height":""}],"author":"Angelica Lo Duca","twitter_card":"summary_large_image","twitter_creator":"@Cometml","twitter_site":"@Cometml","twitter_misc":{"Written by":"Angelica Lo Duca","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.comet.com\/site\/blog\/writing-a-classification-task-using-comet-and-java\/#article","isPartOf":{"@id":"https:\/\/www.comet.com\/site\/blog\/writing-a-classification-task-using-comet-and-java\/"},"author":{"name":"Team Comet Digital","@id":"https:\/\/www.comet.com\/site\/#\/schema\/person\/6266601170c60a7a82b3e0043fbe8ddf"},"headline":"Writing a Classification Task using Comet and Java","datePublished":"2022-10-20T21:35:57+00:00","dateModified":"2025-04-24T17:17:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.comet.com\/site\/blog\/writing-a-classification-task-using-comet-and-java\/"},"wordCount":578,"publisher":{"@id":"https:\/\/www.comet.com\/site\/#organization"},"image":{"@id":"https:\/\/www.comet.com\/site\/blog\/writing-a-classification-task-using-comet-and-java\/#primaryimage"},"thumbnailUrl":"https:\/\/miro.medium.com\/max\/1050\/1*Iz9-471uCswvNZsN8dg07w.png","articleSection":["Machine Learning","Product"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.comet.com\/site\/blog\/writing-a-classification-task-using-comet-and-java\/","url":"https:\/\/www.comet.com\/site\/blog\/writing-a-classification-task-using-comet-and-java\/","name":"Writing a Classification Task using Comet and Java","isPartOf":{"@id":"https:\/\/www.comet.com\/site\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.comet.com\/site\/blog\/writing-a-classification-task-using-comet-and-java\/#primaryimage"},"image":{"@id":"https:\/\/www.comet.com\/site\/blog\/writing-a-classification-task-using-comet-and-java\/#primaryimage"},"thumbnailUrl":"https:\/\/miro.medium.com\/max\/1050\/1*Iz9-471uCswvNZsN8dg07w.png","datePublished":"2022-10-20T21:35:57+00:00","dateModified":"2025-04-24T17:17:00+00:00","description":"Read this step-by-step tutorial on how to build a Comet Experiment with the Comet Java library and the weka library.","breadcrumb":{"@id":"https:\/\/www.comet.com\/site\/blog\/writing-a-classification-task-using-comet-and-java\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.comet.com\/site\/blog\/writing-a-classification-task-using-comet-and-java\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.comet.com\/site\/blog\/writing-a-classification-task-using-comet-and-java\/#primaryimage","url":"https:\/\/miro.medium.com\/max\/1050\/1*Iz9-471uCswvNZsN8dg07w.png","contentUrl":"https:\/\/miro.medium.com\/max\/1050\/1*Iz9-471uCswvNZsN8dg07w.png"},{"@type":"BreadcrumbList","@id":"https:\/\/www.comet.com\/site\/blog\/writing-a-classification-task-using-comet-and-java\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.comet.com\/site\/"},{"@type":"ListItem","position":2,"name":"Writing a Classification Task using Comet and Java"}]},{"@type":"WebSite","@id":"https:\/\/www.comet.com\/site\/#website","url":"https:\/\/www.comet.com\/site\/","name":"Comet","description":"Build Better Models Faster","publisher":{"@id":"https:\/\/www.comet.com\/site\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.comet.com\/site\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.comet.com\/site\/#organization","name":"Comet ML, Inc.","alternateName":"Comet","url":"https:\/\/www.comet.com\/site\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.comet.com\/site\/#\/schema\/logo\/image\/","url":"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2025\/01\/logo_comet_square.png","contentUrl":"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2025\/01\/logo_comet_square.png","width":310,"height":310,"caption":"Comet ML, Inc."},"image":{"@id":"https:\/\/www.comet.com\/site\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/cometdotml","https:\/\/x.com\/Cometml","https:\/\/www.youtube.com\/channel\/UCmN63HKvfXSCS-UwVwmK8Hw"]},{"@type":"Person","@id":"https:\/\/www.comet.com\/site\/#\/schema\/person\/6266601170c60a7a82b3e0043fbe8ddf","name":"Team Comet Digital","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.comet.com\/site\/#\/schema\/person\/image\/4f0c0a8cc7c0e87c636ff6a420a6647c","url":"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2023\/08\/Screen-Shot-2023-08-12-at-8.58.50-AM-96x96.png","contentUrl":"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2023\/08\/Screen-Shot-2023-08-12-at-8.58.50-AM-96x96.png","caption":"Team Comet Digital"},"sameAs":["https:\/\/www.comet.ml\/"],"url":"https:\/\/www.comet.com\/site\/blog\/author\/teamcometdigital\/"}]}},"_links":{"self":[{"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/posts\/4143","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/comments?post=4143"}],"version-history":[{"count":1,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/posts\/4143\/revisions"}],"predecessor-version":[{"id":15669,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/posts\/4143\/revisions\/15669"}],"wp:attachment":[{"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/media?parent=4143"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/categories?post=4143"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/tags?post=4143"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/coauthors?post=4143"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}