MultipleLinearRegressionPython
Multiple linear regression with Python, numpy, matplotlib, plot in 3d
Install / Use
/learn @chardur/MultipleLinearRegressionPythonREADME
Multiple linear regression with Python, numpy, matplotlib, plot in 3d
<br/> Background info / Notes: <br/> Equation:<br/> Multiple regression: Y = b0 + b1*X1 + b2*X2 + ... +bnXn<br/> compare to Simple regression: Y = b0 + b1*X<br/> <br/> In English: <br/> Y is the predicted value of the dependent variable<br/> X1 through Xn are n distinct independent variables<br/> b0 is the value of Y when all of the independent variables (X1 through Xn) are equal to zero<br/> b1 through bn are the slope of the relationship between the dependent variable and the independed variable that is holding constant of all other independent variables.<br/> <br/> Think of it as a system of equations:<br/> Y1 = (b + mX1) + e1<br/> Y2 = (b + mX2) + e2<br/> ...<br/> Yn = (b + mXn) + en<br/> We can then set up a matrix equation with the following matrices:<br/> <br/> |Y1|<br/> Y = |......|<br/> |Yn|<br/> <br/> |1 X1|<br/> X = |... ...|<br/> |1 Xn|<br/> <br/> |b|<br/> A = |m|<br/> <br/> |e1|<br/> E = |......|<br/> |en|<br/> <br/> Which gives us the matrix equation: Y = XA + E<br/> We just need to solve for A<br/> <br/> Use Linear Algebra to solve<br/> Equation: <br/> A = (X^T * X)^-1 * (X^T * Y) <br/> <br/> Two helpful links that explain how we get this equation:<br/> https://www.youtube.com/watch?v=Qa_FI92_qo8<br/> https://www.youtube.com/watch?v=qdOG7YMolmA<br/> <br/> Convert the equation to code:<br/> Using the np.linalg.solve function we will not need to invert the first term<br/> a = np.linalg.solve(np.dot(X.T, X), np.dot(X.T, Y))<br/> <br/> <p> <img src="MultiLinearBPgraph1.png" alt="image"> <br/> <img src="MultiLinearBPGraph2.gif" alt="image"> <br/> <img src="MultiLinearBPgraph3.png" alt="image"> </p>Related Skills
node-connect
343.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
92.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.3kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
