{
  "source_file": "0930",
  "source_platform": "Medium",
  "author": "Cristian Leo",
  "title_listed": "AutoML with AutoGluon: Transform Your ML Workflow with Just Four Lines of Code",
  "keywords": "",
  "domain": "机器学习",
  "content_type": "深度技术解析",
  "is_paid_flag": "否",
  "url": "https://towardsdatascience.com/automl-with-autogluon-transform-your-ml-workflow-with-just-four-lines-of-code-1d4b593be129/",
  "publish_date": "2024-07-03",
  "corpus_stage": "",
  "notes": "",
  "id": "de4b4afa15d6",
  "collected_at": "2026-10-02T06:07:44",
  "title": "AutoML with AutoGluon: Transform Your ML Workflow with Just Four Lines of Code | Towards Data Science",
  "body_markdown": "![Revisit consent button](../images/body-df29beacd7496220cc94.svg)\nWe value your privacy\nWe use cookies to enhance your browsing experience, serve personalised ads or content, and analyse our traffic. By clicking \"Accept All\", you consent to our use of cookies.\nCustomise Reject All Accept All\nCustomise Consent Preferences ![](../images/body-2159bb67f3de8ad870eb.svg)\nWe use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.\nThe cookies that are categorised as \"Necessary\" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... Show more\nNecessaryAlways Active\nNecessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.\n  * Cookie\nBCTempID\n  * Duration\n10 minutes\n  * Description\nNo description available.\n\n\n  * Cookie\n__cf_bm\n  * Duration\n1 hour\n  * Description\nThis cookie, set by Cloudflare, is used to support Cloudflare Bot Management. \n\n\n  * Cookie\nAWSALBCORS\n  * Duration\n7 days\n  * Description\nAmazon Web Services set this cookie for load balancing.\n\n\n  * Cookie\n_cfuvid\n  * Duration\nsession\n  * Description\nCloudflare sets this cookie to track users across sessions to optimize user experience by maintaining session consistency and providing personalized services\n\n\n  * Cookie\nli_gc\n  * Duration\n6 months\n  * Description\nLinkedin set this cookie for storing visitor's consent regarding using cookies for non-essential purposes.\n\n\n  * Cookie\n__hssrc\n  * Duration\nsession\n  * Description\nThis cookie is set by Hubspot whenever it changes the session cookie. The __hssrc cookie set to 1 indicates that the user has restarted the browser, and if the cookie does not exist, it is assumed to be a new session.\n\n\n  * Cookie\n__hssc\n  * Duration\n1 hour\n  * Description\nHubSpot sets this cookie to keep track of sessions and to determine if HubSpot should increment the session number and timestamps in the __hstc cookie.\n\n\n  * Cookie\nwpEmojiSettingsSupports\n  * Duration\nsession\n  * Description\nWordPress sets this cookie when a user interacts with emojis on a WordPress site. It helps determine if the user's browser can display emojis properly.\n\n\n  * Cookie\nBCSessionID\n  * Duration\n1 year 1 month 4 days\n  * Description\nBlueconic sets this cookie as a unique identifier for the BlueConic profile.\n\n\n  * Cookie\n_octo\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nlogged_in\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\n__Secure-YEC\n  * Duration\npast\n  * Description\nYouTube sets this cookie to stores the user's video player preferences using embedded YouTube video\n\n\n  * Cookie\n__eoi\n  * Duration\n6 months\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nAWSALBTGCORS\n  * Duration\n7 days\n  * Description\nNo description available.\n\n\n  * Cookie\nlogin-status-p\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nAWSALBTG\n  * Duration\n7 days\n  * Description\nNo description available.\n\n\n  * Cookie\ncsrf_token\n  * Duration\nsession\n  * Description\nNo description available.\n\n\n  * Cookie\ntoken_v2\n  * Duration\n1 day\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nD\n  * Duration\n1 year\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nPHPSESSID\n  * Duration\nsession\n  * Description\nThis cookie is native to PHP applications. The cookie stores and identifies a user's unique session ID to manage user sessions on the website. The cookie is a session cookie and will be deleted when all the browser windows are closed.\n\n\n  * Cookie\nVISITOR_PRIVACY_METADATA\n  * Duration\n6 months\n  * Description\nYouTube sets this cookie to store the user's cookie consent state for the current domain. \n\n\n  * Cookie\ncookietest\n  * Duration\nsession\n  * Description\nThe cookietest cookie is typically used to determine whether the user's browser accepts cookies, essential for website functionality and user experience.\n\n\n  * Cookie\n__Host-airtable-session\n  * Duration\n1 year\n  * Description\nThis cookie is used to enable us to integrate the services of Airtable.\n\n\n  * Cookie\n__Host-airtable-session.sig\n  * Duration\n1 year\n  * Description\nThis cookie is used to enable us to integrate the services of Airtable.\n\n\n  * Cookie\nm\n  * Duration\n1 year 1 month 4 days\n  * Description\nStripe sets this cookie for fraud prevention purposes. It identifies the device used to access the website, allowing the website to be formatted accordingly.\n\n\n  * Cookie\nBIGipServer*\n  * Duration\nsession\n  * Description\nMarketo sets this cookie to collect information about the user's online activity and build a profile about their interests to provide advertisements relevant to the user. \n\n\n  * Cookie\n__cfruid\n  * Duration\nsession\n  * Description\nCloudflare sets this cookie to identify trusted web traffic.\n\n\n  * Cookie\n_GRECAPTCHA\n  * Duration\n6 months\n  * Description\nGoogle Recaptcha service sets this cookie to identify bots to protect the website against malicious spam attacks.\n\n\n  * Cookie\n__Secure-YNID\n  * Duration\n6 months\n  * Description\nGoogle cookie used to protect user security and prevent fraud, especially during the login process.\n\n\n  * Cookie\ncookieyes-consent\n  * Duration\n1 year\n  * Description\nCookieYes sets this cookie to remember users' consent preferences so that their preferences are respected on subsequent visits to this site. It does not collect or store any personal information about the site visitors.\n\n\nFunctional\nFunctional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.\n  * Cookie\nlidc\n  * Duration\n1 day\n  * Description\nLinkedIn sets the lidc cookie to facilitate data center selection.\n\n\n  * Cookie\nbrw\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nbrwConsent\n  * Duration\n5 minutes\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nWMF-Uniq\n  * Duration\n1 year\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nloom_anon_comment\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nloom_referral_video\n  * Duration\nsession\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nVISITOR_INFO1_LIVE\n  * Duration\n6 months\n  * Description\nA cookie set by YouTube to measure bandwidth that determines whether the user gets the new or old player interface.\n\n\n  * Cookie\nyt-remote-connected-devices\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to store the user's video preferences using embedded YouTube videos.\n\n\n  * Cookie\nytidb::LAST_RESULT_ENTRY_KEY\n  * Duration\nNever Expires\n  * Description\nThe cookie ytidb::LAST_RESULT_ENTRY_KEY is used by YouTube to store the last search result entry that was clicked by the user. This information is used to improve the user experience by providing more relevant search results in the future.\n\n\n  * Cookie\nyt-remote-device-id\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to store the user's video preferences using embedded YouTube videos.\n\n\n  * Cookie\nyt-remote-session-name\n  * Duration\nsession\n  * Description\nThe yt-remote-session-name cookie is used by YouTube to store the user's video player preferences using embedded YouTube video.\n\n\n  * Cookie\nyt-remote-fast-check-period\n  * Duration\nsession\n  * Description\nThe yt-remote-fast-check-period cookie is used by YouTube to store the user's video player preferences for embedded YouTube videos.\n\n\n  * Cookie\nyt-remote-session-app\n  * Duration\nsession\n  * Description\nThe yt-remote-session-app cookie is used by YouTube to store user preferences and information about the interface of the embedded YouTube video player.\n\n\n  * Cookie\nyt-remote-cast-available\n  * Duration\nsession\n  * Description\nThe yt-remote-cast-available cookie is used to store the user's preferences regarding whether casting is available on their YouTube video player.\n\n\n  * Cookie\nyt-remote-cast-installed\n  * Duration\nsession\n  * Description\nThe yt-remote-cast-installed cookie is used to store the user's video player preferences using embedded YouTube video.\n\n\n  * Cookie\ncp_session\n  * Duration\n3 months\n  * Description\nCodepen sets this cookie for Help systems found in the website.\n\n\n  * Cookie\nloid\n  * Duration\n1 year 1 month 4 days\n  * Description\nThis cookie is set by the Reddit. The cookie enables the sharing of content from the website onto the social media platform.\n\n\nAnalytics\nAnalytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.\n  * Cookie\n__hstc\n  * Duration\n6 months\n  * Description\nHubspot set this main cookie for tracking visitors. It contains the domain, initial timestamp (first visit), last timestamp (last visit), current timestamp (this visit), and session number (increments for each subsequent session).\n\n\n  * Cookie\nhubspotutk\n  * Duration\n6 months\n  * Description\nHubSpot sets this cookie to keep track of the visitors to the website. This cookie is passed to HubSpot on form submission and used when deduplicating contacts.\n\n\n  * Cookie\n_ga\n  * Duration\n1 year 1 month 4 days\n  * Description\nGoogle Analytics sets this cookie to calculate visitor, session and campaign data and track site usage for the site's analytics report. The cookie stores information anonymously and assigns a randomly generated number to recognise unique visitors.\n\n\n  * Cookie\n_ga_*\n  * Duration\n1 year 1 month 4 days\n  * Description\nGoogle Analytics sets this cookie to store and count page views.\n\n\n  * Cookie\n__Host-psifi.analyticsTrace\n  * Duration\n6 hours\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\n__Host-psifi.analyticsTraceV2\n  * Duration\n6 hours\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\n_gh_sess\n  * Duration\nsession\n  * Description\nGitHub sets this cookie for temporary application and framework state between pages like what step the user is on in a multiple step form.\n\n\n  * Cookie\nYSC\n  * Duration\nsession\n  * Description\nYSC cookie is set by Youtube and is used to track the views of embedded videos on Youtube pages.\n\n\n  * Cookie\najs_anonymous_id\n  * Duration\n1 year\n  * Description\nThis cookie is set by Segment to count the number of people who visit a certain site by tracking if they have visited before.\n\n\n  * Cookie\nvuid\n  * Duration\n1 year 1 month 4 days\n  * Description\nVimeo installs this cookie to collect tracking information by setting a unique ID to embed videos on the website. \n\n\nPerformance\nPerformance cookies are used to understand and analyse the key performance indexes of the website which helps in delivering a better user experience for the visitors.\n  * Cookie\nAWSALB\n  * Duration\n7 days\n  * Description\nAWSALB is an application load balancer cookie set by Amazon Web Services to map the session to the target.\n\n\n  * Cookie\nacq\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nacq.sig\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nptc\n  * Duration\n2 years\n  * Description\nNo description available.\n\n\nAdvertisement\nAdvertisement cookies are used to provide visitors with customised advertisements based on the pages you visited previously and to analyse the effectiveness of the ad campaigns.\n  * Cookie\nmuc_ads\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to collect user behaviour and interaction data to optimize the website.\n\n\n  * Cookie\nguest_id_marketing\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor.\n\n\n  * Cookie\nguest_id_ads\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor.\n\n\n  * Cookie\npersonalization_id\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to integrate and share features for social media and also store information about how the user uses the website, for tracking and targeting.\n\n\n  * Cookie\nguest_id\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor. It registers if a user is signed in to the Twitter platform and collects information about ad preferences.\n\n\n  * Cookie\nbcookie\n  * Duration\n1 year\n  * Description\nLinkedIn sets this cookie from LinkedIn share buttons and ad tags to recognize browser IDs.\n\n\n  * Cookie\n__Secure-ROLLOUT_TOKEN\n  * Duration\n6 months\n  * Description\nYouTube sets this cookie to manage feature rollout and experimentation. It helps Google control which new features or interface changes are shown to users as part of testing and staged rollouts, ensuring consistent experience for a given user during an experiment.\n\n\n  * Cookie\nyt.innertube::nextId\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.\n\n\n  * Cookie\nyt.innertube::requests\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.\n\n\n  * Cookie\nsession_tracker\n  * Duration\nsession\n  * Description\nThis cookie is set by the Reddit. This cookie is used to identify trusted web traffic. It also helps in adverstising on the website.\n\n\n  * Cookie\nedgebucket\n  * Duration\nsession\n  * Description\nReddit sets this cookie to save the information about a log-on Reddit user, for the purpose of advertisement recommendations and updating the content.\n\n\n  * Cookie\ndid\n  * Duration\n1 year\n  * Description\nArbor sets this cookie to show targeted ads to site visitors.This cookie expires after 2 months or 1 year.\n\n\nUncategorised\nOther uncategorised cookies are those that are being analysed and have not been classified into a category as yet.\nNo cookies to display.\nReject All Save My Preferences Accept All\nToggle Search[](https://towardsdatascience.com/)Toggle Mobile Navigation\n[](https://towardsdatascience.com/)\nPublish AI, ML & data-science insights to a global community of data professionals.\nSign in[Submit an Article](https://write.insightmediagroup.io)\n[Latest](https://towardsdatascience.com/latest/)[Editor's Picks](https://towardsdatascience.com/tag/editors-pick/)[Newsletter](https://towardsdatascience.com/tag/the-variable/)[ShipAI](https://towardsdatascience.com/shipai/)\n* * *\n[Write For TDS](https://towardsdatascience.com/submissions/)\n[LinkedIn](https://www.linkedin.com/company/towards-data-science/)[X](https://x.com/TDataScience)Toggle Search\n[Programming](https://towardsdatascience.com/category/programming/)\n# AutoML with AutoGluon: Transform Your ML Workflow with Just Four Lines of Code\nHow AutoGluon Dominated Kaggle Competitions and How You Can Beat It. The algorithm that beats 99% of Data Scientists with 4 lines of code.\n[Cristian Leo](https://towardsdatascience.com/author/cristianleo120/)\nJuly 3, 202420 min read\n# AutoML with AutoGluon: ML workflow with Just Four Lines of Code\n![Image generated by DALL-E](../images/000.jpg)\nImage generated by DALL-E\n> In two popular Kaggle competitions, AutoGluon beat 99% of the participating data scientists after merely 4h of training on the raw data (AutoGluon Team. \"AutoGluon: AutoML for Text, Image, and Tabular Data.\" 2020)\nThis statement, taken from the [AutoGluon research paper](https://arxiv.org/abs/2003.06505), perfectly captures what we will explore today: a machine-learning framework that delivers impressive performance with minimal coding. You only need four lines of code to set up a complete ML pipeline, a task that could otherwise take hours. Yes, just four lines of code! See for yourself:\npython\n\n```\nfrom autogluon.tabular import TabularDataset, TabularPredictor\n\ntrain_data = TabularDataset('train.csv')\npredictor = TabularPredictor(label='Target').fit(train_data, presets='best_quality')\npredictions = predictor.predict(train_data)\n```\n\nThese four lines handle data preprocessing by automatically recognizing the data type of each column, feature engineering by finding useful column combinations, and model training through ensembling to identify the best-performing model within a given time. Notice that I didn't even specify the type of machine learning task (regression/classification). AutoGluon examines the label and determines the task on its own.\nAm I advocating for this algorithm? Not necessarily. While I appreciate the power of AutoGluon, I prefer solutions that don't reduce data science to mere accuracy scores in a Kaggle competition. However, as these models become increasingly popular and widely adopted, it's important to understand how they work, the math and code behind them, and how you can leverage or outperform them.\n## 1: AutoGluon Overview\nAutoGluon is an open-source machine-learning library created by Amazon Web Services (AWS). It's designed to handle the entire ML process for you, from preparing your data to selecting the best model and tuning its settings.\nAutoGluon combines simplicity with top-notch performance. It employs advanced techniques like ensemble learning and automatic hyperparameter tuning to ensure that the models you create are highly accurate. This means you can develop powerful machine-learning solutions without getting bogged down in the technical details.\nThe library takes care of data preprocessing, feature selection, model training, and evaluation, which significantly reduces the time and effort required to build robust machine-learning models. Additionally, AutoGluon scales well, making it suitable for both small projects and large, complex datasets.\nFor tabular data, AutoGluon can handle both classification tasks, where you categorize data into different groups, and regression tasks, where you predict continuous outcomes. It also supports text data, making it useful for tasks like sentiment analysis or topic categorization. Moreover, it can manage image data, assisting with image recognition and object detection. Although several variations of AutoGluon were built to better handle time-series data, text, and image, here we will focus on the variation to handle tabular data. Let me know if you liked this article and would like future deep dives into its variations. (AutoGluon Team. \"AutoGluon: AutoML for Text, Image, and Tabular Data.\" 2020)\n## 2: The Space of AutoML\n### **2.1: What is AutoML?**\nAutoML, short for Automated Machine Learning, is a technology that automates the entire process of applying machine learning to real-world problems. The main goal of AutoML is to make machine learning more accessible and efficient, allowing people to develop models without needing deep expertise. As we've already seen, it handles tasks like data preprocessing, feature engineering, model selection, and hyperparameter tuning, which are usually complex and time-consuming ([He et al., \"AutoML: A Survey of the State-of-the-Art,\" 2019](https://www.arxiv.org/abs/1908.00709)).\nThe concept of AutoML has evolved significantly over the years. Initially, machine learning required a lot of manual effort from experts who had to carefully select features, tune hyperparameters, and choose the right algorithms. As the field grew, so did the need for automation to handle increasingly large and complex datasets. Early efforts to automate parts of the process paved the way for modern AutoML systems. Today, AutoML uses advanced techniques like ensemble learning and Bayesian optimization to create high-quality models with minimal human intervention ([Feurer et al., \"Efficient and Robust Automated Machine Learning,\" 2015](https://papers.nips.cc/paper_files/paper/2015/hash/11d0e6287202fced83f79975ec59a3a6-Abstract.html)).\nSeveral players have emerged in the AutoML space, each offering unique features and capabilities. AutoGluon, developed by Amazon Web Services, is known for its ease of use and strong performance across various data types (AutoGluon Team, \"AutoGluon: AutoML for Text, Image, and Tabular Data,\" 2020). Google Cloud AutoML provides a suite of machine-learning products that allow developers to train high-quality models with minimal effort. H2O.ai offers H2O AutoML, which provides automatic machine-learning capabilities for both supervised and unsupervised learning tasks ([H2O.ai, \"H2O AutoML: Scalable Automatic Machine Learning,\" 2020](https://www.automl.org/wp-content/uploads/2020/07/AutoML_2020_paper_61.pdf)). DataRobot focuses on enterprise-level AutoML solutions, offering robust tools for model deployment and management. Microsoft's Azure Machine Learning also features AutoML capabilities, integrating seamlessly with other Azure services for a comprehensive machine learning solution.\n### **2.2: Key Components of AutoML**\n![AutoGluon Workflow - Image by Author](../images/001.png)\nAutoGluon Workflow - Image by Author\nThe first step in any machine learning pipeline is **data preprocessing**. This involves cleaning the data by handling missing values, removing duplicates, and correcting errors. Data preprocessing also includes transforming the data into a format suitable for analysis, such as normalizing values, encoding categorical variables, and scaling features. Proper data preprocessing is crucial because the quality of the data directly impacts the performance of the machine learning models.\nOnce the data is cleaned, the next step is **feature engineering**. This process involves creating new features or modifying existing ones to improve the model's performance. Feature engineering can be as simple as creating new columns based on existing data or as complex as using domain knowledge to create meaningful features. The right features can significantly enhance the predictive power of the models.\nWith the data ready and features engineered, the next step is **model selection**. There are many algorithms to choose from, each with its strengths and weaknesses depending on the problem at hand. AutoML systems evaluate multiple models to identify the best one for the given task. This might involve comparing models like decision trees, support vector machines, neural networks, and others to see which performs best with the data.\nAfter selecting a model, the next challenge is **hyperparameter optimization**. Hyperparameters are settings that control the behavior of the machine learning algorithm, such as the learning rate in neural networks or the depth of decision trees. Finding the optimal combination of hyperparameters can greatly improve model performance. AutoML uses techniques like grid search, random search, and more advanced methods like Bayesian optimization to automate this process, ensuring the model is fine-tuned for the best results.\nThe final step is **model evaluation and selection**. This involves using techniques like cross-validation to assess how well the model generalizes to new data. Various performance metrics, such as accuracy, precision, recall, and F1-score, are used to measure the model's effectiveness. AutoML systems automate this evaluation process, ensuring that the model selected is the best fit for the task. Once the evaluation is complete, the best-performing model is chosen for deployment (AutoGluon Team. \"AutoGluon: AutoML for Text, Image, and Tabular Data.\" 2020).\n### **2.3: Challenges of AutoML**\nWhile AutoML saves time and effort, it can be quite demanding in terms of computational resources. Automating tasks like hyperparameter tuning and model selection often requires running many iterations and training multiple models, which can be a challenge for smaller organizations or individuals without access to high-performance computing.\nAnother challenge is the need for customization. Although AutoML systems are highly effective in many situations, they might not always meet specific requirements right out of the box. Sometimes, the automated processes may not fully capture the unique aspects of a particular dataset or problem. Users may need to tweak parts of the workflow, which can be difficult if the system doesn't offer enough flexibility or if the user lacks the necessary expertise.\nDespite these challenges, the benefits of AutoML often outweigh the drawbacks. It greatly enhances productivity, broadens accessibility, and offers scalable solutions, enabling more people to leverage the power of machine learning (Feurer et al., \"Efficient and Robust Automated Machine Learning,\" 2015).\n## 3: The Math Behind AutoGluon\n### **3.1: AutoGluon's Architecture**\nAutoGluon's architecture is designed to automate the entire machine learning workflow, from data preprocessing to model deployment. This architecture consists of several interconnected modules, each responsible for a specific stage of the process.\nThe first step is the **Data Module** , which handles loading and preprocessing data. This module deals with tasks such as cleaning the data, addressing missing values, and transforming the data into a suitable format for analysis. For example, consider a dataset X with missing values. The Data Module might impute these missing values using the mean or median:\njava\n\n```\nfrom sklearn.impute import SimpleImputer\nimputer = SimpleImputer(strategy='mean')\nX_imputed = imputer.fit_transform(X)\n```\n\nOnce the data is preprocessed, the Feature Engineering Module takes over. This component generates new features or transforms existing ones to enhance the model's predictive power. Techniques such as one-hot encoding for categorical variables or creating polynomial features for numeric data are common. For instance, encoding categorical variables might look like this:\njava\n\n```\nfrom sklearn.preprocessing import OneHotEncoder\nencoder = OneHotEncoder()\nX_encoded = encoder.fit_transform(X)\n```\n\nAt the core of AutoGluon is the Model Module. This module includes a wide array of machine-learning algorithms, such as decision trees, neural networks, and gradient-boosting machines. It trains multiple models on the dataset and evaluates their performance. A decision tree, for example, might be trained as follows:\njava\n\n```\nfrom sklearn.tree import DecisionTreeClassifier\nmodel = DecisionTreeClassifier()\nmodel.fit(X_train, y_train)\n```\n\nThe Hyperparameter Optimization Module automates the search for the best hyperparameters for each model. It uses methods like grid search, random search, and Bayesian optimization. Bayesian optimization, as detailed in the [paper by Snoek et al. (2012)](https://arxiv.org/abs/1206.2944), builds a probabilistic model to guide the search process:\njava\n\n```\nfrom skopt import BayesSearchCV\nsearch_space = {'max_depth': (1, 32)}\nbayes_search = BayesSearchCV(estimator=DecisionTreeClassifier(), search_spaces=search_space)\nbayes_search.fit(X_train, y_train)\n```\n\nAfter training, the Evaluation Module assesses model performance using metrics like accuracy, precision, recall, and F1-score. Cross-validation is commonly used to ensure the model generalizes well to new data:\njava\n\n```\nfrom sklearn.model_selection import cross_val_score\nscores = cross_val_score(model, X, y, cv=5, scoring='accuracy')\nmean_score = scores.mean()\n```\n\nAutoGluon excels with its Ensemble Module, which combines the predictions of multiple models to produce a single, more accurate prediction. Techniques like stacking, bagging, and blending are employed. For instance, bagging can be implemented using the BaggingClassifier:\njava\n\n```\nfrom sklearn.ensemble import BaggingClassifier\nbagging = BaggingClassifier(base_estimator=DecisionTreeClassifier(), n_estimators=10)\nbagging.fit(X_train, y_train)\n```\n\nFinally, the Deployment Module handles the deployment of the best model or ensemble into production. This includes exporting the model, generating predictions on new data, and integrating the model into existing systems:\ngo\n\n```\nimport joblib\njoblib.dump(bagging, 'model.pkl')\n```\n\nThese components work together to automate the machine learning pipeline, allowing users to build and deploy high-quality models quickly and efficiently.\n### **3.2: Ensemble Learning in AutoGluon**\nEnsemble learning is a key feature of AutoGluon that enhances its ability to deliver high-performing models. By combining multiple models, ensemble methods improve predictive accuracy and robustness. AutoGluon leverages three main ensemble techniques: stacking, bagging, and blending.\n**Stacking** Stacking involves training multiple base models on the same dataset and using their predictions as input features for a higher-level model, often called a meta-model. This approach leverages the strengths of various algorithms, allowing the ensemble to make more accurate predictions. The stacking process can be mathematically represented as follows:\n![Stacking Formula - Image by Author](../images/002.png)\nStacking Formula - Image by Author\nHere, **h_1** ​ represents the base models, and **h_2** ​ is the meta-model. Each base model **h_1** ​ takes the input features **x_i** ​ and produces a prediction. These predictions are then used as input features for the meta-model **h_2** ​, which makes the final prediction **y^** ​. By combining the outputs of different base models, stacking can capture a broader range of patterns in the data, leading to improved predictive performance.\n**Bagging** Bagging, short for Bootstrap Aggregating, improves model stability and accuracy by training multiple instances of the same model on different subsets of the data. These subsets are created by randomly sampling the original dataset with replacement. The final prediction is typically made by averaging the predictions of all the models for regression tasks or by taking a majority vote for classification tasks.\nMathematically, bagging can be represented as follows:\nFor regression:\n![Regression in Bagging Formula - Image by Author](../images/003.png)\nRegression in Bagging Formula - Image by Author\nFor classification:\n![Classification in Bagging - Image by Author](../images/004.png)\nClassification in Bagging - Image by Author\nHere, **h_i** ​ represents the **i-th** model trained on a different subset of the data. For regression, the final prediction **y^** ​ is the average of the predictions made by each model. For classification, the final prediction **y^** ​ is the most frequently predicted class among the models.\nThe variance reduction effect of bagging can be illustrated by the law of large numbers, which states that the average of the predictions from multiple models will converge to the expected value, reducing the overall variance and improving the stability of the predictions. It can be illustrated as:\n![Variance Reduction in Bagging - Image by Author](../images/005.png)\nVariance Reduction in Bagging - Image by Author\nBy training on different subsets of the data, bagging also helps in reducing overfitting and increasing the generalizability of the model.\n**Blending** Blending is similar to stacking but with a simpler implementation. In blending, the data is split into two parts: the training set and the validation set. Base models are trained on the training set, and their predictions on the validation set are used to train a final model, also known as the blender or meta-learner. Blending uses a holdout validation set, which can make it faster to implement:\nmakefile\n\n```\n# Example of blending with simple train-validation split\ntrain_meta, val_meta, y_train_meta, y_val_meta = train_test_split(X, y, test_size=0.2)\nbase_model_1.fit(train_meta, y_train_meta)\nbase_model_2.fit(train_meta, y_train_meta)\npreds_1 = base_model_1.predict(val_meta)\npreds_2 = base_model_2.predict(val_meta)\nmeta_features = np.column_stack((preds_1, preds_2))\nmeta_model.fit(meta_features, y_val_meta)\n```\n\nThese techniques ensure that the final predictions are more accurate and robust, leveraging the diversity and strengths of multiple models to deliver superior results.\n## **3.3: Hyperparameter Optimization**\nHyperparameter optimization involves finding the best settings for a model to maximize its performance. AutoGluon automates this process using advanced techniques like Bayesian optimization, early stopping, and smart resource allocation.\n**Bayesian Optimization** Bayesian optimization aims to find the optimal set of hyperparameters by building a probabilistic model of the objective function. It uses past evaluation results to make informed decisions about which hyperparameters to try next. This is particularly useful for efficiently navigating large and complex hyperparameter spaces, reducing the number of evaluations needed to find the best configuration:\n![Bayesian Optimization Formula - Image by Author](../images/006.png)\nBayesian Optimization Formula - Image by Author\nwhere **f(θ)** is the objective function want to optimize, such as model accuracy or loss. **θ** represents the hyperparameters. **E[f(θ)]** is the expected value of the objective function given the hyperparameters **θ**.\nBayesian optimization involves two main steps:\n  1. **Surrogate Modeling** : A probabilistic model, usually a Gaussian process, is built to approximate the objective function based on past evaluations.\n  2. **Acquisition Function** : This function determines the next set of hyperparameters to evaluate by balancing exploration (trying new areas of the hyperparameter space) and exploitation (focusing on areas known to perform well). Common acquisition functions include Expected Improvement (EI) and Upper Confidence Bound (UCB).\n\n\nThe optimization iteratively updates the surrogate model and acquisition function to converge on the optimal set of hyperparameters with fewer evaluations compared to grid or random search methods.\n**Early Stopping Techniques** Early stopping prevents overfitting and reduces training time by halting the training process once the model's performance stops improving on a validation set. AutoGluon monitors the performance of the model during training and stops the process when further training is unlikely to yield significant improvements. This technique not only saves computational resources but also ensures that the model generalizes well to new, unseen data:\npython\n\n```\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.metrics import log_loss\n\nX_train, X_val, y_train, y_val = train_test_split(X, y, test_size=0.2)\nmodel = DecisionTreeClassifier()\nbest_loss = np.inf\n\nfor epoch in range(100):\n    model.fit(X_train, y_train)\n    val_preds = model.predict(X_val)\n    loss = log_loss(y_val, val_preds)\n    if loss < best_loss:\n        best_loss = loss\n    else:\n        break\n```\n\n**Resource Allocation Strategies** Effective resource allocation is crucial in hyperparameter optimization, especially when dealing with limited computational resources. AutoGluon employs strategies like multi-fidelity optimization, where the system initially trains models with a subset of the data or fewer epochs to quickly assess their potential. Promising models are then allocated more resources for thorough evaluation. This approach balances exploration and exploitation, ensuring that computational resources are used effectively:\n![Multi-Fidelity Optimization Formula - Image by Author](../images/007.png)\nMulti-Fidelity Optimization Formula - Image by Author\nIn this formula:\n  * **h_i** ​ represents the **i-th** model.\n  * **C_i** ​ is the cost associated with model **h_i** ​, such as computational time or resources used.\n  * **Resource(h_i​)** represents the proportion of total resources allocated to model **h_i** ​.\n\n\nBy initially training models with reduced fidelity (e.g., using fewer data points or epochs), multi-fidelity optimization quickly identifies promising candidates. These candidates are then trained with higher fidelity, ensuring that computational resources are used effectively. This approach balances the exploration of the hyperparameter space with the exploitation of known good configurations, leading to efficient and effective hyperparameter optimization.\n## **3.4: Model Evaluation and Selection**\nModel evaluation and selection ensure the chosen model performs well on new, unseen data. AutoGluon automates this process using cross-validation techniques, performance metrics, and automated model selection criteria.\n**Cross-Validation Techniques** Cross-validation involves splitting the data into multiple folds and training the model on different subsets while validating it on the remaining parts. AutoGluon uses techniques like k-fold cross-validation, where the data is divided into k subsets, and the model is trained and validated k times, each time with a different subset as the validation set. This helps in obtaining a reliable estimate of the model's performance and ensures that the evaluation is not biased by a particular train-test split:\n![Cross-Validation Accuracy Formula - Image by Author](../images/008.png)\nCross-Validation Accuracy Formula - Image by Author\n**Performance Metrics** To evaluate the quality of a model, AutoGluon relies on various performance metrics, which depend on the specific task at hand. For classification tasks, common metrics include accuracy, precision, recall, F1-score, and area under the ROC curve (AUC-ROC). For regression tasks, metrics like mean absolute error (MAE), mean squared error (MSE), and R-squared are often used. AutoGluon automatically calculates these metrics during the evaluation process, providing a comprehensive view of the model's strengths and weaknesses:\nmakefile\n\n```\nfrom sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score\ny_pred = model.predict(X_val)\naccuracy = accuracy_score(y_val, y_pred)\nprecision = precision_score(y_val, y_pred)\nrecall = recall_score(y_val, y_pred)\nf1 = f1_score(y_val, y_pred)\n```\n\n**Automated Model Selection Criteria** After evaluating the models, AutoGluon uses automated criteria to select the best-performing one. This involves comparing the performance metrics across different models and choosing the model that excels in the most relevant metrics for the task. AutoGluon also considers factors like model complexity, training time, and resource efficiency. The automated model selection process ensures that the chosen model not only performs well but is also practical to deploy and use in real-world scenarios. By automating this selection, AutoGluon eliminates human bias and ensures a consistent and objective approach to choosing the best model:\npython\n\n```\nbest_model = max(models, key=lambda model: model['score'])\n```\n\n## 4: AutoGluon in Python\nBefore diving into using AutoGluon, you need to set up your environment. This involves installing the necessary libraries and dependencies.\nYou can install AutoGluon using pip. Open your terminal or command prompt and run the following command:\nbash\n\n```\npip install autogluon\n```\n\nThis command will install AutoGluon along with its required dependencies.\nNext, you need to download the data. You'll need to install Kaggle to download the dataset for this example:\ntypescript\n\n```\npip install kaggle\n```\n\nAfter installing, download the dataset by running these commands in your terminal. Make sure you're in the same directory as your notebook file:\nbash\n\n```\nmkdir data\ncd data\nkaggle competitions download -c playground-series-s4e6\nunzip \"Academic Succession/playground-series-s4e6.zip\"\n```\n\nAlternatively, you can manually download the dataset from the recent Kaggle competition \"Classification with an Academic Success Dataset\". [The dataset is free for commercial use.](https://creativecommons.org/licenses/by/4.0/)\nOnce your environment is set up, you can use AutoGluon to build and evaluate machine learning models. First, you need to load and prepare your dataset. AutoGluon makes this process straightforward. Suppose you have a CSV file named `train.csv` containing your training data:\npython\n\n```\nfrom autogluon.tabular import TabularDataset, TabularPredictor\n\n# Load the dataset\ntrain_df = TabularDataset('data/train.csv')\n```\n\nWith the data loaded, you can train a model using AutoGluon. In this example, we will train a model to predict a target variable named 'Target' and use accuracy as the evaluation metric. We will also enable hyperparameter tuning and automatic stacking to improve model performance:\npython\n\n```\n# Train the model\npredictor = TabularPredictor(\n    label='Target',\n    eval_metric='accuracy',\n    verbosity=1\n).fit(\n    train_df,\n    presets=['best_quality'],\n    hyperparameter_tune=True,\n    auto_stack=True\n)\n```\n\nAfter training, you can evaluate the model's performance using the leaderboard, which provides a summary of the model's performance on the training data:\npython\n\n```\n# Evaluate the model\nleaderboard = predictor.leaderboard(train_df, silent=True)\nprint(leaderboard)\n```\n\nThe leaderboard gives you a detailed comparison of all the models trained by AutoGluon.\n![](../images/body-333a9709e5f56bf7d935.png)\nLet's break down the key columns and what they mean:\n  * **model** : This column lists the names of the models. For example, `RandomForestEntr_BAG_L1` refers to a Random Forest model using entropy as the criterion, bagged at level 1.\n  * **score_test** : This shows the model's accuracy on the dataset. A score of `1.00` indicates perfect accuracy for some models. Contrary to its name, score_test is the training dataset used during training.\n  * **score_val** : This shows the model's accuracy on the validation dataset. Keep an eye out for this one, as it shows how well the models perform on unseen data.\n  * **eval_metric** : The evaluation metric used, which in this case is accuracy.\n  * **pred_time_test** : The time taken to make predictions on the test data.\n  * **pred_time_val** : The time taken to make predictions on the validation data.\n  * **fit_time** : The time taken to train the model.\n  * **pred_time_test_marginal** : The additional prediction time added by the model in the ensemble on the test dataset.\n  * **pred_time_val_marginal** : The additional prediction time added by the model in the ensemble on the validation dataset.\n  * **fit_time_marginal** : The additional training time added by the model in the ensemble.\n  * **stack_level** : Indicates the stacking level of the model. Level 1 models are the base models, while level 2 models are meta-models that use the predictions of level 1 models as features.\n  * **can_infer** : Indicates whether the model can be used for inference.\n  * **fit_order** : The order in which the models were trained.\n\n\nLooking at the provided leaderboard, we can see some models like `RandomForestEntr_BAG_L1` and `RandomForestGini_BAG_L1` have perfect train accuracy (`1.000000`) but slightly lower validation accuracy, suggesting potential overfitting. `WeightedEnsemble_L2`, which combines the predictions of level 1 models, generally shows good performance by balancing the strengths of its base models.\nModels such as `LightGBMLarge_BAG_L1` and `XGBoost_BAG_L1` have competitive validation scores and reasonable training and prediction times, making them strong candidates for deployment.\nThe `fit_time` and `pred_time` columns offer insights into the computational efficiency of each model, which is crucial for practical applications.\nIn addition to the leaderboard, AutoGluon offers several advanced features that allow you to customize the training process, handle imbalanced datasets, and perform hyperparameter tuning.\nYou can customize various aspects of the training process by adjusting the parameters of the `fit` method. For example, you can change the number of training iterations, specify different algorithms to use, or set custom hyperparameters for each algorithm.\npython\n\n```\nfrom autogluon.tabular import TabularPredictor, TabularDataset\n\n# Load the dataset\ntrain_df = TabularDataset('train.csv')\n\n# Define custom hyperparameters\nhyperparameters = {\n    'GBM': {'num_boost_round': 200},\n    'NN': {'epochs': 10},\n    'RF': {'n_estimators': 100},\n}\n\n# Train the model with custom settings\npredictor = TabularPredictor(\n    label='Target',\n    eval_metric='accuracy',\n    verbosity=2\n).fit(\n    train_data=train_df,\n    hyperparameters=hyperparameters\n)\n```\n\nImbalanced datasets can be challenging, but AutoGluon provides tools to handle them effectively. You can use techniques such as oversampling the minority class, undersampling the majority class, or applying cost-sensitive learning algorithms. AutoGluon can automatically detect and handle imbalances in your dataset.\npython\n\n```\nfrom autogluon.tabular import TabularPredictor, TabularDataset\n\n# Load the dataset\ntrain_df = TabularDataset('train.csv')\n\n# Handle imbalanced datasets by specifying custom parameters\n# AutoGluon can handle this internally but specifying here for clarity\nhyperparameters = {\n    'RF': {'n_estimators': 100, 'class_weight': 'balanced'},\n    'GBM': {'num_boost_round': 200, 'scale_pos_weight': 2},\n}\n\n# Train the model with settings for handling imbalance\npredictor = TabularPredictor(\n    label='Target',\n    eval_metric='accuracy',\n    verbosity=2\n).fit(\n    train_data=train_df,\n    hyperparameters=hyperparameters\n)\n```\n\nHyperparameter tuning is crucial for optimizing model performance. AutoGluon automates this process using advanced techniques like Bayesian optimization. You can enable hyperparameter tuning by setting `hyperparameter_tune=True` in the `fit` method.\npython\n\n```\nfrom autogluon.tabular import TabularPredictor, TabularDataset\n\n# Load the dataset\ntrain_df = TabularDataset('train.csv')\n\n# Train the model with hyperparameter tuning\npredictor = TabularPredictor(\n    label='Target',\n    eval_metric='accuracy',\n    verbosity=2\n).fit(\n    train_data=train_df,\n    presets=['best_quality'],\n    hyperparameter_tune=True\n)\n```\n\nLet's explore how you could potentially outperform an AutoML model. Let's assume your main goal is to improve the loss metric, rather than focusing on latency, computational costs, or other metrics.\nIf you have a large dataset that's well-suited for deep learning, you might find it easier to experiment with deep learning architectures. AutoML frameworks often struggle in this area because deep learning requires a thorough understanding of the dataset, and blindly applying models can be very time and resource-consuming. Here are some resources to get you started with Deep Learning:\n> [**The Math Behind Neural Networks**](https://towardsdatascience.com/the-math-behind-neural-networks-a34a51b93873)\n> [**The Math Behind Fine-Tuning Deep Neural Networks**](https://towardsdatascience.com/the-math-behind-fine-tuning-deep-neural-networks-8138d548da69)\n> [**The Math Behind LSTM**](https://towardsdatascience.com/the-math-behind-lstm-9069b835289d)\nHowever, the real challenge lies in beating AutoML with traditional machine learning tasks. AutoML systems typically use ensembling, which means you'll likely end up doing the same thing. A good starting strategy could be to first fit an AutoML model. For instance, using AutoGluon, you can identify which models performed best. You can then take these models and recreate the ensemble architecture that AutoGluon used. By optimizing these models further with a technique like Optuna, you might be able to achieve better performance. Here's a comprehensive guide to master Optuna:\n> [**Machine Learning Optimization with Optuna**](https://towardsdatascience.com/machine-learning-optimization-with-optuna-57593d700e52)\nAdditionally, applying domain knowledge to feature engineering can give you an edge. Understanding the specifics of your data can help you create more meaningful features, which can significantly boost your model's performance. If applicable, augment your dataset to provide more varied training examples, which can help improve the robustness of your models.\nBy combining these strategies with the insights gained from an initial AutoML model, you can outperform the automated approach and achieve superior results.\n## Conclusion\nAutoGluon revolutionizes the ML process by automating everything from data preprocessing to model deployment. Its cutting-edge architecture, powerful ensemble learning techniques, and sophisticated hyperparameter optimization make it an indispensable tool for newcomers and seasoned data scientists. With AutoGluon, you can transform complex, time-consuming tasks into streamlined workflows, enabling you to build top-tier models with unprecedented speed and efficiency.\nHowever, to truly excel in machine learning, it's essential not to rely solely on AutoGluon. Use it as a foundation to jumpstart your projects and gain insights into effective model strategies. From there, dive deeper into understanding your data and applying domain knowledge for feature engineering. Experiment with custom models and fine-tune them beyond AutoGluon's initial offerings.\n## Bibliography\n  * Erickson, N., Mueller, J., Charpentier, P., Kornblith, S., Weissenborn, D., Norris, E., ... & Smola, A. (2020). AutoGluon-Tabular: Robust and Accurate AutoML for Structured Data. arXiv preprint arXiv:2003.06505.\n  * Snoek, J., Larochelle, H., & Adams, R. P. (2012). Practical Bayesian optimization of machine learning algorithms. Advances in neural information processing systems, 25.\n  * Pedregosa, F., Varoquaux, G., Gramfort, A., Michel, V., Thirion, B., Grisel, O., ... & Duchesnay, É. (2011). Scikit-learn: Machine learning in Python. Journal of machine learning research, 12(Oct), 2825–2830.\n  * AutoGluon Team. \"AutoGluon: AutoML for Text, Image, and Tabular Data.\" 2020.\n  * Feurer, Matthias, et al. \"Efficient and Robust Automated Machine Learning.\" 2015.\n  * He, Xin, et al. \"AutoML: A Survey of the State-of-the-Art.\" 2020.\n  * Hutter, Frank, et al. \"Automated Machine Learning: Methods, Systems, Challenges.\" 2019.\n  * H2O.ai. \"H2O AutoML: Scalable Automatic Machine Learning.\" 2020.\n\n\n## Register Now to Continue Reading\n### Unlock Towards Data Science with a Free Account\nAll articles on Towards Data Science are available to registered users. Create a free account today to access this article and thousands more.\nRegister for freeSign in to your account\n* * *\n![](../images/body-8f73ac5a40c91a7b503f.jpeg)\nWritten By\n## [Cristian Leo](https://towardsdatascience.com/author/cristianleo120/)\n[See all from Cristian Leo](https://towardsdatascience.com/author/cristianleo120/)\n[Deep Dives](https://towardsdatascience.com/tag/deep-dives/)[Deep Learning](https://towardsdatascience.com/tag/deep-learning/)[Machine Learning](https://towardsdatascience.com/tag/machine-learning/)[Programming](https://towardsdatascience.com/tag/programming/)[Python](https://towardsdatascience.com/tag/python/)\nShare This Article\n  * [](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Ftowardsdatascience.com%2Fautoml-with-autogluon-transform-your-ml-workflow-with-just-four-lines-of-code-1d4b593be129%2F&title=AutoML%20with%20AutoGluon%3A%20Transform%20Your%20ML%20Workflow%20with%20Just%20Four%20Lines%20of%20Code)\n  * [](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Ftowardsdatascience.com%2Fautoml-with-autogluon-transform-your-ml-workflow-with-just-four-lines-of-code-1d4b593be129%2F&title=AutoML%20with%20AutoGluon%3A%20Transform%20Your%20ML%20Workflow%20with%20Just%20Four%20Lines%20of%20Code)\n  * [](https://x.com/share?url=https%3A%2F%2Ftowardsdatascience.com%2Fautoml-with-autogluon-transform-your-ml-workflow-with-just-four-lines-of-code-1d4b593be129%2F&text=AutoML%20with%20AutoGluon%3A%20Transform%20Your%20ML%20Workflow%20with%20Just%20Four%20Lines%20of%20Code)\n\n\nTowards Data Science is a community publication. Submit your insights to reach our global audience and earn through the TDS Author Payment Program.\n[Write for TDS](https://towardsdatascience.com/submissions/)\n## Related Articles\n  * [![](../images/009.jpg)](https://towardsdatascience.com/fact-checking-covid-19-fake-news-ae49c8d667e2/)\n## [Fact checking COVID-19 fake news](https://towardsdatascience.com/fact-checking-covid-19-fake-news-ae49c8d667e2/)\n[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)\nIn this blog, we explore the problem of fake news detection related to COVID-19 and describe our approach to tackle it using NLP.\n[Prathyush Potluri](https://towardsdatascience.com/author/potluri.prathyush/)\nDecember 4, 202010 min read\n  * [![](../images/010.jpg)](https://towardsdatascience.com/mastering-p-values-in-machine-learning-bdc5bd0dd8ae/)\n## [Mastering P-values in Machine Learning](https://towardsdatascience.com/mastering-p-values-in-machine-learning-bdc5bd0dd8ae/)\n[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)\nUnderstanding P-values and ML use cases\n[Sadrach Pierre, Ph.D.](https://towardsdatascience.com/author/spierre91/)\nJanuary 6, 20237 min read\n  * [![](../images/011.jpg)](https://towardsdatascience.com/zero-inflated-data-comparison-of-regression-models/)\n## [Zero-Inflated Data: A Comparison of Regression Models](https://towardsdatascience.com/zero-inflated-data-comparison-of-regression-models/)\n[Data Science](https://towardsdatascience.com/category/data-science/)\nHow to detect it and which model to choose.\n[Arnaud Capitaine](https://towardsdatascience.com/author/arnaud.gc.capitaine/)\nSeptember 5, 202511 min read\n  * [![](../images/012.jpg)](https://towardsdatascience.com/algorithms-from-scratch-logistic-regression-7bacdfd9738e/)\n## [Algorithms from Scratch: Logistic Regression](https://towardsdatascience.com/algorithms-from-scratch-logistic-regression-7bacdfd9738e/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nDetailing and Building a Logistic Regression model from scratch\n[Kurtis Pykes](https://towardsdatascience.com/author/kurtispykes/)\nJuly 15, 202011 min read\n  * [![](../images/013.jpg)](https://towardsdatascience.com/creating-a-dashboard-app-with-dash-heroku-a-streamlined-process-26bce4fbf2c8/)\n## [Creating a Dashboard App with Dash/Heroku: A Streamlined Process](https://towardsdatascience.com/creating-a-dashboard-app-with-dash-heroku-a-streamlined-process-26bce4fbf2c8/)\n[](https://towardsdatascience.com/automl-with-autogluon-transform-your-ml-workflow-with-just-four-lines-of-code-1d4b593be129/)\nAlways wanted to create a dashboard, but concerned about where you have to host it and learning CSS and HTML seems daunting? Then this...\n[Adrienne Kline](https://towardsdatascience.com/author/askline1/)\nJune 6, 20224 min read\n  * [![](../images/014.jpg)](https://towardsdatascience.com/training-t5-for-paraphrase-generation-ab3b5be151a2/)\n## [Training T5 for paraphrase generation](https://towardsdatascience.com/training-t5-for-paraphrase-generation-ab3b5be151a2/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nIn my previous blog talking about TextGenie, I mentioned the issues I faced while collecting text data from scratch and using paraphrases...\n[Het Pandya](https://towardsdatascience.com/author/het-pandya/)\nJune 29, 20213 min read\n  * [![](../images/015.jpeg)](https://towardsdatascience.com/is-it-worth-spending-two-years-to-learn-data-science-290668d04a9f/)\n## [Is It Worth Spending Two Years to Learn Data Science?](https://towardsdatascience.com/is-it-worth-spending-two-years-to-learn-data-science-290668d04a9f/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nWhat are the rewards?\n[Soner Yıldırım](https://towardsdatascience.com/author/sonery/)\nAugust 24, 20214 min read\n  * [![](../images/016.jpeg)](https://towardsdatascience.com/how-to-retrieve-data-from-a-complex-formatted-file-894098d66e74/)\n## [How to Retrieve Data from A Complex Formatted File](https://towardsdatascience.com/how-to-retrieve-data-from-a-complex-formatted-file-894098d66e74/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nThe way I use to extract data from PDF scanned images\n[Low Wei Hong](https://towardsdatascience.com/author/lowweihong/)\nSeptember 29, 20194 min read\n  * [![](../images/017.jpeg)](https://towardsdatascience.com/an-impulse-to-action-a-practical-solution-for-positive-unlabelled-classification-cd5895128e45/)\n## [An ImPULSE to Action: A Practical Solution for Positive Unlabelled Classification](https://towardsdatascience.com/an-impulse-to-action-a-practical-solution-for-positive-unlabelled-classification-cd5895128e45/)\n[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)\nWe introduce an approach called ImPULSE Classifier with improved performance on balanced and imbalanced PU data compared to other...\n[Volodymyr Holomb](https://towardsdatascience.com/author/wldmrgml/)\nApril 6, 20235 min read\n\n\n  * [YouTube](https://www.youtube.com/c/TowardsDataScience)\n  * [X](https://x.com/TDataScience)\n  * [LinkedIn](https://www.linkedin.com/company/towards-data-science/)\n  * [Threads](https://www.threads.net/@towardsdatascience)\n  * [Bluesky](https://bsky.app/profile/towardsdatascience.com)\n\n\n[](https://towardsdatascience.com/)\nYour home for data science and AI. The world's leading publication for data science, data analytics, data engineering, machine learning, and artificial intelligence professionals.\nSubscribe to Our Newsletter[Write For TDS](https://towardsdatascience.com/submissions/)•[About](https://towardsdatascience.com/about-towards-data-science-d691af11cc2f/)•[Advertise](https://contact.towardsdatascience.com/advertise-with-towards-data-science)•[Privacy Policy](https://towardsdatascience.com/privacy-policy/)•[Terms of Use](https://towardsdatascience.com/website-terms-of-use/)\n© Insight Media Group, LLC 2026•[The New Stack](https://thenewstack.io)•[roadmap.sh](https://roadmap.sh)•[Creator Network](https://insightmediagroup.io/creator-network)\n####  Recommended Articles \nClose\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607686/image?etag=1782161464448&width=500&height=500) How Relevance Models Foreshadowed Transformers for NLP ](https://towardsdatascience.com/how-relevance-models-foreshadowed-transformers-for-nlp/ \"How Relevance Models Foreshadowed Transformers for NLP\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607639/image?etag=1781250125848&width=500&height=500) Javascript Fatigue: HTMX Is All You Need to Build ChatGPT — Part 1 ](https://towardsdatascience.com/javascript-fatigue-you-dont-need-js-to-build-chatgpt/ \"Javascript Fatigue: HTMX Is All You Need to Build ChatGPT — Part 1\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607930/image?etag=1782124566054&width=500&height=500) The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs ](https://towardsdatascience.com/subset-sum-problem-solved-in-linear-time-for-dense-enough-inputs/ \"The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/3660/image?etag=1780176246070&width=500&height=500) Does Your Company Have a Data Strategy? ](https://towardsdatascience.com/does-your-company-have-a-data-strategy-e8944dbec4ae/ \"Does Your Company Have a Data Strategy?\")\n\n\n",
  "metadata": {
    "title": "AutoML with AutoGluon: Transform Your ML Workflow with Just Four Lines of Code | Towards Data Science",
    "description": "How AutoGluon Dominated Kaggle Competitions and How You Can Beat It. The algorithm that beats 99% of Data Scientists with 4 lines of code.",
    "keywords": null,
    "author": "Cristian Leo",
    "og:locale": "en_US",
    "og:type": "article",
    "og:title": "AutoML with AutoGluon: Transform Your ML Workflow with Just Four Lines of Code",
    "og:description": "How AutoGluon Dominated Kaggle Competitions and How You Can Beat It. The algorithm that beats 99% of Data Scientists with 4 lines of code.",
    "og:url": "https://towardsdatascience.com/automl-with-autogluon-transform-your-ml-workflow-with-just-four-lines-of-code-1d4b593be129/",
    "og:site_name": "Towards Data Science",
    "og:image": "https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/0BSnK3Ouszld8eKhA.jpg",
    "og:image:width": "1792",
    "og:image:height": "1024",
    "og:image:type": "image/jpeg",
    "twitter:card": "summary_large_image",
    "twitter:site": "@TDataScience",
    "twitter:creator": "@TDataScience",
    "twitter:label1": "Written by",
    "twitter:data1": "Cristian Leo",
    "twitter:label2": "Est. reading time",
    "twitter:data2": "20 min read",
    "article:published_time": "2024-07-03T17:56:43.000Z",
    "article:modified_time": "2024-07-03T17:56:43.000Z",
    "article:author": "https://towardsdatascience.com/author/cristianleo120/"
  },
  "paywall": {
    "listed_paid": false,
    "detected": false,
    "marker": "",
    "public_only": false,
    "policy": "付费/会员内容只保留页面公开可见部分，不绕过付费墙"
  },
  "crawl": {
    "success": true,
    "status_code": 200,
    "error": ""
  },
  "code_blocks": [
    {
      "language": "txt",
      "file": "attachments/de4b4afa15d6/code/block_000.txt",
      "chars": 234
    },
    {
      "language": "txt",
      "file": "attachments/de4b4afa15d6/code/block_001.txt",
      "chars": 119
    },
    {
      "language": "txt",
      "file": "attachments/de4b4afa15d6/code/block_002.txt",
      "chars": 111
    },
    {
      "language": "txt",
      "file": "attachments/de4b4afa15d6/code/block_003.txt",
      "chars": 109
    },
    {
      "language": "txt",
      "file": "attachments/de4b4afa15d6/code/block_004.txt",
      "chars": 198
    },
    {
      "language": "txt",
      "file": "attachments/de4b4afa15d6/code/block_005.txt",
      "chars": 143
    },
    {
      "language": "txt",
      "file": "attachments/de4b4afa15d6/code/block_006.txt",
      "chars": 163
    },
    {
      "language": "txt",
      "file": "attachments/de4b4afa15d6/code/block_007.txt",
      "chars": 48
    },
    {
      "language": "txt",
      "file": "attachments/de4b4afa15d6/code/block_008.txt",
      "chars": 406
    },
    {
      "language": "txt",
      "file": "attachments/de4b4afa15d6/code/block_009.txt",
      "chars": 421
    },
    {
      "language": "txt",
      "file": "attachments/de4b4afa15d6/code/block_010.txt",
      "chars": 264
    },
    {
      "language": "txt",
      "file": "attachments/de4b4afa15d6/code/block_011.txt",
      "chars": 59
    },
    {
      "language": "txt",
      "file": "attachments/de4b4afa15d6/code/block_012.txt",
      "chars": 22
    },
    {
      "language": "txt",
      "file": "attachments/de4b4afa15d6/code/block_013.txt",
      "chars": 19
    },
    {
      "language": "txt",
      "file": "attachments/de4b4afa15d6/code/block_014.txt",
      "chars": 129
    },
    {
      "language": "txt",
      "file": "attachments/de4b4afa15d6/code/block_015.txt",
      "chars": 127
    },
    {
      "language": "txt",
      "file": "attachments/de4b4afa15d6/code/block_016.txt",
      "chars": 215
    },
    {
      "language": "txt",
      "file": "attachments/de4b4afa15d6/code/block_017.txt",
      "chars": 99
    },
    {
      "language": "txt",
      "file": "attachments/de4b4afa15d6/code/block_018.txt",
      "chars": 477
    },
    {
      "language": "txt",
      "file": "attachments/de4b4afa15d6/code/block_019.txt",
      "chars": 618
    },
    {
      "language": "txt",
      "file": "attachments/de4b4afa15d6/code/block_020.txt",
      "chars": 355
    }
  ],
  "images": [
    {
      "status": "http_404",
      "url": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607686/image?etag=1782161464448&width=500&height=500",
      "src": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607686/image?etag=1782161464448&width=500&height=500",
      "alt": "",
      "downloaded": false,
      "discovery": "saved_markdown",
      "retried_at": "2026-10-20T17:37:18Z"
    },
    {
      "status": "http_404",
      "url": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607639/image?etag=1781250125848&width=500&height=500",
      "src": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607639/image?etag=1781250125848&width=500&height=500",
      "alt": "",
      "downloaded": false,
      "discovery": "saved_markdown",
      "retried_at": "2026-10-20T17:37:18Z"
    },
    {
      "status": "http_404",
      "url": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607930/image?etag=1782124566054&width=500&height=500",
      "src": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607930/image?etag=1782124566054&width=500&height=500",
      "alt": "",
      "downloaded": false,
      "discovery": "saved_markdown",
      "retried_at": "2026-10-20T17:37:18Z"
    },
    {
      "status": "http_404",
      "url": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/3660/image?etag=1780176246070&width=500&height=500",
      "src": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/3660/image?etag=1780176246070&width=500&height=500",
      "alt": "",
      "downloaded": false,
      "discovery": "saved_markdown",
      "retried_at": "2026-10-20T17:37:18Z"
    }
  ],
  "audio": [],
  "videos": [
    {
      "url": "https://www.youtube.com/c/TowardsDataScience",
      "kind": "channel_reference",
      "status": "reference_only"
    }
  ],
  "links": [
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/latest/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/editors-pick/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/the-variable/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/shipai/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/submissions/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/category/programming/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/author/cristianleo120/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/the-math-behind-neural-networks-a34a51b93873"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/the-math-behind-fine-tuning-deep-neural-networks-8138d548da69"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/the-math-behind-lstm-9069b835289d"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/machine-learning-optimization-with-optuna-57593d700e52"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/deep-dives/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/deep-learning/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/machine-learning/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/programming/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/python/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/fact-checking-covid-19-fake-news-ae49c8d667e2/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/category/artificial-intelligence/machine-learning/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/author/potluri.prathyush/"
    },
    {
      "type": "external",
      "href": "https://write.insightmediagroup.io"
    },
    {
      "type": "external",
      "href": "https://www.linkedin.com/company/towards-data-science/"
    },
    {
      "type": "external",
      "href": "https://x.com/TDataScience"
    },
    {
      "type": "external",
      "href": "https://arxiv.org/abs/2003.06505"
    },
    {
      "type": "external",
      "href": "https://www.arxiv.org/abs/1908.00709"
    },
    {
      "type": "external",
      "href": "https://papers.nips.cc/paper_files/paper/2015/hash/11d0e6287202fced83f79975ec59a3a6-Abstract.html"
    },
    {
      "type": "external",
      "href": "https://www.automl.org/wp-content/uploads/2020/07/AutoML_2020_paper_61.pdf"
    },
    {
      "type": "external",
      "href": "https://arxiv.org/abs/1206.2944"
    },
    {
      "type": "external",
      "href": "https://creativecommons.org/licenses/by/4.0/"
    },
    {
      "type": "external",
      "href": "https://www.facebook.com/sharer/sharer.php?title=AutoML+with+AutoGluon%3A+Transform+Your+ML+Workflow+with+Just+Four+Lines+of+Code&u=https%3A%2F%2Ftowardsdatascience.com%2Fautoml-with-autogluon-transform-your-ml-workflow-with-just-four-lines-of-code-1d4b593be129%2F"
    },
    {
      "type": "external",
      "href": "https://www.linkedin.com/shareArticle?mini=true&title=AutoML+with+AutoGluon%3A+Transform+Your+ML+Workflow+with+Just+Four+Lines+of+Code&url=https%3A%2F%2Ftowardsdatascience.com%2Fautoml-with-autogluon-transform-your-ml-workflow-with-just-four-lines-of-code-1d4b593be129%2F"
    },
    {
      "type": "external",
      "href": "https://x.com/share?text=AutoML+with+AutoGluon%3A+Transform+Your+ML+Workflow+with+Just+Four+Lines+of+Code&url=https%3A%2F%2Ftowardsdatascience.com%2Fautoml-with-autogluon-transform-your-ml-workflow-with-just-four-lines-of-code-1d4b593be129%2F"
    },
    {
      "type": "external",
      "href": "https://www.youtube.com/c/TowardsDataScience"
    },
    {
      "type": "external",
      "href": "https://www.threads.net/@towardsdatascience"
    },
    {
      "type": "external",
      "href": "https://bsky.app/profile/towardsdatascience.com"
    },
    {
      "type": "external",
      "href": "https://thenewstack.io"
    },
    {
      "type": "external",
      "href": "https://roadmap.sh"
    },
    {
      "type": "external",
      "href": "https://insightmediagroup.io/creator-network"
    }
  ],
  "repair_version": 2,
  "repaired_at": "2026-10-20T17:23:11Z",
  "source_url": "https://towardsdatascience.com/automl-with-autogluon-transform-your-ml-workflow-with-just-four-lines-of-code-1d4b593be129/",
  "delivery_status": "unverified",
  "discovery_status": "http_403",
  "missing_reason": "源页面未重新核验:http_403；已按保留正文补采图片",
  "repair_error": "",
  "actual_video_files": [],
  "expected_saved_body_images": 4,
  "image_discovery": "saved_markdown",
  "source_body_markdown": "![Revisit consent button](https://cdn-cookieyes.com/assets/images/revisit.svg)\nWe value your privacy\nWe use cookies to enhance your browsing experience, serve personalised ads or content, and analyse our traffic. By clicking \"Accept All\", you consent to our use of cookies.\nCustomise Reject All Accept All\nCustomise Consent Preferences ![](https://cdn-cookieyes.com/assets/images/close.svg)\nWe use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.\nThe cookies that are categorised as \"Necessary\" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... Show more\nNecessaryAlways Active\nNecessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.\n  * Cookie\nBCTempID\n  * Duration\n10 minutes\n  * Description\nNo description available.\n\n\n  * Cookie\n__cf_bm\n  * Duration\n1 hour\n  * Description\nThis cookie, set by Cloudflare, is used to support Cloudflare Bot Management. \n\n\n  * Cookie\nAWSALBCORS\n  * Duration\n7 days\n  * Description\nAmazon Web Services set this cookie for load balancing.\n\n\n  * Cookie\n_cfuvid\n  * Duration\nsession\n  * Description\nCloudflare sets this cookie to track users across sessions to optimize user experience by maintaining session consistency and providing personalized services\n\n\n  * Cookie\nli_gc\n  * Duration\n6 months\n  * Description\nLinkedin set this cookie for storing visitor's consent regarding using cookies for non-essential purposes.\n\n\n  * Cookie\n__hssrc\n  * Duration\nsession\n  * Description\nThis cookie is set by Hubspot whenever it changes the session cookie. The __hssrc cookie set to 1 indicates that the user has restarted the browser, and if the cookie does not exist, it is assumed to be a new session.\n\n\n  * Cookie\n__hssc\n  * Duration\n1 hour\n  * Description\nHubSpot sets this cookie to keep track of sessions and to determine if HubSpot should increment the session number and timestamps in the __hstc cookie.\n\n\n  * Cookie\nwpEmojiSettingsSupports\n  * Duration\nsession\n  * Description\nWordPress sets this cookie when a user interacts with emojis on a WordPress site. It helps determine if the user's browser can display emojis properly.\n\n\n  * Cookie\nBCSessionID\n  * Duration\n1 year 1 month 4 days\n  * Description\nBlueconic sets this cookie as a unique identifier for the BlueConic profile.\n\n\n  * Cookie\n_octo\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nlogged_in\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\n__Secure-YEC\n  * Duration\npast\n  * Description\nYouTube sets this cookie to stores the user's video player preferences using embedded YouTube video\n\n\n  * Cookie\n__eoi\n  * Duration\n6 months\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nAWSALBTGCORS\n  * Duration\n7 days\n  * Description\nNo description available.\n\n\n  * Cookie\nlogin-status-p\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nAWSALBTG\n  * Duration\n7 days\n  * Description\nNo description available.\n\n\n  * Cookie\ncsrf_token\n  * Duration\nsession\n  * Description\nNo description available.\n\n\n  * Cookie\ntoken_v2\n  * Duration\n1 day\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nD\n  * Duration\n1 year\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nPHPSESSID\n  * Duration\nsession\n  * Description\nThis cookie is native to PHP applications. The cookie stores and identifies a user's unique session ID to manage user sessions on the website. The cookie is a session cookie and will be deleted when all the browser windows are closed.\n\n\n  * Cookie\nVISITOR_PRIVACY_METADATA\n  * Duration\n6 months\n  * Description\nYouTube sets this cookie to store the user's cookie consent state for the current domain. \n\n\n  * Cookie\ncookietest\n  * Duration\nsession\n  * Description\nThe cookietest cookie is typically used to determine whether the user's browser accepts cookies, essential for website functionality and user experience.\n\n\n  * Cookie\n__Host-airtable-session\n  * Duration\n1 year\n  * Description\nThis cookie is used to enable us to integrate the services of Airtable.\n\n\n  * Cookie\n__Host-airtable-session.sig\n  * Duration\n1 year\n  * Description\nThis cookie is used to enable us to integrate the services of Airtable.\n\n\n  * Cookie\nm\n  * Duration\n1 year 1 month 4 days\n  * Description\nStripe sets this cookie for fraud prevention purposes. It identifies the device used to access the website, allowing the website to be formatted accordingly.\n\n\n  * Cookie\nBIGipServer*\n  * Duration\nsession\n  * Description\nMarketo sets this cookie to collect information about the user's online activity and build a profile about their interests to provide advertisements relevant to the user. \n\n\n  * Cookie\n__cfruid\n  * Duration\nsession\n  * Description\nCloudflare sets this cookie to identify trusted web traffic.\n\n\n  * Cookie\n_GRECAPTCHA\n  * Duration\n6 months\n  * Description\nGoogle Recaptcha service sets this cookie to identify bots to protect the website against malicious spam attacks.\n\n\n  * Cookie\n__Secure-YNID\n  * Duration\n6 months\n  * Description\nGoogle cookie used to protect user security and prevent fraud, especially during the login process.\n\n\n  * Cookie\ncookieyes-consent\n  * Duration\n1 year\n  * Description\nCookieYes sets this cookie to remember users' consent preferences so that their preferences are respected on subsequent visits to this site. It does not collect or store any personal information about the site visitors.\n\n\nFunctional\nFunctional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.\n  * Cookie\nlidc\n  * Duration\n1 day\n  * Description\nLinkedIn sets the lidc cookie to facilitate data center selection.\n\n\n  * Cookie\nbrw\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nbrwConsent\n  * Duration\n5 minutes\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nWMF-Uniq\n  * Duration\n1 year\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nloom_anon_comment\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nloom_referral_video\n  * Duration\nsession\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nVISITOR_INFO1_LIVE\n  * Duration\n6 months\n  * Description\nA cookie set by YouTube to measure bandwidth that determines whether the user gets the new or old player interface.\n\n\n  * Cookie\nyt-remote-connected-devices\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to store the user's video preferences using embedded YouTube videos.\n\n\n  * Cookie\nytidb::LAST_RESULT_ENTRY_KEY\n  * Duration\nNever Expires\n  * Description\nThe cookie ytidb::LAST_RESULT_ENTRY_KEY is used by YouTube to store the last search result entry that was clicked by the user. This information is used to improve the user experience by providing more relevant search results in the future.\n\n\n  * Cookie\nyt-remote-device-id\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to store the user's video preferences using embedded YouTube videos.\n\n\n  * Cookie\nyt-remote-session-name\n  * Duration\nsession\n  * Description\nThe yt-remote-session-name cookie is used by YouTube to store the user's video player preferences using embedded YouTube video.\n\n\n  * Cookie\nyt-remote-fast-check-period\n  * Duration\nsession\n  * Description\nThe yt-remote-fast-check-period cookie is used by YouTube to store the user's video player preferences for embedded YouTube videos.\n\n\n  * Cookie\nyt-remote-session-app\n  * Duration\nsession\n  * Description\nThe yt-remote-session-app cookie is used by YouTube to store user preferences and information about the interface of the embedded YouTube video player.\n\n\n  * Cookie\nyt-remote-cast-available\n  * Duration\nsession\n  * Description\nThe yt-remote-cast-available cookie is used to store the user's preferences regarding whether casting is available on their YouTube video player.\n\n\n  * Cookie\nyt-remote-cast-installed\n  * Duration\nsession\n  * Description\nThe yt-remote-cast-installed cookie is used to store the user's video player preferences using embedded YouTube video.\n\n\n  * Cookie\ncp_session\n  * Duration\n3 months\n  * Description\nCodepen sets this cookie for Help systems found in the website.\n\n\n  * Cookie\nloid\n  * Duration\n1 year 1 month 4 days\n  * Description\nThis cookie is set by the Reddit. The cookie enables the sharing of content from the website onto the social media platform.\n\n\nAnalytics\nAnalytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.\n  * Cookie\n__hstc\n  * Duration\n6 months\n  * Description\nHubspot set this main cookie for tracking visitors. It contains the domain, initial timestamp (first visit), last timestamp (last visit), current timestamp (this visit), and session number (increments for each subsequent session).\n\n\n  * Cookie\nhubspotutk\n  * Duration\n6 months\n  * Description\nHubSpot sets this cookie to keep track of the visitors to the website. This cookie is passed to HubSpot on form submission and used when deduplicating contacts.\n\n\n  * Cookie\n_ga\n  * Duration\n1 year 1 month 4 days\n  * Description\nGoogle Analytics sets this cookie to calculate visitor, session and campaign data and track site usage for the site's analytics report. The cookie stores information anonymously and assigns a randomly generated number to recognise unique visitors.\n\n\n  * Cookie\n_ga_*\n  * Duration\n1 year 1 month 4 days\n  * Description\nGoogle Analytics sets this cookie to store and count page views.\n\n\n  * Cookie\n__Host-psifi.analyticsTrace\n  * Duration\n6 hours\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\n__Host-psifi.analyticsTraceV2\n  * Duration\n6 hours\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\n_gh_sess\n  * Duration\nsession\n  * Description\nGitHub sets this cookie for temporary application and framework state between pages like what step the user is on in a multiple step form.\n\n\n  * Cookie\nYSC\n  * Duration\nsession\n  * Description\nYSC cookie is set by Youtube and is used to track the views of embedded videos on Youtube pages.\n\n\n  * Cookie\najs_anonymous_id\n  * Duration\n1 year\n  * Description\nThis cookie is set by Segment to count the number of people who visit a certain site by tracking if they have visited before.\n\n\n  * Cookie\nvuid\n  * Duration\n1 year 1 month 4 days\n  * Description\nVimeo installs this cookie to collect tracking information by setting a unique ID to embed videos on the website. \n\n\nPerformance\nPerformance cookies are used to understand and analyse the key performance indexes of the website which helps in delivering a better user experience for the visitors.\n  * Cookie\nAWSALB\n  * Duration\n7 days\n  * Description\nAWSALB is an application load balancer cookie set by Amazon Web Services to map the session to the target.\n\n\n  * Cookie\nacq\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nacq.sig\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nptc\n  * Duration\n2 years\n  * Description\nNo description available.\n\n\nAdvertisement\nAdvertisement cookies are used to provide visitors with customised advertisements based on the pages you visited previously and to analyse the effectiveness of the ad campaigns.\n  * Cookie\nmuc_ads\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to collect user behaviour and interaction data to optimize the website.\n\n\n  * Cookie\nguest_id_marketing\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor.\n\n\n  * Cookie\nguest_id_ads\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor.\n\n\n  * Cookie\npersonalization_id\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to integrate and share features for social media and also store information about how the user uses the website, for tracking and targeting.\n\n\n  * Cookie\nguest_id\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor. It registers if a user is signed in to the Twitter platform and collects information about ad preferences.\n\n\n  * Cookie\nbcookie\n  * Duration\n1 year\n  * Description\nLinkedIn sets this cookie from LinkedIn share buttons and ad tags to recognize browser IDs.\n\n\n  * Cookie\n__Secure-ROLLOUT_TOKEN\n  * Duration\n6 months\n  * Description\nYouTube sets this cookie to manage feature rollout and experimentation. It helps Google control which new features or interface changes are shown to users as part of testing and staged rollouts, ensuring consistent experience for a given user during an experiment.\n\n\n  * Cookie\nyt.innertube::nextId\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.\n\n\n  * Cookie\nyt.innertube::requests\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.\n\n\n  * Cookie\nsession_tracker\n  * Duration\nsession\n  * Description\nThis cookie is set by the Reddit. This cookie is used to identify trusted web traffic. It also helps in adverstising on the website.\n\n\n  * Cookie\nedgebucket\n  * Duration\nsession\n  * Description\nReddit sets this cookie to save the information about a log-on Reddit user, for the purpose of advertisement recommendations and updating the content.\n\n\n  * Cookie\ndid\n  * Duration\n1 year\n  * Description\nArbor sets this cookie to show targeted ads to site visitors.This cookie expires after 2 months or 1 year.\n\n\nUncategorised\nOther uncategorised cookies are those that are being analysed and have not been classified into a category as yet.\nNo cookies to display.\nReject All Save My Preferences Accept All\nToggle Search[](https://towardsdatascience.com/)Toggle Mobile Navigation\n[](https://towardsdatascience.com/)\nPublish AI, ML & data-science insights to a global community of data professionals.\nSign in[Submit an Article](https://write.insightmediagroup.io)\n[Latest](https://towardsdatascience.com/latest/)[Editor's Picks](https://towardsdatascience.com/tag/editors-pick/)[Newsletter](https://towardsdatascience.com/tag/the-variable/)[ShipAI](https://towardsdatascience.com/shipai/)\n* * *\n[Write For TDS](https://towardsdatascience.com/submissions/)\n[LinkedIn](https://www.linkedin.com/company/towards-data-science/)[X](https://x.com/TDataScience)Toggle Search\n[Programming](https://towardsdatascience.com/category/programming/)\n# AutoML with AutoGluon: Transform Your ML Workflow with Just Four Lines of Code\nHow AutoGluon Dominated Kaggle Competitions and How You Can Beat It. The algorithm that beats 99% of Data Scientists with 4 lines of code.\n[Cristian Leo](https://towardsdatascience.com/author/cristianleo120/)\nJuly 3, 202420 min read\n# AutoML with AutoGluon: ML workflow with Just Four Lines of Code\n![Image generated by DALL-E](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/0BSnK3Ouszld8eKhA.jpg)\nImage generated by DALL-E\n> In two popular Kaggle competitions, AutoGluon beat 99% of the participating data scientists after merely 4h of training on the raw data (AutoGluon Team. \"AutoGluon: AutoML for Text, Image, and Tabular Data.\" 2020)\nThis statement, taken from the [AutoGluon research paper](https://arxiv.org/abs/2003.06505), perfectly captures what we will explore today: a machine-learning framework that delivers impressive performance with minimal coding. You only need four lines of code to set up a complete ML pipeline, a task that could otherwise take hours. Yes, just four lines of code! See for yourself:\npython\n\n```\nfrom autogluon.tabular import TabularDataset, TabularPredictor\n\ntrain_data = TabularDataset('train.csv')\npredictor = TabularPredictor(label='Target').fit(train_data, presets='best_quality')\npredictions = predictor.predict(train_data)\n```\n\nThese four lines handle data preprocessing by automatically recognizing the data type of each column, feature engineering by finding useful column combinations, and model training through ensembling to identify the best-performing model within a given time. Notice that I didn't even specify the type of machine learning task (regression/classification). AutoGluon examines the label and determines the task on its own.\nAm I advocating for this algorithm? Not necessarily. While I appreciate the power of AutoGluon, I prefer solutions that don't reduce data science to mere accuracy scores in a Kaggle competition. However, as these models become increasingly popular and widely adopted, it's important to understand how they work, the math and code behind them, and how you can leverage or outperform them.\n## 1: AutoGluon Overview\nAutoGluon is an open-source machine-learning library created by Amazon Web Services (AWS). It's designed to handle the entire ML process for you, from preparing your data to selecting the best model and tuning its settings.\nAutoGluon combines simplicity with top-notch performance. It employs advanced techniques like ensemble learning and automatic hyperparameter tuning to ensure that the models you create are highly accurate. This means you can develop powerful machine-learning solutions without getting bogged down in the technical details.\nThe library takes care of data preprocessing, feature selection, model training, and evaluation, which significantly reduces the time and effort required to build robust machine-learning models. Additionally, AutoGluon scales well, making it suitable for both small projects and large, complex datasets.\nFor tabular data, AutoGluon can handle both classification tasks, where you categorize data into different groups, and regression tasks, where you predict continuous outcomes. It also supports text data, making it useful for tasks like sentiment analysis or topic categorization. Moreover, it can manage image data, assisting with image recognition and object detection. Although several variations of AutoGluon were built to better handle time-series data, text, and image, here we will focus on the variation to handle tabular data. Let me know if you liked this article and would like future deep dives into its variations. (AutoGluon Team. \"AutoGluon: AutoML for Text, Image, and Tabular Data.\" 2020)\n## 2: The Space of AutoML\n### **2.1: What is AutoML?**\nAutoML, short for Automated Machine Learning, is a technology that automates the entire process of applying machine learning to real-world problems. The main goal of AutoML is to make machine learning more accessible and efficient, allowing people to develop models without needing deep expertise. As we've already seen, it handles tasks like data preprocessing, feature engineering, model selection, and hyperparameter tuning, which are usually complex and time-consuming ([He et al., \"AutoML: A Survey of the State-of-the-Art,\" 2019](https://www.arxiv.org/abs/1908.00709)).\nThe concept of AutoML has evolved significantly over the years. Initially, machine learning required a lot of manual effort from experts who had to carefully select features, tune hyperparameters, and choose the right algorithms. As the field grew, so did the need for automation to handle increasingly large and complex datasets. Early efforts to automate parts of the process paved the way for modern AutoML systems. Today, AutoML uses advanced techniques like ensemble learning and Bayesian optimization to create high-quality models with minimal human intervention ([Feurer et al., \"Efficient and Robust Automated Machine Learning,\" 2015](https://papers.nips.cc/paper_files/paper/2015/hash/11d0e6287202fced83f79975ec59a3a6-Abstract.html)).\nSeveral players have emerged in the AutoML space, each offering unique features and capabilities. AutoGluon, developed by Amazon Web Services, is known for its ease of use and strong performance across various data types (AutoGluon Team, \"AutoGluon: AutoML for Text, Image, and Tabular Data,\" 2020). Google Cloud AutoML provides a suite of machine-learning products that allow developers to train high-quality models with minimal effort. H2O.ai offers H2O AutoML, which provides automatic machine-learning capabilities for both supervised and unsupervised learning tasks ([H2O.ai, \"H2O AutoML: Scalable Automatic Machine Learning,\" 2020](https://www.automl.org/wp-content/uploads/2020/07/AutoML_2020_paper_61.pdf)). DataRobot focuses on enterprise-level AutoML solutions, offering robust tools for model deployment and management. Microsoft's Azure Machine Learning also features AutoML capabilities, integrating seamlessly with other Azure services for a comprehensive machine learning solution.\n### **2.2: Key Components of AutoML**\n![AutoGluon Workflow - Image by Author](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/0eF6bWTOhDPT_H8cD-1.png)\nAutoGluon Workflow - Image by Author\nThe first step in any machine learning pipeline is **data preprocessing**. This involves cleaning the data by handling missing values, removing duplicates, and correcting errors. Data preprocessing also includes transforming the data into a format suitable for analysis, such as normalizing values, encoding categorical variables, and scaling features. Proper data preprocessing is crucial because the quality of the data directly impacts the performance of the machine learning models.\nOnce the data is cleaned, the next step is **feature engineering**. This process involves creating new features or modifying existing ones to improve the model's performance. Feature engineering can be as simple as creating new columns based on existing data or as complex as using domain knowledge to create meaningful features. The right features can significantly enhance the predictive power of the models.\nWith the data ready and features engineered, the next step is **model selection**. There are many algorithms to choose from, each with its strengths and weaknesses depending on the problem at hand. AutoML systems evaluate multiple models to identify the best one for the given task. This might involve comparing models like decision trees, support vector machines, neural networks, and others to see which performs best with the data.\nAfter selecting a model, the next challenge is **hyperparameter optimization**. Hyperparameters are settings that control the behavior of the machine learning algorithm, such as the learning rate in neural networks or the depth of decision trees. Finding the optimal combination of hyperparameters can greatly improve model performance. AutoML uses techniques like grid search, random search, and more advanced methods like Bayesian optimization to automate this process, ensuring the model is fine-tuned for the best results.\nThe final step is **model evaluation and selection**. This involves using techniques like cross-validation to assess how well the model generalizes to new data. Various performance metrics, such as accuracy, precision, recall, and F1-score, are used to measure the model's effectiveness. AutoML systems automate this evaluation process, ensuring that the model selected is the best fit for the task. Once the evaluation is complete, the best-performing model is chosen for deployment (AutoGluon Team. \"AutoGluon: AutoML for Text, Image, and Tabular Data.\" 2020).\n### **2.3: Challenges of AutoML**\nWhile AutoML saves time and effort, it can be quite demanding in terms of computational resources. Automating tasks like hyperparameter tuning and model selection often requires running many iterations and training multiple models, which can be a challenge for smaller organizations or individuals without access to high-performance computing.\nAnother challenge is the need for customization. Although AutoML systems are highly effective in many situations, they might not always meet specific requirements right out of the box. Sometimes, the automated processes may not fully capture the unique aspects of a particular dataset or problem. Users may need to tweak parts of the workflow, which can be difficult if the system doesn't offer enough flexibility or if the user lacks the necessary expertise.\nDespite these challenges, the benefits of AutoML often outweigh the drawbacks. It greatly enhances productivity, broadens accessibility, and offers scalable solutions, enabling more people to leverage the power of machine learning (Feurer et al., \"Efficient and Robust Automated Machine Learning,\" 2015).\n## 3: The Math Behind AutoGluon\n### **3.1: AutoGluon's Architecture**\nAutoGluon's architecture is designed to automate the entire machine learning workflow, from data preprocessing to model deployment. This architecture consists of several interconnected modules, each responsible for a specific stage of the process.\nThe first step is the **Data Module** , which handles loading and preprocessing data. This module deals with tasks such as cleaning the data, addressing missing values, and transforming the data into a suitable format for analysis. For example, consider a dataset X with missing values. The Data Module might impute these missing values using the mean or median:\njava\n\n```\nfrom sklearn.impute import SimpleImputer\nimputer = SimpleImputer(strategy='mean')\nX_imputed = imputer.fit_transform(X)\n```\n\nOnce the data is preprocessed, the Feature Engineering Module takes over. This component generates new features or transforms existing ones to enhance the model's predictive power. Techniques such as one-hot encoding for categorical variables or creating polynomial features for numeric data are common. For instance, encoding categorical variables might look like this:\njava\n\n```\nfrom sklearn.preprocessing import OneHotEncoder\nencoder = OneHotEncoder()\nX_encoded = encoder.fit_transform(X)\n```\n\nAt the core of AutoGluon is the Model Module. This module includes a wide array of machine-learning algorithms, such as decision trees, neural networks, and gradient-boosting machines. It trains multiple models on the dataset and evaluates their performance. A decision tree, for example, might be trained as follows:\njava\n\n```\nfrom sklearn.tree import DecisionTreeClassifier\nmodel = DecisionTreeClassifier()\nmodel.fit(X_train, y_train)\n```\n\nThe Hyperparameter Optimization Module automates the search for the best hyperparameters for each model. It uses methods like grid search, random search, and Bayesian optimization. Bayesian optimization, as detailed in the [paper by Snoek et al. (2012)](https://arxiv.org/abs/1206.2944), builds a probabilistic model to guide the search process:\njava\n\n```\nfrom skopt import BayesSearchCV\nsearch_space = {'max_depth': (1, 32)}\nbayes_search = BayesSearchCV(estimator=DecisionTreeClassifier(), search_spaces=search_space)\nbayes_search.fit(X_train, y_train)\n```\n\nAfter training, the Evaluation Module assesses model performance using metrics like accuracy, precision, recall, and F1-score. Cross-validation is commonly used to ensure the model generalizes well to new data:\njava\n\n```\nfrom sklearn.model_selection import cross_val_score\nscores = cross_val_score(model, X, y, cv=5, scoring='accuracy')\nmean_score = scores.mean()\n```\n\nAutoGluon excels with its Ensemble Module, which combines the predictions of multiple models to produce a single, more accurate prediction. Techniques like stacking, bagging, and blending are employed. For instance, bagging can be implemented using the BaggingClassifier:\njava\n\n```\nfrom sklearn.ensemble import BaggingClassifier\nbagging = BaggingClassifier(base_estimator=DecisionTreeClassifier(), n_estimators=10)\nbagging.fit(X_train, y_train)\n```\n\nFinally, the Deployment Module handles the deployment of the best model or ensemble into production. This includes exporting the model, generating predictions on new data, and integrating the model into existing systems:\ngo\n\n```\nimport joblib\njoblib.dump(bagging, 'model.pkl')\n```\n\nThese components work together to automate the machine learning pipeline, allowing users to build and deploy high-quality models quickly and efficiently.\n### **3.2: Ensemble Learning in AutoGluon**\nEnsemble learning is a key feature of AutoGluon that enhances its ability to deliver high-performing models. By combining multiple models, ensemble methods improve predictive accuracy and robustness. AutoGluon leverages three main ensemble techniques: stacking, bagging, and blending.\n**Stacking** Stacking involves training multiple base models on the same dataset and using their predictions as input features for a higher-level model, often called a meta-model. This approach leverages the strengths of various algorithms, allowing the ensemble to make more accurate predictions. The stacking process can be mathematically represented as follows:\n![Stacking Formula - Image by Author](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/1L0jUPefLjtw1kfVpHsF7lw-1.png)\nStacking Formula - Image by Author\nHere, **h_1** ​ represents the base models, and **h_2** ​ is the meta-model. Each base model **h_1** ​ takes the input features **x_i** ​ and produces a prediction. These predictions are then used as input features for the meta-model **h_2** ​, which makes the final prediction **y^** ​. By combining the outputs of different base models, stacking can capture a broader range of patterns in the data, leading to improved predictive performance.\n**Bagging** Bagging, short for Bootstrap Aggregating, improves model stability and accuracy by training multiple instances of the same model on different subsets of the data. These subsets are created by randomly sampling the original dataset with replacement. The final prediction is typically made by averaging the predictions of all the models for regression tasks or by taking a majority vote for classification tasks.\nMathematically, bagging can be represented as follows:\nFor regression:\n![Regression in Bagging Formula - Image by Author](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/18toQdfraMw7URhKoWJhZKg-1.png)\nRegression in Bagging Formula - Image by Author\nFor classification:\n![Classification in Bagging - Image by Author](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/1UhWlS11jq-3k6Y1iEp4XlA-1.png)\nClassification in Bagging - Image by Author\nHere, **h_i** ​ represents the **i-th** model trained on a different subset of the data. For regression, the final prediction **y^** ​ is the average of the predictions made by each model. For classification, the final prediction **y^** ​ is the most frequently predicted class among the models.\nThe variance reduction effect of bagging can be illustrated by the law of large numbers, which states that the average of the predictions from multiple models will converge to the expected value, reducing the overall variance and improving the stability of the predictions. It can be illustrated as:\n![Variance Reduction in Bagging - Image by Author](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/1LnHE-9xsYlEeLsNrXfEq0A-1.png)\nVariance Reduction in Bagging - Image by Author\nBy training on different subsets of the data, bagging also helps in reducing overfitting and increasing the generalizability of the model.\n**Blending** Blending is similar to stacking but with a simpler implementation. In blending, the data is split into two parts: the training set and the validation set. Base models are trained on the training set, and their predictions on the validation set are used to train a final model, also known as the blender or meta-learner. Blending uses a holdout validation set, which can make it faster to implement:\nmakefile\n\n```\n# Example of blending with simple train-validation split\ntrain_meta, val_meta, y_train_meta, y_val_meta = train_test_split(X, y, test_size=0.2)\nbase_model_1.fit(train_meta, y_train_meta)\nbase_model_2.fit(train_meta, y_train_meta)\npreds_1 = base_model_1.predict(val_meta)\npreds_2 = base_model_2.predict(val_meta)\nmeta_features = np.column_stack((preds_1, preds_2))\nmeta_model.fit(meta_features, y_val_meta)\n```\n\nThese techniques ensure that the final predictions are more accurate and robust, leveraging the diversity and strengths of multiple models to deliver superior results.\n## **3.3: Hyperparameter Optimization**\nHyperparameter optimization involves finding the best settings for a model to maximize its performance. AutoGluon automates this process using advanced techniques like Bayesian optimization, early stopping, and smart resource allocation.\n**Bayesian Optimization** Bayesian optimization aims to find the optimal set of hyperparameters by building a probabilistic model of the objective function. It uses past evaluation results to make informed decisions about which hyperparameters to try next. This is particularly useful for efficiently navigating large and complex hyperparameter spaces, reducing the number of evaluations needed to find the best configuration:\n![Bayesian Optimization Formula - Image by Author](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/1h6EQSjByfZnUVUy_6E2j0A-1.png)\nBayesian Optimization Formula - Image by Author\nwhere **f(θ)** is the objective function want to optimize, such as model accuracy or loss. **θ** represents the hyperparameters. **E[f(θ)]** is the expected value of the objective function given the hyperparameters **θ**.\nBayesian optimization involves two main steps:\n  1. **Surrogate Modeling** : A probabilistic model, usually a Gaussian process, is built to approximate the objective function based on past evaluations.\n  2. **Acquisition Function** : This function determines the next set of hyperparameters to evaluate by balancing exploration (trying new areas of the hyperparameter space) and exploitation (focusing on areas known to perform well). Common acquisition functions include Expected Improvement (EI) and Upper Confidence Bound (UCB).\n\n\nThe optimization iteratively updates the surrogate model and acquisition function to converge on the optimal set of hyperparameters with fewer evaluations compared to grid or random search methods.\n**Early Stopping Techniques** Early stopping prevents overfitting and reduces training time by halting the training process once the model's performance stops improving on a validation set. AutoGluon monitors the performance of the model during training and stops the process when further training is unlikely to yield significant improvements. This technique not only saves computational resources but also ensures that the model generalizes well to new, unseen data:\npython\n\n```\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.metrics import log_loss\n\nX_train, X_val, y_train, y_val = train_test_split(X, y, test_size=0.2)\nmodel = DecisionTreeClassifier()\nbest_loss = np.inf\n\nfor epoch in range(100):\n    model.fit(X_train, y_train)\n    val_preds = model.predict(X_val)\n    loss = log_loss(y_val, val_preds)\n    if loss < best_loss:\n        best_loss = loss\n    else:\n        break\n```\n\n**Resource Allocation Strategies** Effective resource allocation is crucial in hyperparameter optimization, especially when dealing with limited computational resources. AutoGluon employs strategies like multi-fidelity optimization, where the system initially trains models with a subset of the data or fewer epochs to quickly assess their potential. Promising models are then allocated more resources for thorough evaluation. This approach balances exploration and exploitation, ensuring that computational resources are used effectively:\n![Multi-Fidelity Optimization Formula - Image by Author](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/1glUHdRwz1FTTIxaw1KZo1g-1.png)\nMulti-Fidelity Optimization Formula - Image by Author\nIn this formula:\n  * **h_i** ​ represents the **i-th** model.\n  * **C_i** ​ is the cost associated with model **h_i** ​, such as computational time or resources used.\n  * **Resource(h_i​)** represents the proportion of total resources allocated to model **h_i** ​.\n\n\nBy initially training models with reduced fidelity (e.g., using fewer data points or epochs), multi-fidelity optimization quickly identifies promising candidates. These candidates are then trained with higher fidelity, ensuring that computational resources are used effectively. This approach balances the exploration of the hyperparameter space with the exploitation of known good configurations, leading to efficient and effective hyperparameter optimization.\n## **3.4: Model Evaluation and Selection**\nModel evaluation and selection ensure the chosen model performs well on new, unseen data. AutoGluon automates this process using cross-validation techniques, performance metrics, and automated model selection criteria.\n**Cross-Validation Techniques** Cross-validation involves splitting the data into multiple folds and training the model on different subsets while validating it on the remaining parts. AutoGluon uses techniques like k-fold cross-validation, where the data is divided into k subsets, and the model is trained and validated k times, each time with a different subset as the validation set. This helps in obtaining a reliable estimate of the model's performance and ensures that the evaluation is not biased by a particular train-test split:\n![Cross-Validation Accuracy Formula - Image by Author](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/11CgIOjE2Gtlqe_5xFEx-Yg-1.png)\nCross-Validation Accuracy Formula - Image by Author\n**Performance Metrics** To evaluate the quality of a model, AutoGluon relies on various performance metrics, which depend on the specific task at hand. For classification tasks, common metrics include accuracy, precision, recall, F1-score, and area under the ROC curve (AUC-ROC). For regression tasks, metrics like mean absolute error (MAE), mean squared error (MSE), and R-squared are often used. AutoGluon automatically calculates these metrics during the evaluation process, providing a comprehensive view of the model's strengths and weaknesses:\nmakefile\n\n```\nfrom sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score\ny_pred = model.predict(X_val)\naccuracy = accuracy_score(y_val, y_pred)\nprecision = precision_score(y_val, y_pred)\nrecall = recall_score(y_val, y_pred)\nf1 = f1_score(y_val, y_pred)\n```\n\n**Automated Model Selection Criteria** After evaluating the models, AutoGluon uses automated criteria to select the best-performing one. This involves comparing the performance metrics across different models and choosing the model that excels in the most relevant metrics for the task. AutoGluon also considers factors like model complexity, training time, and resource efficiency. The automated model selection process ensures that the chosen model not only performs well but is also practical to deploy and use in real-world scenarios. By automating this selection, AutoGluon eliminates human bias and ensures a consistent and objective approach to choosing the best model:\npython\n\n```\nbest_model = max(models, key=lambda model: model['score'])\n```\n\n## 4: AutoGluon in Python\nBefore diving into using AutoGluon, you need to set up your environment. This involves installing the necessary libraries and dependencies.\nYou can install AutoGluon using pip. Open your terminal or command prompt and run the following command:\nbash\n\n```\npip install autogluon\n```\n\nThis command will install AutoGluon along with its required dependencies.\nNext, you need to download the data. You'll need to install Kaggle to download the dataset for this example:\ntypescript\n\n```\npip install kaggle\n```\n\nAfter installing, download the dataset by running these commands in your terminal. Make sure you're in the same directory as your notebook file:\nbash\n\n```\nmkdir data\ncd data\nkaggle competitions download -c playground-series-s4e6\nunzip \"Academic Succession/playground-series-s4e6.zip\"\n```\n\nAlternatively, you can manually download the dataset from the recent Kaggle competition \"Classification with an Academic Success Dataset\". [The dataset is free for commercial use.](https://creativecommons.org/licenses/by/4.0/)\nOnce your environment is set up, you can use AutoGluon to build and evaluate machine learning models. First, you need to load and prepare your dataset. AutoGluon makes this process straightforward. Suppose you have a CSV file named `train.csv` containing your training data:\npython\n\n```\nfrom autogluon.tabular import TabularDataset, TabularPredictor\n\n# Load the dataset\ntrain_df = TabularDataset('data/train.csv')\n```\n\nWith the data loaded, you can train a model using AutoGluon. In this example, we will train a model to predict a target variable named 'Target' and use accuracy as the evaluation metric. We will also enable hyperparameter tuning and automatic stacking to improve model performance:\npython\n\n```\n# Train the model\npredictor = TabularPredictor(\n    label='Target',\n    eval_metric='accuracy',\n    verbosity=1\n).fit(\n    train_df,\n    presets=['best_quality'],\n    hyperparameter_tune=True,\n    auto_stack=True\n)\n```\n\nAfter training, you can evaluate the model's performance using the leaderboard, which provides a summary of the model's performance on the training data:\npython\n\n```\n# Evaluate the model\nleaderboard = predictor.leaderboard(train_df, silent=True)\nprint(leaderboard)\n```\n\nThe leaderboard gives you a detailed comparison of all the models trained by AutoGluon.\n![](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/1xNTK284aT458PMfZsfj4og-1.png)\nLet's break down the key columns and what they mean:\n  * **model** : This column lists the names of the models. For example, `RandomForestEntr_BAG_L1` refers to a Random Forest model using entropy as the criterion, bagged at level 1.\n  * **score_test** : This shows the model's accuracy on the dataset. A score of `1.00` indicates perfect accuracy for some models. Contrary to its name, score_test is the training dataset used during training.\n  * **score_val** : This shows the model's accuracy on the validation dataset. Keep an eye out for this one, as it shows how well the models perform on unseen data.\n  * **eval_metric** : The evaluation metric used, which in this case is accuracy.\n  * **pred_time_test** : The time taken to make predictions on the test data.\n  * **pred_time_val** : The time taken to make predictions on the validation data.\n  * **fit_time** : The time taken to train the model.\n  * **pred_time_test_marginal** : The additional prediction time added by the model in the ensemble on the test dataset.\n  * **pred_time_val_marginal** : The additional prediction time added by the model in the ensemble on the validation dataset.\n  * **fit_time_marginal** : The additional training time added by the model in the ensemble.\n  * **stack_level** : Indicates the stacking level of the model. Level 1 models are the base models, while level 2 models are meta-models that use the predictions of level 1 models as features.\n  * **can_infer** : Indicates whether the model can be used for inference.\n  * **fit_order** : The order in which the models were trained.\n\n\nLooking at the provided leaderboard, we can see some models like `RandomForestEntr_BAG_L1` and `RandomForestGini_BAG_L1` have perfect train accuracy (`1.000000`) but slightly lower validation accuracy, suggesting potential overfitting. `WeightedEnsemble_L2`, which combines the predictions of level 1 models, generally shows good performance by balancing the strengths of its base models.\nModels such as `LightGBMLarge_BAG_L1` and `XGBoost_BAG_L1` have competitive validation scores and reasonable training and prediction times, making them strong candidates for deployment.\nThe `fit_time` and `pred_time` columns offer insights into the computational efficiency of each model, which is crucial for practical applications.\nIn addition to the leaderboard, AutoGluon offers several advanced features that allow you to customize the training process, handle imbalanced datasets, and perform hyperparameter tuning.\nYou can customize various aspects of the training process by adjusting the parameters of the `fit` method. For example, you can change the number of training iterations, specify different algorithms to use, or set custom hyperparameters for each algorithm.\npython\n\n```\nfrom autogluon.tabular import TabularPredictor, TabularDataset\n\n# Load the dataset\ntrain_df = TabularDataset('train.csv')\n\n# Define custom hyperparameters\nhyperparameters = {\n    'GBM': {'num_boost_round': 200},\n    'NN': {'epochs': 10},\n    'RF': {'n_estimators': 100},\n}\n\n# Train the model with custom settings\npredictor = TabularPredictor(\n    label='Target',\n    eval_metric='accuracy',\n    verbosity=2\n).fit(\n    train_data=train_df,\n    hyperparameters=hyperparameters\n)\n```\n\nImbalanced datasets can be challenging, but AutoGluon provides tools to handle them effectively. You can use techniques such as oversampling the minority class, undersampling the majority class, or applying cost-sensitive learning algorithms. AutoGluon can automatically detect and handle imbalances in your dataset.\npython\n\n```\nfrom autogluon.tabular import TabularPredictor, TabularDataset\n\n# Load the dataset\ntrain_df = TabularDataset('train.csv')\n\n# Handle imbalanced datasets by specifying custom parameters\n# AutoGluon can handle this internally but specifying here for clarity\nhyperparameters = {\n    'RF': {'n_estimators': 100, 'class_weight': 'balanced'},\n    'GBM': {'num_boost_round': 200, 'scale_pos_weight': 2},\n}\n\n# Train the model with settings for handling imbalance\npredictor = TabularPredictor(\n    label='Target',\n    eval_metric='accuracy',\n    verbosity=2\n).fit(\n    train_data=train_df,\n    hyperparameters=hyperparameters\n)\n```\n\nHyperparameter tuning is crucial for optimizing model performance. AutoGluon automates this process using advanced techniques like Bayesian optimization. You can enable hyperparameter tuning by setting `hyperparameter_tune=True` in the `fit` method.\npython\n\n```\nfrom autogluon.tabular import TabularPredictor, TabularDataset\n\n# Load the dataset\ntrain_df = TabularDataset('train.csv')\n\n# Train the model with hyperparameter tuning\npredictor = TabularPredictor(\n    label='Target',\n    eval_metric='accuracy',\n    verbosity=2\n).fit(\n    train_data=train_df,\n    presets=['best_quality'],\n    hyperparameter_tune=True\n)\n```\n\nLet's explore how you could potentially outperform an AutoML model. Let's assume your main goal is to improve the loss metric, rather than focusing on latency, computational costs, or other metrics.\nIf you have a large dataset that's well-suited for deep learning, you might find it easier to experiment with deep learning architectures. AutoML frameworks often struggle in this area because deep learning requires a thorough understanding of the dataset, and blindly applying models can be very time and resource-consuming. Here are some resources to get you started with Deep Learning:\n> [**The Math Behind Neural Networks**](https://towardsdatascience.com/the-math-behind-neural-networks-a34a51b93873)\n> [**The Math Behind Fine-Tuning Deep Neural Networks**](https://towardsdatascience.com/the-math-behind-fine-tuning-deep-neural-networks-8138d548da69)\n> [**The Math Behind LSTM**](https://towardsdatascience.com/the-math-behind-lstm-9069b835289d)\nHowever, the real challenge lies in beating AutoML with traditional machine learning tasks. AutoML systems typically use ensembling, which means you'll likely end up doing the same thing. A good starting strategy could be to first fit an AutoML model. For instance, using AutoGluon, you can identify which models performed best. You can then take these models and recreate the ensemble architecture that AutoGluon used. By optimizing these models further with a technique like Optuna, you might be able to achieve better performance. Here's a comprehensive guide to master Optuna:\n> [**Machine Learning Optimization with Optuna**](https://towardsdatascience.com/machine-learning-optimization-with-optuna-57593d700e52)\nAdditionally, applying domain knowledge to feature engineering can give you an edge. Understanding the specifics of your data can help you create more meaningful features, which can significantly boost your model's performance. If applicable, augment your dataset to provide more varied training examples, which can help improve the robustness of your models.\nBy combining these strategies with the insights gained from an initial AutoML model, you can outperform the automated approach and achieve superior results.\n## Conclusion\nAutoGluon revolutionizes the ML process by automating everything from data preprocessing to model deployment. Its cutting-edge architecture, powerful ensemble learning techniques, and sophisticated hyperparameter optimization make it an indispensable tool for newcomers and seasoned data scientists. With AutoGluon, you can transform complex, time-consuming tasks into streamlined workflows, enabling you to build top-tier models with unprecedented speed and efficiency.\nHowever, to truly excel in machine learning, it's essential not to rely solely on AutoGluon. Use it as a foundation to jumpstart your projects and gain insights into effective model strategies. From there, dive deeper into understanding your data and applying domain knowledge for feature engineering. Experiment with custom models and fine-tune them beyond AutoGluon's initial offerings.\n## Bibliography\n  * Erickson, N., Mueller, J., Charpentier, P., Kornblith, S., Weissenborn, D., Norris, E., ... & Smola, A. (2020). AutoGluon-Tabular: Robust and Accurate AutoML for Structured Data. arXiv preprint arXiv:2003.06505.\n  * Snoek, J., Larochelle, H., & Adams, R. P. (2012). Practical Bayesian optimization of machine learning algorithms. Advances in neural information processing systems, 25.\n  * Pedregosa, F., Varoquaux, G., Gramfort, A., Michel, V., Thirion, B., Grisel, O., ... & Duchesnay, É. (2011). Scikit-learn: Machine learning in Python. Journal of machine learning research, 12(Oct), 2825–2830.\n  * AutoGluon Team. \"AutoGluon: AutoML for Text, Image, and Tabular Data.\" 2020.\n  * Feurer, Matthias, et al. \"Efficient and Robust Automated Machine Learning.\" 2015.\n  * He, Xin, et al. \"AutoML: A Survey of the State-of-the-Art.\" 2020.\n  * Hutter, Frank, et al. \"Automated Machine Learning: Methods, Systems, Challenges.\" 2019.\n  * H2O.ai. \"H2O AutoML: Scalable Automatic Machine Learning.\" 2020.\n\n\n## Register Now to Continue Reading\n### Unlock Towards Data Science with a Free Account\nAll articles on Towards Data Science are available to registered users. Create a free account today to access this article and thousands more.\nRegister for freeSign in to your account\n* * *\n![](https://assets.insightmediagroup.io/media/1787657505387_wlyc0o.jpeg)\nWritten By\n## [Cristian Leo](https://towardsdatascience.com/author/cristianleo120/)\n[See all from Cristian Leo](https://towardsdatascience.com/author/cristianleo120/)\n[Deep Dives](https://towardsdatascience.com/tag/deep-dives/)[Deep Learning](https://towardsdatascience.com/tag/deep-learning/)[Machine Learning](https://towardsdatascience.com/tag/machine-learning/)[Programming](https://towardsdatascience.com/tag/programming/)[Python](https://towardsdatascience.com/tag/python/)\nShare This Article\n  * [](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Ftowardsdatascience.com%2Fautoml-with-autogluon-transform-your-ml-workflow-with-just-four-lines-of-code-1d4b593be129%2F&title=AutoML%20with%20AutoGluon%3A%20Transform%20Your%20ML%20Workflow%20with%20Just%20Four%20Lines%20of%20Code)\n  * [](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Ftowardsdatascience.com%2Fautoml-with-autogluon-transform-your-ml-workflow-with-just-four-lines-of-code-1d4b593be129%2F&title=AutoML%20with%20AutoGluon%3A%20Transform%20Your%20ML%20Workflow%20with%20Just%20Four%20Lines%20of%20Code)\n  * [](https://x.com/share?url=https%3A%2F%2Ftowardsdatascience.com%2Fautoml-with-autogluon-transform-your-ml-workflow-with-just-four-lines-of-code-1d4b593be129%2F&text=AutoML%20with%20AutoGluon%3A%20Transform%20Your%20ML%20Workflow%20with%20Just%20Four%20Lines%20of%20Code)\n\n\nTowards Data Science is a community publication. Submit your insights to reach our global audience and earn through the TDS Author Payment Program.\n[Write for TDS](https://towardsdatascience.com/submissions/)\n## Related Articles\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2020/12/0EhvYPpuIui_7-KJ5-scaled.jpg)](https://towardsdatascience.com/fact-checking-covid-19-fake-news-ae49c8d667e2/)\n## [Fact checking COVID-19 fake news](https://towardsdatascience.com/fact-checking-covid-19-fake-news-ae49c8d667e2/)\n[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)\nIn this blog, we explore the problem of fake news detection related to COVID-19 and describe our approach to tackle it using NLP.\n[Prathyush Potluri](https://towardsdatascience.com/author/potluri.prathyush/)\nDecember 4, 202010 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2023/01/1VOkDl6BuEICTgXaGCKg2rA.jpg)](https://towardsdatascience.com/mastering-p-values-in-machine-learning-bdc5bd0dd8ae/)\n## [Mastering P-values in Machine Learning](https://towardsdatascience.com/mastering-p-values-in-machine-learning-bdc5bd0dd8ae/)\n[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)\nUnderstanding P-values and ML use cases\n[Sadrach Pierre, Ph.D.](https://towardsdatascience.com/author/spierre91/)\nJanuary 6, 20237 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2025/09/Langoisse-du-1-au-milieu-des-zeros-1.jpg)](https://towardsdatascience.com/zero-inflated-data-comparison-of-regression-models/)\n## [Zero-Inflated Data: A Comparison of Regression Models](https://towardsdatascience.com/zero-inflated-data-comparison-of-regression-models/)\n[Data Science](https://towardsdatascience.com/category/data-science/)\nHow to detect it and which model to choose.\n[Arnaud Capitaine](https://towardsdatascience.com/author/arnaud.gc.capitaine/)\nSeptember 5, 202511 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2020/07/0Ra3DOde-w_kO1ikb-scaled.jpg)](https://towardsdatascience.com/algorithms-from-scratch-logistic-regression-7bacdfd9738e/)\n## [Algorithms from Scratch: Logistic Regression](https://towardsdatascience.com/algorithms-from-scratch-logistic-regression-7bacdfd9738e/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nDetailing and Building a Logistic Regression model from scratch\n[Kurtis Pykes](https://towardsdatascience.com/author/kurtispykes/)\nJuly 15, 202011 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2022/06/01hlTJV_pHRRguD4u.jpg)](https://towardsdatascience.com/creating-a-dashboard-app-with-dash-heroku-a-streamlined-process-26bce4fbf2c8/)\n## [Creating a Dashboard App with Dash/Heroku: A Streamlined Process](https://towardsdatascience.com/creating-a-dashboard-app-with-dash-heroku-a-streamlined-process-26bce4fbf2c8/)\n[](https://towardsdatascience.com/automl-with-autogluon-transform-your-ml-workflow-with-just-four-lines-of-code-1d4b593be129/)\nAlways wanted to create a dashboard, but concerned about where you have to host it and learning CSS and HTML seems daunting? Then this...\n[Adrienne Kline](https://towardsdatascience.com/author/askline1/)\nJune 6, 20224 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2021/06/0SwOEuUjkNgp0ZOH5.jpg)](https://towardsdatascience.com/training-t5-for-paraphrase-generation-ab3b5be151a2/)\n## [Training T5 for paraphrase generation](https://towardsdatascience.com/training-t5-for-paraphrase-generation-ab3b5be151a2/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nIn my previous blog talking about TextGenie, I mentioned the issues I faced while collecting text data from scratch and using paraphrases...\n[Het Pandya](https://towardsdatascience.com/author/het-pandya/)\nJune 29, 20213 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2021/08/1t-tjPBb9m6YDhRdn3wKGSg-scaled.jpeg)](https://towardsdatascience.com/is-it-worth-spending-two-years-to-learn-data-science-290668d04a9f/)\n## [Is It Worth Spending Two Years to Learn Data Science?](https://towardsdatascience.com/is-it-worth-spending-two-years-to-learn-data-science-290668d04a9f/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nWhat are the rewards?\n[Soner Yıldırım](https://towardsdatascience.com/author/sonery/)\nAugust 24, 20214 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2019/09/1CvBPn3MEjnukrKTabdD1dA-scaled.jpeg)](https://towardsdatascience.com/how-to-retrieve-data-from-a-complex-formatted-file-894098d66e74/)\n## [How to Retrieve Data from A Complex Formatted File](https://towardsdatascience.com/how-to-retrieve-data-from-a-complex-formatted-file-894098d66e74/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nThe way I use to extract data from PDF scanned images\n[Low Wei Hong](https://towardsdatascience.com/author/lowweihong/)\nSeptember 29, 20194 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2023/04/12_-xt1GOyi1z0T9F4oX-Cw.jpeg)](https://towardsdatascience.com/an-impulse-to-action-a-practical-solution-for-positive-unlabelled-classification-cd5895128e45/)\n## [An ImPULSE to Action: A Practical Solution for Positive Unlabelled Classification](https://towardsdatascience.com/an-impulse-to-action-a-practical-solution-for-positive-unlabelled-classification-cd5895128e45/)\n[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)\nWe introduce an approach called ImPULSE Classifier with improved performance on balanced and imbalanced PU data compared to other...\n[Volodymyr Holomb](https://towardsdatascience.com/author/wldmrgml/)\nApril 6, 20235 min read\n\n\n  * [YouTube](https://www.youtube.com/c/TowardsDataScience)\n  * [X](https://x.com/TDataScience)\n  * [LinkedIn](https://www.linkedin.com/company/towards-data-science/)\n  * [Threads](https://www.threads.net/@towardsdatascience)\n  * [Bluesky](https://bsky.app/profile/towardsdatascience.com)\n\n\n[](https://towardsdatascience.com/)\nYour home for data science and AI. The world's leading publication for data science, data analytics, data engineering, machine learning, and artificial intelligence professionals.\nSubscribe to Our Newsletter[Write For TDS](https://towardsdatascience.com/submissions/)•[About](https://towardsdatascience.com/about-towards-data-science-d691af11cc2f/)•[Advertise](https://contact.towardsdatascience.com/advertise-with-towards-data-science)•[Privacy Policy](https://towardsdatascience.com/privacy-policy/)•[Terms of Use](https://towardsdatascience.com/website-terms-of-use/)\n© Insight Media Group, LLC 2026•[The New Stack](https://thenewstack.io)•[roadmap.sh](https://roadmap.sh)•[Creator Network](https://insightmediagroup.io/creator-network)\n####  Recommended Articles \nClose\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607686/image?etag=1782161464448&width=500&height=500) How Relevance Models Foreshadowed Transformers for NLP ](https://towardsdatascience.com/how-relevance-models-foreshadowed-transformers-for-nlp/ \"How Relevance Models Foreshadowed Transformers for NLP\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607639/image?etag=1781250125848&width=500&height=500) Javascript Fatigue: HTMX Is All You Need to Build ChatGPT — Part 1 ](https://towardsdatascience.com/javascript-fatigue-you-dont-need-js-to-build-chatgpt/ \"Javascript Fatigue: HTMX Is All You Need to Build ChatGPT — Part 1\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607930/image?etag=1782124566054&width=500&height=500) The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs ](https://towardsdatascience.com/subset-sum-problem-solved-in-linear-time-for-dense-enough-inputs/ \"The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/3660/image?etag=1780176246070&width=500&height=500) Does Your Company Have a Data Strategy? ](https://towardsdatascience.com/does-your-company-have-a-data-strategy-e8944dbec4ae/ \"Does Your Company Have a Data Strategy?\")\n\n\n",
  "body_base_path": "attachments/de4b4afa15d6/pages/",
  "body_markdown_path": "attachments/de4b4afa15d6/pages/archived-body.md",
  "local_html": "attachments/de4b4afa15d6/pages/archived-body.html",
  "body_source": "prior_capture"
}