KNN

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

KNN

reichmaj
R-Help

 

Does one need to normalize ones data is using the knn function within the
caret Library.

 

Jeff


        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: KNN

David Carlson
It depends on what you are trying to do and what kind of data you are using. If you are using Euclidian distance and your variables have different means and standard deviations, the answer is probably yes. That will weight each variable equally. Without standardization the variables with the larger magnitudes will determine the groups more than the variables with the smaller magnitudes.

David L. Carlson
Department of Anthropology
Texas A&M University

-----Original Message-----
From: R-help [mailto:[hidden email]] On Behalf Of Jeff Reichman
Sent: Thursday, June 21, 2018 11:36 AM
To: [hidden email]
Subject: [R] KNN

R-Help

 

Does one need to normalize ones data is using the knn function within the
caret Library.

 

Jeff


        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: KNN

Eivind K. Dovik
In reply to this post by reichmaj
Yes, however using caret you  can do it directly
using the preProcess parameter, e.g. train(y ~., data
= train, method = "knn", preProcess = c("center", "scale")).

Hope this helps.


Eivind


On Thu, 21 Jun 2018, Jeff Reichman wrote:

> R-Help
>
>
>
> Does one need to normalize ones data is using the knn function within the
> caret Library.
>
>
>
> Jeff
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: KNN

reichmaj
In reply to this post by David Carlson
David

I figured out where I went wrong.  But thank you for the response

Jeff

-----Original Message-----
From: David L Carlson <[hidden email]>
Sent: Thursday, June 21, 2018 11:43 AM
To: [hidden email]; [hidden email]
Subject: RE: [R] KNN

It depends on what you are trying to do and what kind of data you are using
If you are using Euclidian distance and your variables have different means
and standard deviations, the answer is probably yes. That will weight each
variable equally. Without standardization the variables with the larger
magnitudes will determine the groups more than the variables with the
smaller magnitudes.

David L. Carlson
Department of Anthropology
Texas A&M University

-----Original Message-----
From: R-help [mailto:[hidden email]] On Behalf Of Jeff
Reichman
Sent: Thursday, June 21, 2018 11:36 AM
To: [hidden email]
Subject: [R] KNN

R-Help

 

Does one need to normalize ones data is using the knn function within the
caret Library.

 

Jeff


        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.