# pyFTS.partitioners package — pyFTS 1.4 documentation

# pyFTS.partitioners package

## Module contents

Module for pyFTS Universe of Discourse partitioners.

## Submodules

## pyFTS.partitioners.partitioner module

class `pyFTS.partitioners.partitioner.``Partitioner`(**kwargs)

  Bases: `object`

  Universe of Discourse partitioner. Split data on several fuzzy sets

  `build`(data)

    Perform the partitioning of the Universe of Discourse

    Parameters: | data – training data
    Returns: |

  `extractor` = None

    Anonymous function used to extract a single primitive type from an object instance

  `fuzzyfy`(data, **kwargs)
  `get_name`(counter)

    Find the name of the fuzzy set given its counter id.

    Parameters: | counter – The number of the fuzzy set
    Returns: | String

  `lower_set`()

    Return the fuzzy set on lower bound of the universe of discourse.

    Returns: | Fuzzy Set

  `membership_function` = None

    Fuzzy membership function (pyFTS.common.Membership)

  `name` = None

    partitioner name

  `ordered_sets` = None

    A ordered list of the fuzzy sets names, sorted by their middle point

  `partitions` = None

    The number of universe of discourse partitions, i.e., the number of fuzzy sets that will be created

  `plot`(ax, rounding=0)

    Plot the partitioning using the Matplotlib axis ax

    Parameters: | ax – Matplotlib axis

  `plot_set`(ax, s)

    Plot an isolate fuzzy set on Matplotlib axis

    Parameters:

    - ax – Matplotlib axis
    - s – Fuzzy Set

  `prefix` = None

    prefix of auto generated partition names

  `setnames` = None

    list of partitions names. If None is given the partitions will be auto named with prefix

  `transformation` = None

    data transformation to be applied on data

  `type` = None

    The type of fuzzy sets that are generated by this partitioner

  `upper_set`()

    Return the fuzzy set on upper bound of the universe of discourse.

    Returns: | Fuzzy Set

  `variable` = None

    In a multivariate context, the variable that contains this partitioner

## pyFTS.partitioners.CMeans module

class `pyFTS.partitioners.CMeans.``CMeansPartitioner`(**kwargs)

  Bases: `pyFTS.partitioners.partitioner.Partitioner`

  `build`(data)

    Perform the partitioning of the Universe of Discourse

    Parameters: | data – training data
    Returns: |

`pyFTS.partitioners.CMeans.``c_means`(k, dados, tam)

`pyFTS.partitioners.CMeans.``distance`(x, y)

## pyFTS.partitioners.Entropy module

C. H. Cheng, R. J. Chang, and C. A. Yeh, “Entropy-based and trapezoidal fuzzification-based fuzzy time series approach for forecasting IT project cost,” Technol. Forecast. Social Change, vol. 73, no. 5, pp. 524–542, Jun. 2006.

class `pyFTS.partitioners.Entropy.``EntropyPartitioner`(**kwargs)

  Bases: `pyFTS.partitioners.partitioner.Partitioner`

  Huarng Entropy Partitioner

  `build`(data)

    Perform the partitioning of the Universe of Discourse

    Parameters: | data – training data
    Returns: |

`pyFTS.partitioners.Entropy.``PMF`(data, threshold)

`pyFTS.partitioners.Entropy.``bestSplit`(data, npart)

`pyFTS.partitioners.Entropy.``entropy`(data, threshold)

`pyFTS.partitioners.Entropy.``informationGain`(data, thres1, thres2)

`pyFTS.partitioners.Entropy.``splitAbove`(data, threshold)

`pyFTS.partitioners.Entropy.``splitBelow`(data, threshold)

## pyFTS.partitioners.FCM module

S. T. Li, Y. C. Cheng, and S. Y. Lin, “A FCM-based deterministic forecasting model for fuzzy time series,” Comput. Math. Appl., vol. 56, no. 12, pp. 3052–3063, Dec. 2008. DOI: 10.1016/j.camwa.2008.07.033.

class `pyFTS.partitioners.FCM.``FCMPartitioner`(**kwargs)

  Bases: `pyFTS.partitioners.partitioner.Partitioner`

  `build`(data)

    Perform the partitioning of the Universe of Discourse

    Parameters: | data – training data
    Returns: |

`pyFTS.partitioners.FCM.``fuzzy_cmeans`(k, dados, tam, m, deltadist=0.001)

`pyFTS.partitioners.FCM.``fuzzy_distance`(x, y)

`pyFTS.partitioners.FCM.``membership`(val, vals)

## pyFTS.partitioners.Grid module

Even Length Grid Partitioner

class `pyFTS.partitioners.Grid.``GridPartitioner`(**kwargs)

  Bases: `pyFTS.partitioners.partitioner.Partitioner`

  Even Length Grid Partitioner

  `build`(data)

    Perform the partitioning of the Universe of Discourse

    Parameters: | data – training data
    Returns: |

## pyFTS.partitioners.Huarng module

K. H. Huarng, “Effective lengths of intervals to improve forecasting in fuzzy time series,” Fuzzy Sets Syst., vol. 123, no. 3, pp. 387–394, Nov. 2001.

class `pyFTS.partitioners.Huarng.``HuarngPartitioner`(**kwargs)

  Bases: `pyFTS.partitioners.partitioner.Partitioner`

  Huarng Empirical Partitioner

  `build`(data)

    Perform the partitioning of the Universe of Discourse

    Parameters: | data – training data
    Returns: |

## pyFTS.partitioners.Singleton module

Even Length Grid Partitioner

class `pyFTS.partitioners.Singleton.``SingletonPartitioner`(**kwargs)

  Bases: `pyFTS.partitioners.partitioner.Partitioner`

  Singleton Partitioner

  `build`(data)

    Perform the partitioning of the Universe of Discourse

    Parameters: | data – training data
    Returns: |

## pyFTS.partitioners.Simple module

Simple Partitioner for manually informed fuzzy sets

class `pyFTS.partitioners.Simple.``SimplePartitioner`(**kwargs)

  Bases: `pyFTS.partitioners.partitioner.Partitioner`

  Simple Partitioner for manually informed fuzzy sets

  `append`(name, mf, parameters, **kwargs)

    Append a new partition (fuzzy set) to the partitioner

    Parameters:

    - name – Fuzzy set name
    - mf – One of the pyFTS.common.Membership functions
    - parameters – A list with the parameters for the membership function
    - kwargs – Optional arguments for the fuzzy set

  `append_complex`(fs)

## pyFTS.partitioners.Util module

Facility methods for pyFTS partitioners module

`pyFTS.partitioners.Util.``explore_partitioners`(data, npart, methods=None, mf=None, transformation=None, size=[12, 10], save=False, file=None)

  Create partitioners for the mf membership functions and npart partitions and show the partitioning images. :data: Time series data :npart: Maximum number of partitions of the universe of discourse :methods: A list with the partitioning methods to be used :mf: A list with the membership functions to be used :transformation: a transformation to be used in partitioner :size: list, the size of the output image [width, height] :save: boolean, if the image will be saved on disk :file: string, the file path to save the image :return: the list of the built partitioners

`pyFTS.partitioners.Util.``plot_partitioners`(data, objs, tam=[12, 10], save=False, file=None, axis=None)

`pyFTS.partitioners.Util.``plot_sets`(data, sets, titles, size=[12, 10], save=False, file=None, axis=None)

## pyFTS.partitioners.parallel_util module

`pyFTS.partitioners.parallel_util.``explore_partitioners`(data, npart, methods=None, mf=None, tam=[12, 10], save=False, file=None)