void add_weight_vector_to_linear_model(MODEL *model) /* compute weight vector in linear case and add to model */ { long i; model->lin_weights=(double *)my_malloc(sizeof(double)*(model->totwords+1)); clear_vector_n(model->lin_weights,model->totwords); for(i=1;i<model->sv_num;i++) { add_vector_ns(model->lin_weights,(model->supvec[i]->vectors[0])->words, model->alpha[i]); } }
void add_weight_vector_to_linear_model(MODEL *model) /* compute weight vector in linear case and add to model */ { long i; SVECTOR *f; model->lin_weights=(double *)my_malloc(sizeof(double)*(model->totwords+1)); clear_vector_n(model->lin_weights,model->totwords); for(i=1;i<model->sv_num;i++) { for(f=(model->supvec[i])->fvec;f;f=f->next) add_vector_ns(model->lin_weights,f,f->factor*model->alpha[i]); } }