Data Type#

Determine the data type of a variable according to Rubix ML's type system.

Determining Data Type#

To determine the integer-encoded data type of a variable:

public determine($variable) : int

Example

use Rubix\ML\Other\Helpers\DataType;

var_dump(DataType::determine('adventure'));

Output

int(2)

Note: The return value is an integer encoding of the datatype defined as constants on the DataType class.

Is Type?#

Return true if the variable is categorical:

public isCategorical($variable) : bool

Return true if the variable is categorical:

public isContinuous($variable) : bool

Return true if the variable is a PHP resource:

public isResource($variable) : bool

Return true if the variable is an unrecognized data type:

public isOther($variable) : bool

Example

var_dump(DataType::isContinuous(16));

var_dump(DataType::isContinuous(0.928346));

var_dump(DataType::isCategorical(18));

var_dump(DataType::isCategorical('outdoors'));

var_dump(DataType::isCategorical('16'));

Output

bool(true)

bool(true)

bool(false)

bool(true)

bool(true)