Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Linear regression
- data = data.frame(X=c(25,28,35,32,31,36,29,38,34,32), Y = c(43,46,49,41,36,32,31,30,33,39))
- model = lm(Y~X, data=data)
- test = data.frame(X=40)
- predict(model, test)
- ### https://github.com/scikit-learn/scikit-learn/blob/main/sklearn/datasets/data/boston_house_prices.csv
- data = read.csv("boston_house_prices.csv")
- test = tail(data, n=2)
- train = head(data, n=-2)
- model = lm(MEDV ~ ., data=train)
- predict(model, train[50,])
- test
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement