Backend/Database/GTable.cpp
/*!
 * @brief standardize GTable
 * @details standardize the values in a GTable; that is, map the values from their existing range to
 * the range of -1.0 to 1.0
 */
@brief standardize GTable
@details standardize the values in a GTable; that is, map the values from their existing range to
the range of -1.0 to 1.0
@brief standardize GTable @details standardize the values in a GTable ; that is map the values from their existing range to the range of - 1 . 0 to 1 . 0
void GTable::standardize()
{
	if ((numberOfRows() <= 0) || (numberOfCols() <= 0))
		return;
	xMin = 0.0f;
	xMax = 0.0f;
	for (unsigned int r = 0; r < numberOfRows(); ++r)
	{
		for (unsigned int c = 0; c < numberOfCols(); ++c)
		{
			GType cCell = getCell(r, c);
			float cell = 0.0f;
			if (cCell.getType() == GType::STRING_TYPE)
			{
			}
			else if (cCell.getType() == GType::CHAR_TYPE)
				cell = cCell.getChar();
			else if (cCell.getType() == GType::SHORT_TYPE)
				cell = cCell.getShort();
			else if (cCell.getType() == GType::INT_TYPE)
				cell = cCell.getInt();
			else if (cCell.getType() == GType::LONG_TYPE)
				cell = cCell.getLong();
			else if (cCell.getType() == GType::FLOAT_TYPE)
				cell = cCell.getFloat();
			else if (cCell.getType() == GType::DOUBLE_TYPE)
				cell = cCell.getDouble();
			else if (cCell.getType() == GType::BOOLEAN_TYPE)
				cell = cCell.getBoolean() ? 1.0f : 0.0f;
			if ((r == 0) && (c == 0))
			{
				xMin = cell;
				xMax = cell;
			}
			if (cell < xMin)
				xMin = cell;
			if (cell > xMax)
				xMax = cell;
		}
	}
	xRange = xMax - xMin;
	if (xRange == 0.0f)
		return;
	for (unsigned int r = 0; r < numberOfRows(); ++r)
	{
		for (unsigned int c = 0; c < numberOfCols(); ++c)
		{
			GType cCell = getCell(r, c);
			float cell = 0.0f;
			if (cCell.getType() == GType::STRING_TYPE)
			{
			}
			else if (cCell.getType() == GType::CHAR_TYPE)
			{
				cell = cCell.getChar();
				cell = (((cell - xMin) / (xRange)) - 0.5f);
				cCell.set(GType::FLOAT_TYPE, &cell, sizeof(float));
			}
			else if (cCell.getType() == GType::SHORT_TYPE)
			{
				cell = cCell.getShort();
				cell = (((cell - xMin) / (xRange)) - 0.5f);
				cCell.set(GType::FLOAT_TYPE, &cell, sizeof(float));
			}
			else if (cCell.getType() == GType::INT_TYPE)
			{
				cell = cCell.getInt();
				cell = (((cell - xMin) / (xRange)) - 0.5f);
				cCell.set(GType::FLOAT_TYPE, &cell, sizeof(float));
			}
			else if (cCell.getType() == GType::LONG_TYPE)
			{
				cell = cCell.getLong();
				cell = (((cell - xMin) / (xRange)) - 0.5f);
				cCell.set(GType::FLOAT_TYPE, &cell, sizeof(float));
			}
			else if (cCell.getType() == GType::FLOAT_TYPE)
			{
				cell = cCell.getFloat();
				cell = (((cell - xMin) / (xRange)) - 0.5f);
				cCell.set(GType::FLOAT_TYPE, &cell, sizeof(float));
			}
			else if (cCell.getType() == GType::DOUBLE_TYPE)
			{
				cell = cCell.getDouble();
				cell = (((cell - xMin) / (xRange)) - 0.5f);
				cCell.set(GType::FLOAT_TYPE, &cell, sizeof(float));
			}
			else if (cCell.getType() == GType::BOOLEAN_TYPE)
			{
				cell = cCell.getBoolean() ? 1.0f : 0.0f; 
				cell = (((cell - xMin) / (xRange)) - 0.5f);
				cCell.set(GType::FLOAT_TYPE, &cell, sizeof(float));
			}
		}
	}
}
void GTable :: standardize ( ) { if ( ( numberOfRows ( ) <= 0 ) || ( numberOfCols ( ) <= 0 ) ) return ; xMin = 0.0f ; xMax = 0.0f ; for ( unsigned int r = 0 ; r < numberOfRows ( ) ; ++ r ) { for ( unsigned int c = 0 ; c < numberOfCols ( ) ; ++ c ) { GType cCell = getCell ( r , c ) ; float cell = 0.0f ; if ( cCell . getType ( ) == GType :: STRING_TYPE ) { } else if ( cCell . getType ( ) == GType :: CHAR_TYPE ) cell = cCell . getChar ( ) ; else if ( cCell . getType ( ) == GType :: SHORT_TYPE ) cell = cCell . getShort ( ) ; else if ( cCell . getType ( ) == GType :: INT_TYPE ) cell = cCell . getInt ( ) ; else if ( cCell . getType ( ) == GType :: LONG_TYPE ) cell = cCell . getLong ( ) ; else if ( cCell . getType ( ) == GType :: FLOAT_TYPE ) cell = cCell . getFloat ( ) ; else if ( cCell . getType ( ) == GType :: DOUBLE_TYPE ) cell = cCell . getDouble ( ) ; else if ( cCell . getType ( ) == GType :: BOOLEAN_TYPE ) cell = cCell . getBoolean ( ) ? 1.0f : 0.0f ; if ( ( r == 0 ) && ( c == 0 ) ) { xMin = cell ; xMax = cell ; } if ( cell < xMin ) xMin = cell ; if ( cell > xMax ) xMax = cell ; } } xRange = xMax - xMin ; if ( xRange == 0.0f ) return ; for ( unsigned int r = 0 ; r < numberOfRows ( ) ; ++ r ) { for ( unsigned int c = 0 ; c < numberOfCols ( ) ; ++ c ) { GType cCell = getCell ( r , c ) ; float cell = 0.0f ; if ( cCell . getType ( ) == GType :: STRING_TYPE ) { } else if ( cCell . getType ( ) == GType :: CHAR_TYPE ) { cell = cCell . getChar ( ) ; cell = ( ( ( cell - xMin ) / ( xRange ) ) - 0.5f ) ; cCell . set ( GType :: FLOAT_TYPE , & cell , sizeof ( float ) ) ; } else if ( cCell . getType ( ) == GType :: SHORT_TYPE ) { cell = cCell . getShort ( ) ; cell = ( ( ( cell - xMin ) / ( xRange ) ) - 0.5f ) ; cCell . set ( GType :: FLOAT_TYPE , & cell , sizeof ( float ) ) ; } else if ( cCell . getType ( ) == GType :: INT_TYPE ) { cell = cCell . getInt ( ) ; cell = ( ( ( cell - xMin ) / ( xRange ) ) - 0.5f ) ; cCell . set ( GType :: FLOAT_TYPE , & cell , sizeof ( float ) ) ; } else if ( cCell . getType ( ) == GType :: LONG_TYPE ) { cell = cCell . getLong ( ) ; cell = ( ( ( cell - xMin ) / ( xRange ) ) - 0.5f ) ; cCell . set ( GType :: FLOAT_TYPE , & cell , sizeof ( float ) ) ; } else if ( cCell . getType ( ) == GType :: FLOAT_TYPE ) { cell = cCell . getFloat ( ) ; cell = ( ( ( cell - xMin ) / ( xRange ) ) - 0.5f ) ; cCell . set ( GType :: FLOAT_TYPE , & cell , sizeof ( float ) ) ; } else if ( cCell . getType ( ) == GType :: DOUBLE_TYPE ) { cell = cCell . getDouble ( ) ; cell = ( ( ( cell - xMin ) / ( xRange ) ) - 0.5f ) ; cCell . set ( GType :: FLOAT_TYPE , & cell , sizeof ( float ) ) ; } else if ( cCell . getType ( ) == GType :: BOOLEAN_TYPE ) { cell = cCell . getBoolean ( ) ? 1.0f : 0.0f ; cell = ( ( ( cell - xMin ) / ( xRange ) ) - 0.5f ) ; cCell . set ( GType :: FLOAT_TYPE , & cell , sizeof ( float ) ) ; } } } }
@brief standardize GTable
 @details standardize the values in a GTable; that is, map the values from their existing range to
 the range of -1.0 to 1.0
@brief standardize GTable @details standardize the values in a GTable ; that is map the values from their existing range to the range of - 1 . 0 to 1 . 0
// Standardize the initialization of the weights // Set the min and max of the weights // iterate through the rows // iterate through the cols // OHE: total unique words // Check the mins and maxes // standardize the weights // iterate through the rows // iterate through the cols // Adjust the children // OHE: total unique words // 1 or 0 if sigmoid