How to find execution time of classification algorithms in R? [duplicate]
up vote
0
down vote
favorite
This question already has an answer here:
get execution time in milliseconds in R
3 answers
I am running a naive bayes classifcation algorithm in R. I want to calculate the execution time of the algorithm.
Shall i use
Start_time <- proc.time()
{
#execution of naive bayes classifier
}
End_time <- proc_time()
Exec_time = End_time - Start_time
to find the execution time.
Is it the right way to calculate the execution time of an algorithm?
r execution-time
marked as duplicate by Henrik
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 21 at 20:52
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
up vote
0
down vote
favorite
This question already has an answer here:
get execution time in milliseconds in R
3 answers
I am running a naive bayes classifcation algorithm in R. I want to calculate the execution time of the algorithm.
Shall i use
Start_time <- proc.time()
{
#execution of naive bayes classifier
}
End_time <- proc_time()
Exec_time = End_time - Start_time
to find the execution time.
Is it the right way to calculate the execution time of an algorithm?
r execution-time
marked as duplicate by Henrik
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 21 at 20:52
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
This question already has an answer here:
get execution time in milliseconds in R
3 answers
I am running a naive bayes classifcation algorithm in R. I want to calculate the execution time of the algorithm.
Shall i use
Start_time <- proc.time()
{
#execution of naive bayes classifier
}
End_time <- proc_time()
Exec_time = End_time - Start_time
to find the execution time.
Is it the right way to calculate the execution time of an algorithm?
r execution-time
This question already has an answer here:
get execution time in milliseconds in R
3 answers
I am running a naive bayes classifcation algorithm in R. I want to calculate the execution time of the algorithm.
Shall i use
Start_time <- proc.time()
{
#execution of naive bayes classifier
}
End_time <- proc_time()
Exec_time = End_time - Start_time
to find the execution time.
Is it the right way to calculate the execution time of an algorithm?
This question already has an answer here:
get execution time in milliseconds in R
3 answers
r execution-time
r execution-time
edited Nov 21 at 19:01
42-
210k14249394
210k14249394
asked Nov 21 at 18:37
raji sadhu
11
11
marked as duplicate by Henrik
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 21 at 20:52
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Henrik
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 21 at 20:52
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
You can use package microbenchmark or rbenchmark to test code.
First define a function:
myfunction <- function(){}
then define how many times should run the function
n <- 10
Here is an example using microbenchmark:
microbenchmark::microbenchmark(myfunction(),times=n) #run your function "n" times
Here is an example using rbenchmark:
rbenchmark::benchmark(myfunction(),replications=n) #run your function "n" times
For both packages you can get the result using operator <-
. For example:
microbenchmark::microbenchmark(a<-myfunction(),times=n) # result is in variable "a"
rbenchmark::rbenchmark(a<-myfunction(),times=n) # result is in variable "a"
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
You can use package microbenchmark or rbenchmark to test code.
First define a function:
myfunction <- function(){}
then define how many times should run the function
n <- 10
Here is an example using microbenchmark:
microbenchmark::microbenchmark(myfunction(),times=n) #run your function "n" times
Here is an example using rbenchmark:
rbenchmark::benchmark(myfunction(),replications=n) #run your function "n" times
For both packages you can get the result using operator <-
. For example:
microbenchmark::microbenchmark(a<-myfunction(),times=n) # result is in variable "a"
rbenchmark::rbenchmark(a<-myfunction(),times=n) # result is in variable "a"
add a comment |
up vote
0
down vote
You can use package microbenchmark or rbenchmark to test code.
First define a function:
myfunction <- function(){}
then define how many times should run the function
n <- 10
Here is an example using microbenchmark:
microbenchmark::microbenchmark(myfunction(),times=n) #run your function "n" times
Here is an example using rbenchmark:
rbenchmark::benchmark(myfunction(),replications=n) #run your function "n" times
For both packages you can get the result using operator <-
. For example:
microbenchmark::microbenchmark(a<-myfunction(),times=n) # result is in variable "a"
rbenchmark::rbenchmark(a<-myfunction(),times=n) # result is in variable "a"
add a comment |
up vote
0
down vote
up vote
0
down vote
You can use package microbenchmark or rbenchmark to test code.
First define a function:
myfunction <- function(){}
then define how many times should run the function
n <- 10
Here is an example using microbenchmark:
microbenchmark::microbenchmark(myfunction(),times=n) #run your function "n" times
Here is an example using rbenchmark:
rbenchmark::benchmark(myfunction(),replications=n) #run your function "n" times
For both packages you can get the result using operator <-
. For example:
microbenchmark::microbenchmark(a<-myfunction(),times=n) # result is in variable "a"
rbenchmark::rbenchmark(a<-myfunction(),times=n) # result is in variable "a"
You can use package microbenchmark or rbenchmark to test code.
First define a function:
myfunction <- function(){}
then define how many times should run the function
n <- 10
Here is an example using microbenchmark:
microbenchmark::microbenchmark(myfunction(),times=n) #run your function "n" times
Here is an example using rbenchmark:
rbenchmark::benchmark(myfunction(),replications=n) #run your function "n" times
For both packages you can get the result using operator <-
. For example:
microbenchmark::microbenchmark(a<-myfunction(),times=n) # result is in variable "a"
rbenchmark::rbenchmark(a<-myfunction(),times=n) # result is in variable "a"
answered Nov 21 at 19:48
Csd
29819
29819
add a comment |
add a comment |