pyFTS.partitioners package

Module contents

Module for pyFTS Universe of Discourse partitioners.

Submodules

pyFTS.partitioners.partitioner module

class pyFTS.partitioners.partitioner.Partitioner(**kwargs)[source]

Bases: object

Universe of Discourse partitioner. Split data on several fuzzy sets

build(data)[source]

Perform the partitioning of the Universe of Discourse

Parameters

data – training data

Returns

build_index()[source]
check_bounds(data)[source]

Check if the input data is outside the known Universe of Discourse and, if it is, round it to the closest fuzzy set.

Parameters

data – input data to be verified

Returns

the index of the closest fuzzy set when data is outside de universe of discourse or None if

the data is inside the UoD.

defuzzyfy(values, mode='both')[source]
extractor(x)[source]

Extract a single primitive type from an structured instance

fuzzyfy(data, **kwargs)[source]

Fuzzyfy the input data according to this partitioner fuzzy sets.

Parameters
  • data – input value to be fuzzyfied

  • alpha_cut – the minimal membership value to be considered on fuzzyfication (only for mode=’sets’)

  • method – the fuzzyfication method (fuzzy: all fuzzy memberships, maximum: only the maximum membership)

  • mode – the fuzzyfication mode (sets: return the fuzzy sets names, vector: return a vector with the membership

values for all fuzzy sets, both: return a list with tuples (fuzzy set, membership value) )

:returns a list with the fuzzyfied values, depending on the mode

get_name(counter)[source]

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

Parameters

counter – The number of the fuzzy set

Returns

String

kdtree

A spatial index to help in fuzzyfication

lower_margin

Specific lower exceeding margins for the known UoD. The default value is the self.margin parameter

lower_set()[source]

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

Returns

Fuzzy Set

margin

The upper and lower exceeding margins for the known UoD. The default value is .1

membership_function

Fuzzy membership function (pyFTS.common.Membership)

name

partitioner name

ordered_sets

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

partitions

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

plot(ax, rounding=0)[source]

Plot the partitioning using the Matplotlib axis ax

Parameters

ax – Matplotlib axis

plot_set(ax, s)[source]

Plot an isolate fuzzy set on Matplotlib axis

Parameters
  • ax – Matplotlib axis

  • s – Fuzzy Set

prefix

prefix of auto generated partition names

search(data, **kwargs)[source]

Perform a search for the nearest fuzzy sets of the point ‘data’. This function were designed to work with several overlapped fuzzy sets.

Parameters
  • data – the value to search for the nearest fuzzy sets

  • type – the return type: ‘index’ for the fuzzy set indexes or ‘name’ for fuzzy set names.

  • results – the number of nearest fuzzy sets to return

Returns

a list with the nearest fuzzy sets

setnames

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

transformation

data transformation to be applied on data

type

The type of fuzzy sets that are generated by this partitioner

upper_margin

Specific upper exceeding margins for the known UoD. The default value is the self.margin parameter

upper_set()[source]

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

Returns

Fuzzy Set

variable

In a multivariate context, the variable that contains this partitioner

pyFTS.partitioners.CMeans module

class pyFTS.partitioners.CMeans.CMeansPartitioner(**kwargs)[source]

Bases: pyFTS.partitioners.partitioner.Partitioner

build(data)[source]

Perform the partitioning of the Universe of Discourse

Parameters

data – training data

Returns

pyFTS.partitioners.CMeans.c_means(k, dados, tam)[source]
pyFTS.partitioners.CMeans.distance(x, y)[source]

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)[source]

Bases: pyFTS.partitioners.partitioner.Partitioner

Huarng Entropy Partitioner

build(data)[source]

Perform the partitioning of the Universe of Discourse

Parameters

data – training data

Returns

pyFTS.partitioners.Entropy.PMF(data, threshold)[source]
pyFTS.partitioners.Entropy.bestSplit(data, npart)[source]
pyFTS.partitioners.Entropy.entropy(data, threshold)[source]
pyFTS.partitioners.Entropy.informationGain(data, thres1, thres2)[source]
pyFTS.partitioners.Entropy.splitAbove(data, threshold)[source]
pyFTS.partitioners.Entropy.splitBelow(data, threshold)[source]

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)[source]

Bases: pyFTS.partitioners.partitioner.Partitioner

build(data)[source]

Perform the partitioning of the Universe of Discourse

Parameters

data – training data

Returns

pyFTS.partitioners.FCM.fuzzy_cmeans(k, data, size, m, deltadist=0.001)[source]
pyFTS.partitioners.FCM.fuzzy_distance(x, y)[source]
pyFTS.partitioners.FCM.membership(val, vals)[source]

pyFTS.partitioners.Grid module

Even Length Grid Partitioner

class pyFTS.partitioners.Grid.GridPartitioner(**kwargs)[source]

Bases: pyFTS.partitioners.partitioner.Partitioner

Even Length Grid Partitioner

build(data)[source]

Perform the partitioning of the Universe of Discourse

Parameters

data – training data

Returns

class pyFTS.partitioners.Grid.PreFixedGridPartitioner(**kwargs)[source]

Bases: pyFTS.partitioners.Grid.GridPartitioner

Prefixed UoD with Even Length Grid Partitioner

pyFTS.partitioners.Huarng module

pyFTS.partitioners.Singleton module

Even Length Grid Partitioner

class pyFTS.partitioners.Singleton.SingletonPartitioner(**kwargs)[source]

Bases: pyFTS.partitioners.partitioner.Partitioner

Singleton Partitioner

build(data)[source]

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)[source]

Bases: pyFTS.partitioners.partitioner.Partitioner

Simple Partitioner for manually informed fuzzy sets

append(name, mf, parameters, **kwargs)[source]

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)[source]

pyFTS.partitioners.SubClust module

Chiu, Stephen L. “Fuzzy model identification based on cluster estimation.” Journal of Intelligent & fuzzy systems 2.3 (1994): 267-278.

class pyFTS.partitioners.SubClust.SubClustPartitioner(**kwargs)[source]

Bases: pyFTS.partitioners.partitioner.Partitioner

Subtractive Clustering Partitioner

build(data)[source]

Perform the partitioning of the Universe of Discourse

Parameters

data – training data

Returns

pyFTS.partitioners.SubClust.imax(vec)[source]
pyFTS.partitioners.SubClust.subclust(data, ra, rb, eps_sup, eps_inf)[source]

pyFTS.partitioners.Util module

pyFTS.partitioners.parallel_util module