What is the difference between classification and regression in supervised machine learning?

In classification, the goal is to assign input data to specific, predefined categories. The output in classification is typically a label or a class from a set of predefined options.

In regression, the goal is to establish a relationship between input variables and the output. The output in regression is a real-valued number that can vary within a range.

In both supervised learning approaches the goal is to find patterns or relationships in the input data so we can accurately predict the desired outcomes. The difference is that classification predicts categorical classes (like spam), while regression predicts continuous numerical values (like age, income, or temperature).