Comments (3)
Thanks for the kind words.
For the first issue (Chapter 5), the h(i) is calculated by Equation 3.37 which goes something like this (my mathjax foo is non-existent unfortunately):
h(i) = (1/n) + (x(i) - xmean)^2 / sum((x(i) - xmean)^2)
which I attempted to replicate faithfully. Can you tell me what expression you meant?
For Chapter 9, I think the expression that SVR uses for a straight line is y = mx - c (rather than the more common y = mx + c). That is why c = reg.intercept_ / reg.coef_[0][1]. The SVM tutorial also uses the same thing, notice: yy = a * xx - (clf.intercept_[0]) / w[1]
from statlearning-notebooks.
Thank you for your help.
For the first issue, you just miss the power 2 in the code.
For the second one, SVR uses y = mx-c which is different with the SVM (y = mx+c). By using SVM, we may have a unified way to write the code.
ys = [m * x + c for x in xs]
plt.plot(xs, ys, color='black', linewidth=2.5)
# support margins
sup = reg.support_vectors_[0]
ys_down = [m * x + (sup[1] - m * sup[0]) for x in xs]
sup = reg.support_vectors_[-1]
ys_up = [m * x + (sup[1] - m * sup[0]) for x in xs]
from statlearning-notebooks.
Ah, I see the problem in Chapter 5 now, thanks for catching, fixed. Also on Chapter 9, we can do the unification by fixing ys = mx - c (I had an error there) and subtracting the support vectors in both cases similar to your example above. Also realized that the paths to the data files were incorrect following the move from the old repository to the new one, fixed that too. Closing this, thanks again for reporting.
from statlearning-notebooks.
Related Issues (3)
- License? HOT 1
- LOOCV calculation Error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from statlearning-notebooks.