Whenever I am using Sklearn's Polynomial Features and converting 'X' values to make it Polynomial by this code,
Before that My X value are:-
[[ 1 11]
[ 2 12]
[ 3 13]
[ 4 14]
[ 5 15]
[ 6 16]
[ 7 17]
[ 8 18]
[ 9 19]
[10 20]]
Note: It has multiple X values that mean it has more than one independent variable
poly = PolynomialFeatures(degree=2)
X_poly = poly.fit_transform(X)
print(X_poly)
Sklearn is returning this matrix having more columns besides having all Squared values,
[[ 1. 1. 11. 1. 11. 121.]
[ 1. 2. 12. 4. 24. 144.]
[ 1. 3. 13. 9. 39. 169.]
[ 1. 4. 14. 16. 56. 196.]
[ 1. 5. 15. 25. 75. 225.]
[ 1. 6. 16. 36. 96. 256.]
[ 1. 7. 17. 49. 119. 289.]
[ 1. 8. 18. 64. 144. 324.]
[ 1. 9. 19. 81. 171. 361.]
[ 1. 10. 20. 100. 200. 400.]]
I have seen this Stackoverflow Answer https://stackoverflow.com/a/51906400/12188405 when I web searched for my issue.
So can anyone please tell me a general formula OR a python code that can return that matrix respective to any degree value? In simple words, I want to make a python program that can do it having one Parameter that is a degree (which can be any value from 0 to infinity) and it will return me that Matrix-like Sklearn gives.