Main Content

compet

(To be removed) Competitive transfer function

compet will be removed in a future release. For more information, see Transition Legacy Neural Network Code to dlnetwork Workflows.

For advice on updating your code, see Version History.

Graph and Symbol

The competitive transfer function applied to an input vector. The function accepts an input vector and returns outputs of 0 for all inputs except for the winner, the element associated with the most positive element of the input.

Syntax

A = compet(N,FP)
info = compet('code')

Description

compet is a neural transfer function. Transfer functions calculate a layer’s output from its net input.

A = compet(N,FP) takes N and optional function parameters,

N

S-by-Q matrix of net input (column) vectors

FP

Struct of function parameters (ignored)

and returns the S-by-Q matrix A with a 1 in each column where the same column of N has its maximum value, and 0 elsewhere.

info = compet('code') returns information according to the code string specified:

compet('name') returns the name of this function.

compet('output',FP) returns the [min max] output range.

compet('active',FP) returns the [min max] active input range.

compet('fullderiv') returns 1 or 0, depending on whether dA_dN is S-by-S-by-Q or S-by-Q.

compet('fpnames') returns the names of the function parameters.

compet('fpdefaults') returns the default function parameters.

Examples

Here you define a net input vector N, calculate the output, and plot both with bar graphs.

n = [0; 1; -0.5; 0.5];
a = compet(n);
subplot(2,1,1), bar(n), ylabel('n')
subplot(2,1,2), bar(a), ylabel('a')

Assign this transfer function to layer i of a network.

net.layers{i}.transferFcn = 'compet';

Version History

Introduced before R2006a

collapse all