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.

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 DescentMinibatch Gradient Descent
0.84300718629076840.8463239358761747