PHP Class Phpml\Clustering\KMeans\Space

Inheritance: extends SplObjectStorag\SplObjectStorage
Show file Open project: php-ai/php-ml Class Usage Examples

Protected Properties

Property Type Description
$dimension integer

Public Methods

Method Description
__construct ( $dimension )
addPoint ( array $coordinates, null $data = null )
attach ( object $point, null $data = null )
cluster ( integer $clustersNumber, integer $initMethod = KMeans::INIT_RANDOM ) : array | Cluster[]
getBoundaries ( ) : array | boolean
getDimension ( ) : integer
getRandomPoint ( Point $min, Point $max ) : Point
newPoint ( array $coordinates ) : Point
toArray ( ) : array

Protected Methods

Method Description
initializeClusters ( integer $clustersNumber, integer $initMethod ) : array | Cluster[]
initializeKMPPClusters ( integer $clustersNumber ) : array
iterate ( $clusters ) : boolean

Private Methods

Method Description
initializeRandomClusters ( integer $clustersNumber ) : array

Method Details

__construct() public method

public __construct ( $dimension )
$dimension

addPoint() public method

public addPoint ( array $coordinates, null $data = null )
$coordinates array
$data null

attach() public method

public attach ( object $point, null $data = null )
$point object
$data null

cluster() public method

public cluster ( integer $clustersNumber, integer $initMethod = KMeans::INIT_RANDOM ) : array | Cluster[]
$clustersNumber integer
$initMethod integer
return array | Cluster[]

getBoundaries() public method

public getBoundaries ( ) : array | boolean
return array | boolean

getDimension() public method

public getDimension ( ) : integer
return integer

getRandomPoint() public method

public getRandomPoint ( Point $min, Point $max ) : Point
$min Point
$max Point
return Point

initializeClusters() protected method

protected initializeClusters ( integer $clustersNumber, integer $initMethod ) : array | Cluster[]
$clustersNumber integer
$initMethod integer
return array | Cluster[]

initializeKMPPClusters() protected method

protected initializeKMPPClusters ( integer $clustersNumber ) : array
$clustersNumber integer
return array

iterate() protected method

protected iterate ( $clusters ) : boolean
$clusters
return boolean

newPoint() public method

public newPoint ( array $coordinates ) : Point
$coordinates array
return Point

toArray() public method

public toArray ( ) : array
return array

Property Details

$dimension protected property

protected int $dimension
return integer