Beispiel #1
0
void BPNN::_test() {
	int right_cnt = 0, tot_cnt = 0;
	for ( int i = 0; i < _test_sample_cnt; i ++) {
		double *ry = _calculate(_t_x[i]);
		int index = 0;
		double vmax = -1000000.0;
		for ( int j = 0; j < 10; j ++) {
			if (vmax < ry[j]) {
				vmax = ry[j];
				index= j ;
			}
			cout << ry[j] << " " << _t_y[i][j] << " ";
		}
		cout << index << " " <<  vmax << endl;
		if ( ry != NULL ) {
			delete [] ry;
			ry = NULL;
		}
		if ( _t_y[i][index] == 1)
		{
			right_cnt += 1;
		}
		tot_cnt += 1;
	}
	cout << "[LOG] right cnt : " << right_cnt << " " << "total cnt: " << tot_cnt << endl;
	
}
Beispiel #2
0
void TextArea::render()
{
    if (_changed) _calculate();

    for (auto& symbol : _symbols)
    {
        symbol.render(x(), y());
    }
}
Beispiel #3
0
unsigned int TextArea::height()
{
    if (_height == 0)
    {
        if (_calculatedHeight == 0)
        {
            _calculate();
        }
        return _calculatedHeight;
    }
    return _width;
}
Beispiel #4
0
unsigned int TextArea::width()
{
    if (_width == 0)
    {
        if (_calculatedWidth == 0)
        {
            _calculate();
        }
        return _calculatedWidth;
    }
    return _width;
}
Beispiel #5
0
uint8_t AP_Baro_MS5611::read()
{
    _sync_access = true;
    bool updated = _updated;
    _updated = 0;
    if (updated > 0) {
        D1 = _s_D1;
        D2 = _s_D2;
        _raw_press = D1;
        _raw_temp = D2;
    }
    _sync_access = false;
    _calculate();
    return updated ? 1 : 0;
}
int Hero::hp(int level, int step, int quality, float growing)
{
    return _calculate(modulus_hp, level, step, quality, growing);
}
int Hero::defense(int level, int step, int quality, float growing)
{
    return _calculate(modulus_defense, level, step, quality, growing);
}
int Hero::attack(int level, int step, int quality, float growing)
{
    return _calculate(modulus_attack, level, step, quality, growing);
}