Skip to main content

For handling and fitting fuzzy measures

Project description

Pyfmtools

This package handles and fits fuzzy measures Functions are:
double py_min_subset(double* x, int n, int_64 S);
double py_max_subset(double* x, int n, int_64 S);
void py_ConvertCard2Bit(double* dest, double* src, struct fm_env* env);
double py_min_subsetC(double* x, int n, int_64 S, struct fm_env* env);
double py_max_subsetNegC(double* x, int n, int_64 S, struct fm_env* env);
int py_SizeArraykinteractive(int n, int k, struct fm_env* env);
int py_IsSubsetC(int i, int j, struct fm_env* env);
int py_IsElementC(int i, int j, struct fm_env* env);
void py_ExpandKinteractive2Bit(double* dest, double* src, struct fm_env* env, int kint, int arraysize);
void py_ExpandKinteractive2Bit_m(double* dest, double* src, struct fm_env* env, int kint, int arraysize, double* VVC);
void py_fm_init(int n, struct fm_env* env);
void py_fm_free(struct fm_env* env);
void py_Shapley(double* v, double* x, struct fm_env* env);
void py_Banzhaf(double* v, double* B, struct fm_env* env);
void py_ShapleyMob(double* Mob, double* x, struct fm_env* env);
void py_BanzhafMob(double* Mob, double* B, struct fm_env* env);
double py_Choquet(double* x, double* v, struct fm_env* env);
double py_ChoquetKinter(double* x, double* v, int kint, struct fm_env* env);
double py_ChoquetMob(double* x, double* Mob, struct fm_env* env);
void py_ConstructLambdaMeasure(double* singletons, double* lambda, double* v, struct fm_env* env);
void py_ConstructLambdaMeasureMob(double* singletons, double* lambda, double* Mob, struct fm_env* env);
void py_dualm(double* v, double* w, struct fm_env* env);
void py_dualmMob(double* v, double* w, struct fm_env* env);
double py_Entropy(double* v, struct fm_env* env);
void py_FuzzyMeasureFit(int datanum, int additive, struct fm_env* env, double* v, double* dataset);
void py_FuzzyMeasureFitMob(int datanum, int additive, struct fm_env* env, double* v, double* dataset);
void py_FuzzyMeasureFitKtolerant(int datanum, int additive, struct fm_env* env, double* v, double* dataset);
void py_FuzzyMeasureFitLPKmaxitive(int datanum, int additive, struct fm_env* env, double* v, double* dataset);
void py_FuzzyMeasureFitLPKinteractive(int datanum, int additive, struct fm_env* env, double* v, double* dataset, double* K);
void py_FuzzyMeasureFitLPKinteractiveMaxChains(int datanum, int additive, struct fm_env* env, double* v, double* dataset, double* K);
void py_FuzzyMeasureFitLPKinteractiveAutoK(int datanum, int additive, struct fm_env* env, double* v, double* dataset, double* K, int* maxiters);
void py_FuzzyMeasureFitLPKinteractiveMarginal(int datanum, int additive, struct fm_env* env, double* v, double* dataset, double* K, int submod);
void py_FuzzyMeasureFitLPKinteractiveMarginalMaxChain(int datanum, int additive, struct fm_env* env, double* v, double* dataset, double* K, int* maxiters, int submod);
void py_FuzzyMeasureFitLP(int datanum, int additive, struct fm_env* env, double* v, double* dataset, int * options, double* indexlow, double* indexhihg, int* option1, double* orness);
void py_FuzzyMeasureFitLPMob(int datanum, int additive, struct fm_env* env, double* v, double* dataset, int * options, double* indexlow, double* indexhihg, int* option1, double* orness);
void py_fittingOWA(int datanum, struct fm_env* env, double* v, double* dataset);
void py_fittingWAM(int datanum, struct fm_env* env, double* v, double* dataset);
void py_Interaction(double* Mob, double* v, struct fm_env* env);
void py_InteractionB(double* Mob, double* v, struct fm_env* env);
void py_InteractionMob(double* Mob, double* v, struct fm_env* env);
void py_InteractionBMob(double* Mob, double* v, struct fm_env* env);
void py_BipartitionShapleyIndex(double* v, double* w, struct fm_env* env);
void py_BipartitionBanzhafIndex(double* v, double* w, struct fm_env* env);
void py_BNonadditivityIndexMob(double* Mob, double* w, struct fm_env* env);
void py_NonadditivityIndex(double* v, double* w, struct fm_env* env);
void py_NonmodularityIndex(double* v, double* w, struct fm_env* env);
void py_NonmodularityIndexMob(double* Mob, double* w, struct fm_env* env);
void py_NonmodularityIndexKinteractive(double* v, double* w, int kint, struct fm_env* env);
void py_NonmodularityIndexMobkadditive(double* Mob, double* w, int k, struct fm_env* env);
void py_ShowCoalitions(int* coalition, struct fm_env* env);
void py_ShowCoalitionsCard(int* coalition, struct fm_env* env);
int py_IsMeasureAdditive(double* v, struct fm_env* env);
int py_IsMeasureBalanced(double* v, struct fm_env* env);
int py_IsMeasureSelfdual(double* v, struct fm_env* env);
int py_IsMeasureSubadditive(double* v, struct fm_env* env);
int py_IsMeasureSubmodular(double* v, struct fm_env* env);
int py_IsMeasureSuperadditive(double* v, struct fm_env* env);
int py_IsMeasureSupermodular(double* v, struct fm_env* env);
int py_IsMeasureSymmetric(double* v, struct fm_env* env);
int py_IsMeasureKMaxitive(double* v, struct fm_env* env);
int py_IsMeasureAdditiveMob(double* Mob, struct fm_env* env);
int py_IsMeasureBalancedMob(double* Mob, struct fm_env* env);
int py_IsMeasureSelfdualMob(double* Mob, struct fm_env* env);
int py_IsMeasureSubadditiveMob(double* Mob, struct fm_env* env);
int py_IsMeasureSubmodularMob(double* Mob, struct fm_env* env);
int py_IsMeasureSuperadditiveMob(double* Mob, struct fm_env* env);
int py_IsMeasureSupermodularMob(double* Mob, struct fm_env* env);
int py_IsMeasureSymmetricMob(double* Mob, struct fm_env* env);
int py_IsMeasureKMaxitiveMob(double* Mob, struct fm_env* env);
void py_Mobius(double* v, double* MobVal, struct fm_env* env);
double py_Orness(double* Mob, struct fm_env* env);
double py_OWA(double* x, double* v, struct fm_env* env);
double py_Sugeno(double* x, double* v, struct fm_env* env);
double py_WAM(double* x, double* v, struct fm_env* env);
void py_Zeta(double* Mob, double* v, struct fm_env* env);
void py_dualMobKadd(int m, int length, int k, double* src, double* dest, struct fm_env* env);
void py_Shapley2addMob(double* v, double* x, int n);
void py_Banzhaf2addMob(double* v, double* x, int n);
double py_Choquet2addMob(doublex, double Mob, int n);
int py_fm_arraysize(int n, int kint, struct fm_env* env);
int py_generate_fm_tsort(int num, int n, int kint, int markov, int option, double K, double * vv, struct fm_env* env);
int py_generate_fmconvex_tsort(int num, int n, int kint, int markov, int option, double K, double * vv, struct fm_env* env);
int py_generate_fm_minplus(int num, int n, int kint, int markov, int option, double K, double * vv, struct fm_env* env);
int py_generate_fm_2additive_convex(int num, int n, double * vv);
int py_generate_fm_2additive_concave(int num, int n, double * vv);
int py_generate_fm_2additive_convex_withsomeindependent(int num, int n, double * vv);
void py_export_maximal_chains(int n, double* v, double* mc, struct fm_env* env);
void py_prepare_fm_sparse(int n, int tupsize, int* tuples, struct fm_env_sparse* env);
int py_tuple_cardinality_sparse(int i, struct fm_env_sparse* env);
int py_get_num_tuples(struct fm_env_sparse* env);
int py_get_sizearray_tuples(struct fm_env_sparse* env);
int py_is_inset_sparse(int A, int card, int i, struct fm_env_sparse* env);
int py_is_subset_sparse(int A, int cardA, int B, int cardB, struct fm_env_sparse* env);
double py_min_subset_sparse(double* x, int n, int S, int cardS, struct fm_env_sparse* env);
double py_max_subset_sparse(double* x, int n, int S, int cardS, struct fm_env_sparse* env);
double py_ChoquetMob_sparse(double* x, int n, struct fm_env_sparse* env);
void py_ShapleyMob_sparse(double* v, int n, struct fm_env_sparse* env);
void py_BanzhafMob_sparse(double* v, int n, struct fm_env_sparse* env);
void py_populate_fm_2add_sparse(double* singletons, int numpairs, double* pairs, int* indicesp1, int* indicesp2, struct fm_env_sparse* env);
void py_add_pair_sparse(int i, int j, double v, struct fm_env_sparse* env);
void py_add_tuple_sparse(int tupsize, int* tuple, double v, struct fm_env_sparse* env);
void py_populate_fm_2add_sparse_from2add(int n, double * v, struct fm_env_sparse* env);
void py_expand_2add_full(double* v, struct fm_env_sparse* env);
void py_expand_sparse_full(double* v, struct fm_env_sparse* env);
void py_sparse_get_singletons(int n, double* v, struct fm_env_sparse* env);
int py_sparse_get_pairs(int* pairs, double* v, struct fm_env_sparse* env);
int py_sparse_get_tuples(int* tuples, double* v, struct fm_env_sparse* env);
int py_generate_fm_2additive_convex_sparse(int n, struct fm_env_sparse* env);
int py_generate_fm_kadditive_convex_sparse(int n, int k, int nonzero, struct fm_env_sparse* env);
void py_Nonmodularityindex_sparse(double* w, int n, struct fm_env_sparse* env);

Documentation

User Manual

Installation

To install type:

$ pip install pyfmtools

Usage of the library

from _pyfmtools import flib, lib

Follow these steps in your Python code to use the library:

  • Initialize resources
  • Use library function(s)
  • Free resources

Example how to initialize resources

r=3
n=3
env=ffi.new( "struct fm_env *")
fm.py_fm_init( n, env)

Example how to free resources

fm.py_fm_free( env)

Usage of library functions

To implement a function follow these steps:

  1. Check size of input arrays. Example:
  2. Check types of input arrays. Example:
  3. Use CFFI type conversion for each input array or pointer. Example:
  4. Call C or C++ function. Example:

Parameters

Input parameters:

See function list

Output parameters:

See function list

Test

To unit test type:

$ test/test.py

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

pyfmtools-0.34.tar.gz (1.2 MB view hashes)

Uploaded Source

Built Distribution

pyfmtools-0.34-cp39-cp39-macosx_10_9_x86_64.whl (440.7 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

Supported by

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