Ejemplo n.º 1
0
void
Control_Point::draw_box ( void )
{
    if ( selected() )
        fl_color( selection_color() );
    else
        fl_color( box_color() );

    fl_pie( x() - ( abs_w() / 2 ), y() - ( h() / 2 ), abs_w(), h(), 0, 360 );

    if ( this == Sequence_Widget::belowmouse() ||
         this == Sequence_Widget::pushed() )
    {
        char val[10];
        snprintf( val, sizeof( val ), "%+.2f", 1.0 - _y * 2 );

        Fl_Align a = 0;

        if ( x() < _sequence->x() + ( _sequence->w() / 2 ) )
            a |= FL_ALIGN_RIGHT;
        else
            a |= FL_ALIGN_LEFT;

        if ( y() < _sequence->y() + ( _sequence->h() / 2 ) )
            a |= FL_ALIGN_BOTTOM;
        else
            a |= FL_ALIGN_TOP;
            
        draw_label( val, a, FL_FOREGROUND_COLOR );
    }
}
Ejemplo n.º 2
0
void
Sequence_Region::draw_label ( const char *label, Fl_Align align, Fl_Color color, int xo, int yo )
{
    fl_color( FL_WHITE );
    fl_font( FL_HELVETICA_ITALIC, 10 );
    fl_draw( label, line_x() + Fl::box_dx( box() ), y() + Fl::box_dy( box() ), abs_w() - Fl::box_dw( box() ), h() - Fl::box_dh( box() ), align );
}
Ejemplo n.º 3
0
void
Sequence_Region::draw_box ( void )
{
    Fl_Color c = selected() ? selection_color() : box_color();

    fl_draw_box( box(), line_x(), y(), abs_w(), h(), fl_color_add_alpha( c, 127 ) );
}
Ejemplo n.º 4
0
void MCLR_SM::Get_Gradient(vnl_matrix<double> data_with_bias)
{
	// f  = exp(w'*[ones(1,N);basis]); In MATLAB 
	 vnl_matrix<double> f;
	f = Get_F_Matrix(data_with_bias,m.w);
	f = Normalize_F_Sum(f);
	
	 //   grad_w = grad_w - C*(w./sqrt(w.^2+delta));
	// |w| approximation
	
	vnl_matrix<double> abs_w; //
	abs_w.set_size(no_of_features+1,no_of_classes);
	
	for(int i=0;i<no_of_features+1;++i)
	{
	  for(int j=0;j<no_of_classes;++j)
	   {
		 abs_w(i,j) = m.w(i,j)/ sqrt((m.w(i,j))*(m.w(i,j)) + delta);
	  }
	}

	//Gradient computation
	gradient_w = data_with_bias*(z-f).transpose();	

	//Gradient with sparsity
	gradient_w = gradient_w - m.sparsity_control*abs_w;

}