Giter Site home page Giter Site logo

krr's Introduction

Kernel Ridge Regression


1. Load and split Advertising dataset

> ad <- read.csv("Advertising.csv")
> X <- ad[,2:4]
> Y <- ad[,5]
> set.seed(0506)
> train <- sample(1:nrow(X),2*nrow(X)/3)
> trainX <- X[train,]
> trainY <- Y[train,]
> testX <- X[-train,]
> testY <- Y[-train,]

2. fit KRR using polynomial

get the testMSE = 10.45449, with d=3, lambda=0.01

> method = 2
> d = 3
> lambda = 0.01
> predY1 <- krr(method, d, trainX, trainY, testX, lambda)
> MSE1 <- mean((predY1-testY)^2)

3. fit KRR using radial

get the testMSE = 10.3372, with r=0.001, lambda=0.1

> method = 2
> r = 0.001
> lambda = 0.1
> predY2 <- krr(method, d, trainX, trainY, testX, lambda)
> MSE2 <- mean((predY2-testY)^2)

krr's People

Contributors

vincent101 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.