npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fuzzy-theo

v0.1.42

Published

Fuzzy set theory utility javascript library

Downloads

1

Readme

Javascript Fuzzy Set Theory library

NPM version Build Status Code Climate codecov Codacy Badge Dependency Status devDependency Status

Fuzzy-theo is a fuzzy-set theory utility javascript library

This library is written in Javascript ES6 and it is based on the readings of the book: Neuro-Fuzzy and Soft Computing: A Computational Approach to Learning and Machine Intelligence, by J.-S. R. Jang, C.-T. Sun, E. Mizutani (See the book)

Installation

Fuzzy-theo can be installed using

$ npm install --save fuzzy-theo

Usage

// load fuzzy-theo
import FuzzySet from 'fuzzy-theo';

// discrete map fuzzy-sets
const mapMembershipGrades = {
  'San Francisco': 0.9,
  'Los Angeles': 0.6,
  Boston: 0.8,
  Amsterdam: 100,
  Chennai: -100,
  London: 'cloudy',
};
const fsDiscrete = new FuzzySet({ func: (x) => mapMembershipGrades[x] });

// continuous fuzzy sets
const fsContinuous = new FuzzySet({ func: (x) => x });

// membership grade
fsDiscrete.membershipGrade('San Francisco'); // 0.9

// Fuzzy set properties
const fs = new FuzzySet({
  func: (x) => Math.abs(x),
  dimension: 1, // dimension of the function
  convex: false, // f(a*x1 + (1-a)*x2) >= min(f(x1), f(x2))
  normal: false, // at least one x where this.membershipGrade(x) == 1
  singleton: false, // only one x where f(x) == 1, all the others grades are 0,
  crossoverPoints: [], // points where func(x) = 0.5
  isSymmetricAroundC: () => false, // func(x + c) == func(x - c), for all x
  bandwidth: 0, // width Math.abs(x1 - x2), being x1 and x2 the two unique crossover points
  isOpenLeft: false, // lim fun(x) = 1, when x -> -Infinity
  isOpenRight: false, // lim fun(x) = 1, when x -> +Infinity
  isClosed: false, // lim fun(x) = 0, when x -> -Infinity OR x -> +Infinity
  setType: null, // continuous, discrete
  dataType: null, // numeric(quantitative), string(qualitative)
  // setInterval: [a,b] (closed), [a,b) (open-right), (a,b] (open-left), (a,b) (open)
  setInterval: null,
  set: null, // [a, c, g ...]
});

// Fuzzy set types
import { BellFS, GaussianFS, LeftRightFS, SigmoidalFS, TrapezoidalFS, TriangularFS } from 'fuzzy-theo';

const fs = new BellFS(50, 4, 20); // Bell shaped fuzzy-set
const fs = new GaussianFS(50, 20); // Gaussian shaped fuzzy-set
const fs = new LeftRightFS(65, 60, 10); // LR fuzzy-set
const fs = new SigmoidalFS(50, 4); // Sigmoid shaped fuzzy-set
const fs = new TrapezoidalFS(20, 40, 60, 80); // Trapezoid shaped fuzzy-set
const fs = new TriangularFS(20, 60, 80); // Triangle shaped fuzzy-set

// TODO: explain fuzzy set operations

Test

To execute tests for the library, install the project dependencies once:

$ npm install
$ npm install -g gulp

Then, the tests can be executed with:

$ gulp test

To test code coverage of the tests:

$ npm test-coverage

To see the coverage results, open the generated report in your browser:

$ open ./coverage/lcov-report/index.html

Roadmap

1.0.0

  • Add bignumber.js
  • Bind operations to FuzzySet
  • Implement more FS types
  • Create a decent documentation
  • Create gh-pages with examples