{"id":5647111,"date":"2023-01-12T14:27:18","date_gmt":"2023-01-12T19:27:18","guid":{"rendered":"https:\/\/lightning.ai\/pages\/?p=5647111"},"modified":"2023-03-07T17:09:34","modified_gmt":"2023-03-07T22:09:34","slug":"train-scikit-learn-models","status":"publish","type":"post","link":"https:\/\/lightning.ai\/pages\/community\/tutorial\/train-scikit-learn-models\/","title":{"rendered":"Train Scikit-learn Models on the Cloud"},"content":{"rendered":"<div class=\"takeaways card-glow p-4 my-4\"><h3 class=\"w-100 d-block\">Key takeaways<\/h3> Train Scikit-learn models on the cloud. <\/div>\n<p>The scale of machine learning datasets can often become large enough that migrating to a cloud provider for training, storing checkpoints, and logs becomes necessary. Making this migration, however, brings with it a host of attendant cloud infrastructure overhead that can be new to (and difficult for!) machine learning engineering teams.<\/p>\n<p>In this blog post, we&#8217;ll show you how to train a Scikit-learn model with the Lightning framework. Then, we&#8217;ll explore how you can migrate your existing training script to train with Lightning.<\/p>\n<h2>Building a Scikit-learn training component<\/h2>\n<p>We&#8217;ll use the <a class=\"notion-link-token notion-enable-hover\" href=\"https:\/\/scikit-learn.org\/stable\/auto_examples\/datasets\/plot_iris_dataset.html\" target=\"_blank\" rel=\"noopener noreferrer\" data-token-index=\"1\" data-reactroot=\"\"><span class=\"link-annotation-unknown-block-id--1792908881\">Iris flower dataset<\/span><\/a> composed of three kinds of irises with different sepal and petal lengths. The chart below shows the distribution of flowers by their sepal width and height. The three color dots represent the category of Iris plants.<\/p>\n<div id=\"attachment_5647114\" style=\"width: 810px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-5647114\" class=\"size-full wp-image-5647114\" src=\"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2023\/01\/Iris-dataset.png\" alt=\"\" width=\"800\" height=\"600\" srcset=\"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2023\/01\/Iris-dataset.png 800w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2023\/01\/Iris-dataset-300x225.png 300w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2023\/01\/Iris-dataset-300x225@2x.png 600w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><p id=\"caption-attachment-5647114\" class=\"wp-caption-text\">Distribution of Iris flower dataset. Source: Scikit-Learn<\/p><\/div>\n<p>Scikit-learn already offers a convenient prebuilt function to load the iris dataset. For this tutorial, we&#8217;ll load the data using Scikit-learn and train a decision tree classifier.<\/p>\n<p>Below is a simple code example for loading and using the dataset to train a decision tree classification model without Lightning. While this is the method in which Scikit-learn is typically used, combining it with cloud services for large datasets or deployment can be difficult.<\/p>\n<pre class=\"code-shortcode dark-theme window- collapse-false \" style=\"--height:falsepx\"><code class=\"language-Python \">\n\nfrom sklearn.datasets import load_iris<br \/>\nfrom sklearn import tree<br \/>\nfrom sklearn.model_selection import train_test_split\n\n# Load the iris dataset<br \/>\niris = load_iris()<br \/>\nX, y = iris.data, iris.target\n\n# Split the dataset into training and test set<br \/>\nX_train, X_test, y_train, y_test = train_test_split(X, y)\n\n# initialize a Decision tree model<br \/>\nclf = tree.DecisionTreeClassifier()\n\n# train the model<br \/>\nclf = clf.fit(X_train, y_train)\n\n# check accuracy<br \/>\nprint(f\"train accuracy: {clf.score(X_train, y_train)}\")<br \/>\nprint(f\"test accuracy: {clf.score(X_test, y_test)}\")\n\n<\/code><div class=\"copy-button\"><button class=\"expand-button\">Expand<\/button><button class=\"copy\">Copy<\/button><\/div><\/pre>\n<p>We can also plot our decision tree to visualize how the model actually makes a decision during inference. In order to plot the tree, we use the <span class=\"notion-enable-hover\" spellcheck=\"false\" data-token-index=\"1\" data-reactroot=\"\">plot_tree<\/span> function of the <span class=\"notion-enable-hover\" spellcheck=\"false\" data-token-index=\"3\" data-reactroot=\"\">tree<\/span> module. We pass our trained model to the function along with feature names (petal and sepal sizes) and class names (type of the iris plant):<\/p>\n<pre class=\"code-shortcode dark-theme window- collapse-false \" style=\"--height:falsepx\"><code class=\"language-python\">\n\nfrom sklearn import tree<br \/>\nimport matplotlib.pyplot as plt\n\ntree.plot_tree(clf, feature_names=iris.feature_names, class_names=iris.target_names)<br \/>\nplt.show()\n\n<\/code><div class=\"copy-button\"><button class=\"expand-button\">Expand<\/button><button class=\"copy\">Copy<\/button><\/div><\/pre>\n<p>Below, we can see the visualization of the decision tree:<\/p>\n<div id=\"attachment_5647115\" style=\"width: 5956px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-5647115\" class=\"size-full wp-image-5647115\" src=\"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2023\/01\/Decision-Tree-vis.png\" alt=\"\" width=\"5946\" height=\"4289\" srcset=\"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2023\/01\/Decision-Tree-vis.png 5946w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2023\/01\/Decision-Tree-vis-300x216.png 300w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2023\/01\/Decision-Tree-vis-1024x739.png 1024w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2023\/01\/Decision-Tree-vis-1536x1108.png 1536w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2023\/01\/Decision-Tree-vis-2048x1477.png 2048w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2023\/01\/Decision-Tree-vis-300x216@2x.png 600w\" sizes=\"(max-width: 5946px) 100vw, 5946px\" \/><p id=\"caption-attachment-5647115\" class=\"wp-caption-text\">Visualization of the Decision Tree<\/p><\/div>\n<p>Next, we&#8217;ll show you how to wrap that simple code into a Lightning component that will run our training job. To run a long-running task like downloading a dataset or training a machine learning model, we use <code>LightningWork<\/code>.<\/p>\n<p>First, create a class <code>SKLearnTraining<\/code> that inherits <code>LightningWork<\/code> and defines the <code>run<\/code> method where you will implement all of the necessary steps for training your model. You can also configure hardware settings like CPU, RAM, and disk size using the <code>CloudCompute<\/code> API.<\/p>\n<pre class=\"code-shortcode dark-theme window- collapse-false \" style=\"--height:falsepx\"><code class=\"language-python\">\n\n# !pip install -U scikit-learn<br \/>\nimport lightning as L<br \/>\nfrom lightning.app.storage import Drive\n\nfrom sklearn.datasets import load_iris<br \/>\nfrom sklearn import tree<br \/>\nfrom joblib import dump, load\n\nclass SKLearnTraining(L.LightningWork):<br \/>\ndef __init__(self):<br \/>\n# we use CloudCompute API to configure the machine-related config<br \/>\n# create a CPU machine with 10 GB disk size<br \/>\nsuper().__init__(cloud_compute=L.CloudCompute(\"cpu\", disk_size=10))\n\n# cloud persistable storage for model checkpoint<br \/>\nself.model_storage = Drive(\"lit:\/\/checkpoints\")\n\ndef run(self):<br \/>\n# Step 1<br \/>\n# Download the dataset<br \/>\niris = load_iris()<br \/>\nX, y = iris.data, iris.target\n\n# Split the dataset into training and test set<br \/>\nX_train, X_test, y_train, y_test = train_test_split(X, y)\n\n# Step 2<br \/>\n# Intialize the model<br \/>\nclf = tree.DecisionTreeClassifier()\n\n# Step 3<br \/>\n# Train the model<br \/>\nclf = clf.fit(X_train, y_train)\n\n# check accuracy<br \/>\nprint(f\"train accuracy: {clf.score(X_train, y_train)}\")<br \/>\nprint(f\"test accuracy: {clf.score(X_test, y_test)}\")\n\n# Step 4<br \/>\n# Save the model<br \/>\ndump(clf, 'model.joblib')\n\nself.model_storage.put(\"model.joblib\")<br \/>\nprint(\"model trained and saved successfully\")\n\ncomponent = SKLearnTraining()<br \/>\napp = L.LightningApp(component)\n\n<\/code><div class=\"copy-button\"><button class=\"expand-button\">Expand<\/button><button class=\"copy\">Copy<\/button><\/div><\/pre>\n<p>In order to deploy or fine-tune this model in the future, first you need to save it. Lightning provides the <code>Drive<\/code> API, a central place for components to share data. You can store your model in the drive and easily access it from a different component in your workflow like a deployment pipeline. You can also manually download the model from your Lightning App dashboard.<\/p>\n<p>To run this application, first you have to create an <code>app<\/code> object using <code>LightningApp<\/code> and save the module as <code>app.py<\/code>.<\/p>\n<p>Finally, to run this training process on the cloud, simply run <code>lightning run app app.py --cloud<\/code>. To run this process locally, simply drop the <code>--cloud<\/code> flag.<\/p>\n<p>You can now monitor your training progress logs and check the model checkpoint directly from your Lightning AI account. Begin by viewing your Lightning Apps, select the App that you&#8217;ve launched, and navigate through your code, logs, and artifacts. You can also download your saved model from the Artifacts menu, as pictured below.<\/p>\n<div id=\"attachment_5647116\" style=\"width: 2570px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-5647116\" class=\"size-full wp-image-5647116\" src=\"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2023\/01\/Lightning-Web-Dashboard.png\" alt=\"\" width=\"2560\" height=\"934\" srcset=\"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2023\/01\/Lightning-Web-Dashboard.png 2560w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2023\/01\/Lightning-Web-Dashboard-300x109.png 300w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2023\/01\/Lightning-Web-Dashboard-1024x374.png 1024w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2023\/01\/Lightning-Web-Dashboard-1536x560.png 1536w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2023\/01\/Lightning-Web-Dashboard-2048x747.png 2048w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2023\/01\/Lightning-Web-Dashboard-300x109@2x.png 600w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><p id=\"caption-attachment-5647116\" class=\"wp-caption-text\">Lightning AI Web Dashboard<\/p><\/div>\n<p>With just a few lines of code, Lightning makes it easy to train a model on the cloud, configure your hardware, and enable your model to persist for later use.<\/p>\n<p>Now that your model is trained, you can also do much more, like:<\/p>\n<ul>\n<li>Consume the trained model for deployment<\/li>\n<li>Schedule a training job<\/li>\n<li>Trigger the training job based on a condition, like a new data stream<\/li>\n<li>Perform hyperparameter optimization on the cloud<\/li>\n<\/ul>\n<h2>Migrate existing training to Lightning<\/h2>\n<p>If you already have a Scikit-learn training process on your local system (or another cloud), all you need to do to migrate to Lightning is create a <code>LightningWork<\/code> class and define the <code>run<\/code> method.<\/p>\n<p>You can define all of the configs in the <code>__init__<\/code> method and move the training code to the run method.<\/p>\n<p>Signing up for a Lightning account is free! Every month, you get 3 free credits delivered directly to your account that you can use to train models and run applications on the cloud.<\/p>\n<a target=\"blank\" href=\"https:\/\/lightning.ai\" class=\"d-inline-block btn btn-blue\">Get started with Lightning!<\/a>\n","protected":false},"excerpt":{"rendered":"<p>The scale of machine learning datasets can often become large enough that migrating to a cloud provider for training, storing checkpoints, and logs becomes necessary. Making this migration, however, brings with it a host of attendant cloud infrastructure overhead that can be new to (and difficult for!) machine learning engineering teams. In this blog post,<a class=\"excerpt-read-more\" href=\"https:\/\/lightning.ai\/pages\/community\/tutorial\/train-scikit-learn-models\/\" title=\"ReadTrain Scikit-learn Models on the Cloud\">&#8230; Read more &raquo;<\/a><\/p>\n","protected":false},"author":16,"featured_media":5647123,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":"","_links_to":"","_links_to_target":""},"categories":[41],"tags":[96,137,115,97,135,134,136],"glossary":[],"acf":{"additional_authors":false,"hide_from_archive":false,"content_type":"Blog Post","custom_styles":""},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Train Scikit-learn Models on the Cloud<\/title>\n<meta name=\"description\" content=\"In this blog post, you&#039;ll learn how to train Scikit-learn models on the cloud with just a few lines of code using Lightning.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/lightning.ai\/pages\/community\/tutorial\/train-scikit-learn-models\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Train Scikit-learn Models on the Cloud\" \/>\n<meta property=\"og:description\" content=\"In this blog post, you&#039;ll learn how to train Scikit-learn models on the cloud with just a few lines of code using Lightning.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/lightning.ai\/pages\/community\/tutorial\/train-scikit-learn-models\/\" \/>\n<meta property=\"og:site_name\" content=\"Lightning AI\" \/>\n<meta property=\"article:published_time\" content=\"2023-01-12T19:27:18+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-03-07T22:09:34+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2023\/01\/Scikit-learn-social.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2175\" \/>\n\t<meta property=\"og:image:height\" content=\"1125\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"JP Hennessy\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2023\/01\/Scikit-learn-social.jpg\" \/>\n<meta name=\"twitter:creator\" content=\"@LightningAI\" \/>\n<meta name=\"twitter:site\" content=\"@LightningAI\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"JP Hennessy\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/lightning.ai\/pages\/community\/tutorial\/train-scikit-learn-models\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/lightning.ai\/pages\/community\/tutorial\/train-scikit-learn-models\/\"},\"author\":{\"name\":\"JP Hennessy\",\"@id\":\"https:\/\/lightning.ai\/pages\/#\/schema\/person\/2518f4d5541f8e98016f6289169141a6\"},\"headline\":\"Train Scikit-learn Models on the Cloud\",\"datePublished\":\"2023-01-12T19:27:18+00:00\",\"dateModified\":\"2023-03-07T22:09:34+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/lightning.ai\/pages\/community\/tutorial\/train-scikit-learn-models\/\"},\"wordCount\":1037,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/lightning.ai\/pages\/#organization\"},\"image\":{\"@id\":\"https:\/\/lightning.ai\/pages\/community\/tutorial\/train-scikit-learn-models\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2023\/01\/Scikit-learn-social.jpg\",\"keywords\":[\"ai\",\"cloud\",\"deploy\",\"ml\",\"model\",\"scikit-learn\",\"train\"],\"articleSection\":[\"Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/lightning.ai\/pages\/community\/tutorial\/train-scikit-learn-models\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/lightning.ai\/pages\/community\/tutorial\/train-scikit-learn-models\/\",\"url\":\"https:\/\/lightning.ai\/pages\/community\/tutorial\/train-scikit-learn-models\/\",\"name\":\"Train Scikit-learn Models on the Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/lightning.ai\/pages\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/lightning.ai\/pages\/community\/tutorial\/train-scikit-learn-models\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/lightning.ai\/pages\/community\/tutorial\/train-scikit-learn-models\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2023\/01\/Scikit-learn-social.jpg\",\"datePublished\":\"2023-01-12T19:27:18+00:00\",\"dateModified\":\"2023-03-07T22:09:34+00:00\",\"description\":\"In this blog post, you'll learn how to train Scikit-learn models on the cloud with just a few lines of code using Lightning.\",\"breadcrumb\":{\"@id\":\"https:\/\/lightning.ai\/pages\/community\/tutorial\/train-scikit-learn-models\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/lightning.ai\/pages\/community\/tutorial\/train-scikit-learn-models\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/lightning.ai\/pages\/community\/tutorial\/train-scikit-learn-models\/#primaryimage\",\"url\":\"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2023\/01\/Scikit-learn-social.jpg\",\"contentUrl\":\"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2023\/01\/Scikit-learn-social.jpg\",\"width\":1200,\"height\":621},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/lightning.ai\/pages\/community\/tutorial\/train-scikit-learn-models\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/lightning.ai\/pages\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Train Scikit-learn Models on the Cloud\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/lightning.ai\/pages\/#website\",\"url\":\"https:\/\/lightning.ai\/pages\/\",\"name\":\"Lightning AI\",\"description\":\"The platform for teams to build AI.\",\"publisher\":{\"@id\":\"https:\/\/lightning.ai\/pages\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/lightning.ai\/pages\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/lightning.ai\/pages\/#organization\",\"name\":\"Lightning AI\",\"url\":\"https:\/\/lightning.ai\/pages\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/lightning.ai\/pages\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2023\/02\/image-17.png\",\"contentUrl\":\"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2023\/02\/image-17.png\",\"width\":1744,\"height\":856,\"caption\":\"Lightning AI\"},\"image\":{\"@id\":\"https:\/\/lightning.ai\/pages\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/LightningAI\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/lightning.ai\/pages\/#\/schema\/person\/2518f4d5541f8e98016f6289169141a6\",\"name\":\"JP Hennessy\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/lightning.ai\/pages\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/28ade268218ae45f723b0b62499f527a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/28ade268218ae45f723b0b62499f527a?s=96&d=mm&r=g\",\"caption\":\"JP Hennessy\"},\"url\":\"https:\/\/lightning.ai\/pages\/author\/jplightning-ai\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Train Scikit-learn Models on the Cloud","description":"In this blog post, you'll learn how to train Scikit-learn models on the cloud with just a few lines of code using Lightning.","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:\/\/lightning.ai\/pages\/community\/tutorial\/train-scikit-learn-models\/","og_locale":"en_US","og_type":"article","og_title":"Train Scikit-learn Models on the Cloud","og_description":"In this blog post, you'll learn how to train Scikit-learn models on the cloud with just a few lines of code using Lightning.","og_url":"https:\/\/lightning.ai\/pages\/community\/tutorial\/train-scikit-learn-models\/","og_site_name":"Lightning AI","article_published_time":"2023-01-12T19:27:18+00:00","article_modified_time":"2023-03-07T22:09:34+00:00","og_image":[{"width":2175,"height":1125,"url":"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2023\/01\/Scikit-learn-social.png","type":"image\/png"}],"author":"JP Hennessy","twitter_card":"summary_large_image","twitter_image":"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2023\/01\/Scikit-learn-social.jpg","twitter_creator":"@LightningAI","twitter_site":"@LightningAI","twitter_misc":{"Written by":"JP Hennessy","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/lightning.ai\/pages\/community\/tutorial\/train-scikit-learn-models\/#article","isPartOf":{"@id":"https:\/\/lightning.ai\/pages\/community\/tutorial\/train-scikit-learn-models\/"},"author":{"name":"JP Hennessy","@id":"https:\/\/lightning.ai\/pages\/#\/schema\/person\/2518f4d5541f8e98016f6289169141a6"},"headline":"Train Scikit-learn Models on the Cloud","datePublished":"2023-01-12T19:27:18+00:00","dateModified":"2023-03-07T22:09:34+00:00","mainEntityOfPage":{"@id":"https:\/\/lightning.ai\/pages\/community\/tutorial\/train-scikit-learn-models\/"},"wordCount":1037,"commentCount":0,"publisher":{"@id":"https:\/\/lightning.ai\/pages\/#organization"},"image":{"@id":"https:\/\/lightning.ai\/pages\/community\/tutorial\/train-scikit-learn-models\/#primaryimage"},"thumbnailUrl":"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2023\/01\/Scikit-learn-social.jpg","keywords":["ai","cloud","deploy","ml","model","scikit-learn","train"],"articleSection":["Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/lightning.ai\/pages\/community\/tutorial\/train-scikit-learn-models\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/lightning.ai\/pages\/community\/tutorial\/train-scikit-learn-models\/","url":"https:\/\/lightning.ai\/pages\/community\/tutorial\/train-scikit-learn-models\/","name":"Train Scikit-learn Models on the Cloud","isPartOf":{"@id":"https:\/\/lightning.ai\/pages\/#website"},"primaryImageOfPage":{"@id":"https:\/\/lightning.ai\/pages\/community\/tutorial\/train-scikit-learn-models\/#primaryimage"},"image":{"@id":"https:\/\/lightning.ai\/pages\/community\/tutorial\/train-scikit-learn-models\/#primaryimage"},"thumbnailUrl":"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2023\/01\/Scikit-learn-social.jpg","datePublished":"2023-01-12T19:27:18+00:00","dateModified":"2023-03-07T22:09:34+00:00","description":"In this blog post, you'll learn how to train Scikit-learn models on the cloud with just a few lines of code using Lightning.","breadcrumb":{"@id":"https:\/\/lightning.ai\/pages\/community\/tutorial\/train-scikit-learn-models\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/lightning.ai\/pages\/community\/tutorial\/train-scikit-learn-models\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/lightning.ai\/pages\/community\/tutorial\/train-scikit-learn-models\/#primaryimage","url":"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2023\/01\/Scikit-learn-social.jpg","contentUrl":"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2023\/01\/Scikit-learn-social.jpg","width":1200,"height":621},{"@type":"BreadcrumbList","@id":"https:\/\/lightning.ai\/pages\/community\/tutorial\/train-scikit-learn-models\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/lightning.ai\/pages\/"},{"@type":"ListItem","position":2,"name":"Train Scikit-learn Models on the Cloud"}]},{"@type":"WebSite","@id":"https:\/\/lightning.ai\/pages\/#website","url":"https:\/\/lightning.ai\/pages\/","name":"Lightning AI","description":"The platform for teams to build AI.","publisher":{"@id":"https:\/\/lightning.ai\/pages\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/lightning.ai\/pages\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/lightning.ai\/pages\/#organization","name":"Lightning AI","url":"https:\/\/lightning.ai\/pages\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/lightning.ai\/pages\/#\/schema\/logo\/image\/","url":"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2023\/02\/image-17.png","contentUrl":"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2023\/02\/image-17.png","width":1744,"height":856,"caption":"Lightning AI"},"image":{"@id":"https:\/\/lightning.ai\/pages\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/LightningAI"]},{"@type":"Person","@id":"https:\/\/lightning.ai\/pages\/#\/schema\/person\/2518f4d5541f8e98016f6289169141a6","name":"JP Hennessy","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/lightning.ai\/pages\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/28ade268218ae45f723b0b62499f527a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/28ade268218ae45f723b0b62499f527a?s=96&d=mm&r=g","caption":"JP Hennessy"},"url":"https:\/\/lightning.ai\/pages\/author\/jplightning-ai\/"}]}},"_links":{"self":[{"href":"https:\/\/lightning.ai\/pages\/wp-json\/wp\/v2\/posts\/5647111"}],"collection":[{"href":"https:\/\/lightning.ai\/pages\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lightning.ai\/pages\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lightning.ai\/pages\/wp-json\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/lightning.ai\/pages\/wp-json\/wp\/v2\/comments?post=5647111"}],"version-history":[{"count":0,"href":"https:\/\/lightning.ai\/pages\/wp-json\/wp\/v2\/posts\/5647111\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lightning.ai\/pages\/wp-json\/wp\/v2\/media\/5647123"}],"wp:attachment":[{"href":"https:\/\/lightning.ai\/pages\/wp-json\/wp\/v2\/media?parent=5647111"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lightning.ai\/pages\/wp-json\/wp\/v2\/categories?post=5647111"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lightning.ai\/pages\/wp-json\/wp\/v2\/tags?post=5647111"},{"taxonomy":"glossary","embeddable":true,"href":"https:\/\/lightning.ai\/pages\/wp-json\/wp\/v2\/glossary?post=5647111"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}