@thi.ng/fuzzy 2.0.0 → 2.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +48 -0
- package/README.md +4 -3
- package/defuzz.d.ts +2 -2
- package/defuzz.js +3 -3
- package/index.d.ts +9 -9
- package/index.js +9 -9
- package/package.json +8 -5
- package/rules.d.ts +1 -1
- package/rules.js +1 -1
- package/shapes.d.ts +2 -2
- package/shapes.js +1 -1
- package/strategies/bisector.d.ts +1 -1
- package/strategies/bisector.js +1 -1
- package/strategies/centroid.d.ts +1 -1
- package/strategies/centroid.js +1 -1
- package/strategies/maxima.d.ts +1 -1
- package/strategies/maxima.js +1 -1
- package/strategies/opts.d.ts +1 -1
- package/var.d.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,54 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [2.0.6](https://github.com/thi-ng/umbrella/compare/@thi.ng/fuzzy@2.0.5...@thi.ng/fuzzy@2.0.6) (2021-10-28)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @thi.ng/fuzzy
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [2.0.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/fuzzy@2.0.4...@thi.ng/fuzzy@2.0.5) (2021-10-28)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @thi.ng/fuzzy
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [2.0.4](https://github.com/thi-ng/umbrella/compare/@thi.ng/fuzzy@2.0.3...@thi.ng/fuzzy@2.0.4) (2021-10-25)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @thi.ng/fuzzy
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## [2.0.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/fuzzy@2.0.2...@thi.ng/fuzzy@2.0.3) (2021-10-15)
|
|
31
|
+
|
|
32
|
+
**Note:** Version bump only for package @thi.ng/fuzzy
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## [2.0.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/fuzzy@2.0.1...@thi.ng/fuzzy@2.0.2) (2021-10-15)
|
|
39
|
+
|
|
40
|
+
**Note:** Version bump only for package @thi.ng/fuzzy
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## [2.0.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/fuzzy@2.0.0...@thi.ng/fuzzy@2.0.1) (2021-10-13)
|
|
47
|
+
|
|
48
|
+
**Note:** Version bump only for package @thi.ng/fuzzy
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
6
54
|
# [2.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/fuzzy@1.0.4...@thi.ng/fuzzy@2.0.0) (2021-10-12)
|
|
7
55
|
|
|
8
56
|
|
package/README.md
CHANGED
|
@@ -80,10 +80,11 @@ ES module import:
|
|
|
80
80
|
|
|
81
81
|
[Skypack documentation](https://docs.skypack.dev/)
|
|
82
82
|
|
|
83
|
-
For
|
|
83
|
+
For Node.js REPL:
|
|
84
84
|
|
|
85
85
|
```text
|
|
86
|
-
|
|
86
|
+
# with flag only for < v16
|
|
87
|
+
node --experimental-repl-await
|
|
87
88
|
|
|
88
89
|
> const fuzzy = await import("@thi.ng/fuzzy");
|
|
89
90
|
```
|
|
@@ -247,7 +248,7 @@ package, we can also visualize the final, transformed fuzzy sets used to compute
|
|
|
247
248
|
crisp results and highlight the position of the crisp result value.
|
|
248
249
|
|
|
249
250
|
Here is the ASCII art output for the
|
|
250
|
-
[`centroidStrategy`](https://
|
|
251
|
+
[`centroidStrategy`](https://docs.thi.ng/umbrella/fuzzy/modules.html#centroidStrategy)
|
|
251
252
|
and using `tnormMin` (the default) to transform each rule's output set(s):
|
|
252
253
|
|
|
253
254
|
```ts
|
package/defuzz.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LVarSet, Rule } from "./api";
|
|
1
|
+
import type { LVarSet, Rule } from "./api.js";
|
|
2
2
|
/**
|
|
3
3
|
* Takes an object of input {@link variable}s, an object of output variable,
|
|
4
4
|
* rule array and an object of input values. Evaluates relevant terms of input
|
|
@@ -25,5 +25,5 @@ import type { LVarSet, Rule } from "./api";
|
|
|
25
25
|
* @param imply
|
|
26
26
|
* @param combine
|
|
27
27
|
*/
|
|
28
|
-
export declare const defuzz: <I extends LVarSet<string>, O extends LVarSet<string>>(ins: I, outs: O, rules: Rule<I, O>[], vals: Partial<Record<keyof I, number>>, strategy?: import("./api").DefuzzStrategy, imply?: import("@thi.ng/api").FnN2, combine?: import("@thi.ng/api").FnN2) => Partial<Record<keyof O, number>>;
|
|
28
|
+
export declare const defuzz: <I extends LVarSet<string>, O extends LVarSet<string>>(ins: I, outs: O, rules: Rule<I, O>[], vals: Partial<Record<keyof I, number>>, strategy?: import("./api.js").DefuzzStrategy, imply?: import("@thi.ng/api").FnN2, combine?: import("@thi.ng/api").FnN2) => Partial<Record<keyof O, number>>;
|
|
29
29
|
//# sourceMappingURL=defuzz.d.ts.map
|
package/defuzz.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { constant, intersect, union, weighted } from "./shapes";
|
|
2
|
-
import { centroidStrategy } from "./strategies/centroid";
|
|
3
|
-
import { snormMax, tnormMin } from "./tnorms";
|
|
1
|
+
import { constant, intersect, union, weighted } from "./shapes.js";
|
|
2
|
+
import { centroidStrategy } from "./strategies/centroid.js";
|
|
3
|
+
import { snormMax, tnormMin } from "./tnorms.js";
|
|
4
4
|
/**
|
|
5
5
|
* Takes an object of input {@link variable}s, an object of output variable,
|
|
6
6
|
* rule array and an object of input values. Evaluates relevant terms of input
|
package/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export * from "./api";
|
|
2
|
-
export * from "./defuzz";
|
|
3
|
-
export * from "./rules";
|
|
4
|
-
export * from "./shapes";
|
|
5
|
-
export * from "./tnorms";
|
|
6
|
-
export * from "./var";
|
|
7
|
-
export * from "./strategies/bisector";
|
|
8
|
-
export * from "./strategies/centroid";
|
|
9
|
-
export * from "./strategies/maxima";
|
|
1
|
+
export * from "./api.js";
|
|
2
|
+
export * from "./defuzz.js";
|
|
3
|
+
export * from "./rules.js";
|
|
4
|
+
export * from "./shapes.js";
|
|
5
|
+
export * from "./tnorms.js";
|
|
6
|
+
export * from "./var.js";
|
|
7
|
+
export * from "./strategies/bisector.js";
|
|
8
|
+
export * from "./strategies/centroid.js";
|
|
9
|
+
export * from "./strategies/maxima.js";
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
package/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export * from "./api";
|
|
2
|
-
export * from "./defuzz";
|
|
3
|
-
export * from "./rules";
|
|
4
|
-
export * from "./shapes";
|
|
5
|
-
export * from "./tnorms";
|
|
6
|
-
export * from "./var";
|
|
7
|
-
export * from "./strategies/bisector";
|
|
8
|
-
export * from "./strategies/centroid";
|
|
9
|
-
export * from "./strategies/maxima";
|
|
1
|
+
export * from "./api.js";
|
|
2
|
+
export * from "./defuzz.js";
|
|
3
|
+
export * from "./rules.js";
|
|
4
|
+
export * from "./shapes.js";
|
|
5
|
+
export * from "./tnorms.js";
|
|
6
|
+
export * from "./var.js";
|
|
7
|
+
export * from "./strategies/bisector.js";
|
|
8
|
+
export * from "./strategies/centroid.js";
|
|
9
|
+
export * from "./strategies/maxima.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/fuzzy",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"description": "Fuzzy logic operators & configurable rule inferencing engine",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"test": "testament test"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@thi.ng/api": "^8.0.
|
|
38
|
-
"@thi.ng/math": "^5.0.
|
|
37
|
+
"@thi.ng/api": "^8.0.6",
|
|
38
|
+
"@thi.ng/math": "^5.0.6"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@thi.ng/testament": "^0.1.
|
|
41
|
+
"@thi.ng/testament": "^0.1.6"
|
|
42
42
|
},
|
|
43
43
|
"keywords": [
|
|
44
44
|
"agent",
|
|
@@ -54,6 +54,9 @@
|
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|
|
56
56
|
},
|
|
57
|
+
"engines": {
|
|
58
|
+
"node": ">=12.7"
|
|
59
|
+
},
|
|
57
60
|
"files": [
|
|
58
61
|
"*.js",
|
|
59
62
|
"*.d.ts",
|
|
@@ -97,5 +100,5 @@
|
|
|
97
100
|
"thi.ng": {
|
|
98
101
|
"year": 2020
|
|
99
102
|
},
|
|
100
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "c17a556ad25f6882dfa8f806a1d9e8ed7ac7cd71"
|
|
101
104
|
}
|
package/rules.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { FnN2 } from "@thi.ng/api";
|
|
2
|
-
import type { LVarKeySet, LVarSet, Rule } from "./api";
|
|
2
|
+
import type { LVarKeySet, LVarSet, Rule } from "./api.js";
|
|
3
3
|
/**
|
|
4
4
|
* Defines and returns a new rule object. Takes a T-norm (or S-norm) `op`, an
|
|
5
5
|
* object of input conditions, an object of results and optional rule `weight`.
|
package/rules.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { snormMax, tnormMin, tnormProduct } from "./tnorms";
|
|
1
|
+
import { snormMax, tnormMin, tnormProduct } from "./tnorms.js";
|
|
2
2
|
/**
|
|
3
3
|
* Defines and returns a new rule object. Takes a T-norm (or S-norm) `op`, an
|
|
4
4
|
* object of input conditions, an object of results and optional rule `weight`.
|
package/shapes.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { FnN2, FnU, FnU2, FnU3, FnU4 } from "@thi.ng/api";
|
|
2
|
-
import type { FuzzyFn } from "./api";
|
|
2
|
+
import type { FuzzyFn } from "./api.js";
|
|
3
3
|
/**
|
|
4
4
|
* HOF {@link FuzzyFn} always yielding given `x` (should be in [0,1]
|
|
5
5
|
* interval).
|
|
@@ -121,7 +121,7 @@ export declare const invAlphaCut: (fn: FuzzyFn, alpha?: number) => FuzzyFn;
|
|
|
121
121
|
* References:
|
|
122
122
|
* - https://www.desmos.com/calculator/pnq6kqzfb5 (interactive graph)
|
|
123
123
|
* - https://en.wikipedia.org/wiki/T-norm
|
|
124
|
-
* - https://github.com/thi-ng/umbrella/blob/develop/packages/
|
|
124
|
+
* - https://github.com/thi-ng/umbrella/blob/develop/packages/fuzzy/src/tnorms.ts
|
|
125
125
|
*
|
|
126
126
|
* @example
|
|
127
127
|
* ```ts
|
package/shapes.js
CHANGED
|
@@ -135,7 +135,7 @@ export const invAlphaCut = (fn, alpha = 0.5) => (x) => {
|
|
|
135
135
|
* References:
|
|
136
136
|
* - https://www.desmos.com/calculator/pnq6kqzfb5 (interactive graph)
|
|
137
137
|
* - https://en.wikipedia.org/wiki/T-norm
|
|
138
|
-
* - https://github.com/thi-ng/umbrella/blob/develop/packages/
|
|
138
|
+
* - https://github.com/thi-ng/umbrella/blob/develop/packages/fuzzy/src/tnorms.ts
|
|
139
139
|
*
|
|
140
140
|
* @example
|
|
141
141
|
* ```ts
|
package/strategies/bisector.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DefuzzStrategy, DefuzzStrategyOpts } from "../api";
|
|
1
|
+
import type { DefuzzStrategy, DefuzzStrategyOpts } from "../api.js";
|
|
2
2
|
/**
|
|
3
3
|
* Higher-order function: Bisector-of-Area defuzzification strategy. Returns
|
|
4
4
|
* strategy which computes the integral of a given fuzzy set in the defined
|
package/strategies/bisector.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { fit } from "@thi.ng/math/fit";
|
|
2
|
-
import { defaultOpts } from "./opts";
|
|
2
|
+
import { defaultOpts } from "./opts.js";
|
|
3
3
|
/**
|
|
4
4
|
* Higher-order function: Bisector-of-Area defuzzification strategy. Returns
|
|
5
5
|
* strategy which computes the integral of a given fuzzy set in the defined
|
package/strategies/centroid.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DefuzzStrategy, DefuzzStrategyOpts } from "../api";
|
|
1
|
+
import type { DefuzzStrategy, DefuzzStrategyOpts } from "../api.js";
|
|
2
2
|
/**
|
|
3
3
|
* Higher-order function: Centre-of-gravity defuzzification strategy, yielding
|
|
4
4
|
* the approx. center of gravity position of a given fuzzy set. The domain is
|
package/strategies/centroid.js
CHANGED
package/strategies/maxima.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DefuzzStrategy, DefuzzStrategyOpts } from "../api";
|
|
1
|
+
import type { DefuzzStrategy, DefuzzStrategyOpts } from "../api.js";
|
|
2
2
|
/**
|
|
3
3
|
* Higher-order function. Returns Mean-of-Maxima defuzzification strategy,
|
|
4
4
|
* yielding the approx. mean of the maximum region of a given fuzzy set.
|
package/strategies/maxima.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { eqDelta } from "@thi.ng/math/eqdelta";
|
|
2
|
-
import { defaultOpts } from "./opts";
|
|
2
|
+
import { defaultOpts } from "./opts.js";
|
|
3
3
|
/**
|
|
4
4
|
* Higher-order function. Returns Mean-of-Maxima defuzzification strategy,
|
|
5
5
|
* yielding the approx. mean of the maximum region of a given fuzzy set.
|
package/strategies/opts.d.ts
CHANGED
package/var.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LVar } from "./api";
|
|
1
|
+
import type { LVar } from "./api.js";
|
|
2
2
|
/**
|
|
3
3
|
* Takes a `domain` interval and on object of named fuzzy sets and returns a new
|
|
4
4
|
* Linguistic variable, which can then be used as input or output var for
|
|
@@ -18,7 +18,7 @@ import type { LVar } from "./api";
|
|
|
18
18
|
* @param domain
|
|
19
19
|
* @param terms
|
|
20
20
|
*/
|
|
21
|
-
export declare const variable: <K extends string>(domain: import("@thi.ng/api").Range, terms: import("./api").LVarTerms<K>) => LVar<K>;
|
|
21
|
+
export declare const variable: <K extends string>(domain: import("@thi.ng/api").Range, terms: import("./api.js").LVarTerms<K>) => LVar<K>;
|
|
22
22
|
/**
|
|
23
23
|
* Takes an LVar and a domain value `x`. Returns the ID of the var's fuzzy set
|
|
24
24
|
* term which yields the max truth value for given `x`. If `threshold` is
|