This page explains how to apply Mini-Batch Gradient Descent for the training of logistic regression explained in this example. So, refer this page first. This content depends on it.

Caution

logloss() became deprecated since v0.5.0 release. Use smarter general classifier instead. You can use -mini_batch option in general classifier as well.

Training

Replace a9a_model1 of this example.

set hivevar:total_steps=32561;
set hivevar:mini_batch_size=10;

create table a9a_model1 
as
select 
 cast(feature as int) as feature,
 avg(weight) as weight
from 
 (select 
     logress(add_bias(features),label,"-total_steps ${total_steps} -mini_batch ${mini_batch_size}") as (feature,weight)
  from 
     a9atrain
 ) t 
group by feature;

Evaluation

select count(1) / ${num_test_instances} from a9a_submit1 
where actual == predicted;
Stochastic Gradient Descent Minibatch Gradient Descent
0.8430071862907684 0.8463239358761747

results matching ""

    No results matching ""