neupy.algorithms.competitive.art module

class neupy.algorithms.competitive.art.ART1[source]

Adaptive Resonance Theory (ART1) Network for binary data clustering.

Parameters:

rho : float

Control reset action in training process. Value must be between 0 and 1, defaults to 0.5.

n_clusters : int

Number of clusters, defaults to 2. Min value is also 2.

step : float

Learning rate, defaults to 0.1.

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.

Notes

  • Weights are not random, so the result will be always reproduceble.

Examples

>>> import numpy as np
>>> from neupy import algorithms
>>>
>>> data = np.array([
...     [0, 1, 0],
...     [1, 0, 0],
...     [1, 1, 0],
... ])
>>>>
>>> artnet = algorithms.ART1(
...     step=2,
...     rho=0.7,
...     n_clusters=2,
...     verbose=False
... )
>>> artnet.predict(data)
array([ 0.,  1.,  1.])

Methods

train(input_data) ART trains until all clusters are found.
predict(input_data) Each prediction trains a new network. Basically it’s an alias to the train method.
fit(*args, **kwargs) Alias to the train method.
n_clusters = None[source]
options = {'verbose': Option(class_name='Verbose', value=VerboseProperty(name="verbose")), 'step': Option(class_name='BaseNetwork', value=NumberProperty(name="step")), '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")), 'rho': Option(class_name='ART1', value=ProperFractionProperty(name="rho")), 'n_clusters': Option(class_name='ART1', 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
rho = None[source]
train(input_data)[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.