Posts

Showing posts with the label python

Regression 6. Finding Unknown Parameters with OLS - Solved Manual Example

Image
You can learn how to perform linear regression by watching my YouTube video. Numeric Example A hypothetical dataset about how online gaming habits affects marks involving children in the age group of 10-15 is tabulated. The first feature is the number of hours in a day spent in gaming. The second feature gives the average marks of the students who spend so many hours in gaming. Problem Statement Find the regression coefficients m and c in the linear regression model using Least Squares Approach: y = c+ m*x Step 1: We need to check if there is linearity between the dependent and independent variables by plotting the scatter plot. We see that there is a linear relationship between the data and so we can apply linear regression. From the blog on OLS, we know to calculate c and m as : This can be easily calculated by hand with a table as follows: So, the regression equation representing the relationship between 'Hours Spent' and 'Marks (%)' is: Marks = 89.0 − 5.5 × Hours Sp...

Regression 3. Linear Regression - Assumptions(With Python Code)

Image
 Linear regression, a foundational statistical method, relies on several key assumptions. Understanding these assumptions is crucial for interpreting the results accurately.  Assumptions Let's go through each assumption with examples: 1. Linearity:     Assumption: The relationship between the independent variables and the dependent variable is linear.     Example: Let's say you're studying the relationship between temperature and ice cream sales. If a linear regression model is appropriate, an increase in temperature should consistently lead to an increase in ice cream sales at a constant rate. 2. Independence:     Assumption: The residuals (or errors) are independent. The assumption states that the residuals (the differences between observed and predicted values) should be independent of each other. This means that the value of one error should not predict the value of another error. In other words, there should be no correlation between the resi...

Regression1. Regression Overview with Python Code

Image
A detailed explanation for Regression can be viewed in the following YouTube video. Regression vs Classification A regression task in the context of machine learning and statistics is a type of problem where the goal is to predict a continuous outcome variable based on one or more predictor variables . It's different from classification tasks, where the goal is to predict a discrete label . Regression is used to understand relationships between variables and for predicting trends or future values. The output to a regression problem is a vector of real numbers.  Understanding Regression 1. Continuous Outcome Variable:  This is a variable that can take any value within a range. It can take decimal values and not just integer values. They are the dependent variables. Example For instance, predicting temperatures, prices, or distances. The distance is a real number say 32km. Even though it looks like an integer, it may actually be a real number say 32.0000004 subsuming km and som...