neupy.algorithms.rbfn.rbf_kmeans module

class neupy.algorithms.rbfn.rbf_kmeans.RBFKMeans[source]

Radial basis function K-means for clustering.

Parameters:

n_clusters : int

Number of clusters.

show_epoch : int or str

This property controls how often the network will display information about training. There are two main syntaxes for this property.

  • You can define it as a positive integer number. It defines how offen would you like to see summary output in terminal. For instance, number 100 mean that network shows summary at 100th, 200th, 300th ... epochs.
  • String defines number of times you want to see output in terminal. For instance, value '2 times' mean that the network will show output twice with approximately equal period of epochs and one additional output would be after the finall epoch.

Defaults to 1.

shuffle_data : bool

If it’s True class shuffles all your training data before training your network, defaults to True.

epoch_end_signal : function

Calls this function when train epoch finishes.

train_end_signal : function

Calls this function when train process finishes.

verbose : bool

Property controls verbose output interminal. True enables informative output in the terminal and False - disable it. Defaults to False.

Examples

>>> import numpy as np
>>> from neupy.algorithms import RBFKMeans
>>>
>>> data = np.array([
...     [0.11, 0.20],
...     [0.25, 0.32],
...     [0.64, 0.60],
...     [0.12, 0.42],
...     [0.70, 0.73],
...     [0.30, 0.27],
...     [0.43, 0.81],
...     [0.44, 0.87],
...     [0.12, 0.92],
...     [0.56, 0.67],
...     [0.36, 0.35],
... ])
>>> rbfk_net = RBFKMeans(n_clusters=2, verbose=False)
>>> rbfk_net.train(data, epsilon=1e-5)
>>> rbfk_net.centers
array([[ 0.228     ,  0.312     ],
       [ 0.48166667,  0.76666667]])
>>>
>>> new_data = np.array([[0.1, 0.1], [0.9, 0.9]])
>>> rbfk_net.predict(new_data)
array([[ 0.],
       [ 1.]])

Attributes

centers (array-like with shape (n_clusters, n_futures)) Cluster centers.

Methods

train(input_train, epsilon=1e-5, epochs=100) Trains network.
predict(input_data) Predicts output for the specified input.
fit(*args, **kwargs) Alias to the train method.
n_clusters = None[source]
options = {'verbose': Option(class_name='Verbose', value=VerboseProperty(name="verbose")), 'show_epoch': Option(class_name='BaseNetwork', value=ShowEpochProperty(name="show_epoch")), 'shuffle_data': Option(class_name='BaseNetwork', value=Property(name="shuffle_data")), 'epoch_end_signal': Option(class_name='BaseNetwork', value=Property(name="epoch_end_signal")), 'train_end_signal': Option(class_name='BaseNetwork', value=Property(name="train_end_signal")), 'n_clusters': Option(class_name='RBFKMeans', value=IntProperty(name="n_clusters"))}[source]
predict(input_data)[source]

Return prediction results for the input data.

Parameters:input_data : array-like
Returns:array-like
step = None[source]
train(input_train, epsilon=1e-05, epochs=100)[source]

Method train neural network.

Parameters:

input_train : array-like

target_train : array-like or None

input_test : array-like or None

target_test : array-like or None

epochs : int

Defaults to 100.

epsilon : float or None

Defaults to None.

train_epoch(input_train, target_train)[source]