Skip to main content

Keras model of a Self-Organizing Fuzzy Network

Project description

sofenn: Self-Organizing Fuzzy Neural Network

Welcome to sofenn (sounds like soften)!

This package is a Keras/TensorFlow implementation of a Self-Organizing Fuzzy Neural Network. The sofenn framework consists of two models:
(1) Fuzzy Network - Underlying fuzzy network whose parameters are optimized during training
(2) Self-Organizer - Metamodel that optimizes the architecture of the Fuzzy Network

FuzzyNetwork

Underlying neural network model that contains parameters to be optimized during training

FuzzySelfOrganizer

Metamodel to optimize the architecture of underlying fuzzy network

Installation

You can install the package using pip:

pip install sofenn

Usage

Demo notebooks available on Github.

Importing the model and self-organizer:

from sofenn import FuzzyNetwork, FuzzySelfOrganizer

# initialize model separate, and attach to self-organizer
model = FuzzyNetwork(input_shape, **_init_params)
sofnn = FuzzySelfOrganizer(model=model)
sofnn.self_organize(x, y)

# initialize sofnn directly
sofnn = FuzzySelfOrganizer(input_shape, **_init_params)
sofnn.self_organize(x, y)

Model Description

The model is implemented per the description in:

'An on-line algorithm for creating self-organizing fuzzy neural networks'
Leng, Prasad, McGinnity (2004)

alt text

Fuzzy Neural Network Architecture

Credit: Leng, Prasad, McGinnity (2004)

Layers

Inputs Layer (0)

Input layer of network

  • input :
    • shape: (*, features)

Fuzzy Layer (1)

Radial (Ellipsoidal) Basis Function Layer

  • Each neuron represents "if-part" or premise of a fuzzy rule

  • Individual Membership Functions (MF) are applied to each feature for each neuron

  • Output is product of Membership Functions

  • Each MF is a Gaussian function:

    • for i features and j neurons:

    • = ith MF of jth neuron

    • = center of ith MF of jth neuron

    • = width of ith MF of jth neuron

  • output for Fuzzy Layer is:

  • input :

    • shape: (*, features)
  • output :

    • shape: (*, neurons)

alt text

Information flow of r features within neuron j

Credit: Leng, Prasad, McGinnity (2004)

Normalize Layer (2)

Normalization Layer

  • Output of each neuron is normalized by total output from the previous layer

  • Number of outputs equal to the previous layer (# of neurons)

  • Output for Normalize Layer is:

    = output of Fuzzy Layer neuron j

  • input :

    • shape : (*, neurons)
  • output :

    • shape : (*, neurons)

Weighted Layer (3)

Weighting of ith MF of each feature

  • Yields the "consequence" of the jth fuzzy rule of the fuzzy model

  • Each neuron has two inputs:

    • = output of previous related neuron
    • = weighted bias
  • with:

    = number of original input features

    = output of jth neuron from normalize layer

  • output for weighted layer is:

  • inputs :

    • shape: [(*, 1+features), (*, neurons)]
  • output :

    • shape: (*, neurons)

Output Layer (4)

Final Output

  • Unweighted sum of each output of the previous layer ()

  • Provide activation function to layer

  • Function choice determines output shape (e.g., linear vs. softmax)

  • Output for fuzzy layer is:

    for u neurons

  • Provide activation function to layer (default: linear)

  • Activation function determines output dimensions

Examples

Regression output:

  • input :
    • shape: (*, neurons)
  • output :
    • shape: (*,)

Softmax classification output:

  • input :
    • shape: (*, )
  • output :
    • shape: (*, classes)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sofenn-0.1.6.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sofenn-0.1.6-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file sofenn-0.1.6.tar.gz.

File metadata

  • Download URL: sofenn-0.1.6.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.23

File hashes

Hashes for sofenn-0.1.6.tar.gz
Algorithm Hash digest
SHA256 867d2cc83b293a63e75ee84ed2d9c18ce65306f36f2b05b7a6eced762948e76f
MD5 c1f6aa5da01c6a90e7e238bf194e1eb6
BLAKE2b-256 e48c4566e1e3b75f46c26ca9a145524eced1c04268d31df1f715261991d43286

See more details on using hashes here.

File details

Details for the file sofenn-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: sofenn-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.23

File hashes

Hashes for sofenn-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 8b06df718e4072f1d7707eef243e189d58cae84b753a7bb39a5fd6da86ca2bb4
MD5 f8c1647e94ea036a5e79ae0948a7a7a9
BLAKE2b-256 1c50c36d6f5c440d2f88c80325ea15273dc58262c1c59a7246062255187a1a2b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page