regression (2) 썸네일형 리스트형 [R] Useful Functions for Regression Problems 1. model.matrix() Make dummy variable with category and intercept : model.matrix(~., x) Make dummy variable with category not intercept : mdoel.matirx(~., x)[, -1] Make prediciton from regsubsets, glm, or lm function : model.matrix(~., x) %*% coef(g, id=i) Make prediction from glmnet : model.matrix(~., x) %*% coef(g, s=g$lambda[0]) The model.matrix function convert original data into categorical.. [Theorem] Multivariate Linear Regression 1. Multivariate Hypothesis feet(x1) number of rooms(x2) Built Age(x3) Price of House 1412 5 30 3520 1530 3 45 2420 642 2 56 1238 \(x^{i}_{j}\) : value of feature j in ith training example \(x^i\) : the input features of the ith training example \(m\) : the number of training examples \(n\) : the number of features if \(x_{2}^{2}\), it means 45, if \(x_2\), it means [30, 45, 56] 3 dimensional vec.. 이전 1 다음