0
Rでは、ファジーロジックのsetsパッケージを使用してファジーサーフェスを3Dプロットに最適にプロットできますか?サービス変数と食品変数はx軸とy軸で、z軸はファジィ推論変数を非ファジィ化して求めた重心でなければなりません。Rのセットライブラリを使用してファジーサーフェスを効率的にプロットする方法
私はexpand.gridを使って4,000ポイントのファジー表面をプロットしてみましたが、コンピュータディスクは100%になり、2回再起動してもそのままになりました。私はあなたのコンピュータの安全のために、私が書いたコードを意図的に表示しません。
文書のこの例のシステムは、良い出発点になります。結果をプロットするのを助けてくれますか?ありがとう。
library(sets)
# set universe
sets_options("universe", seq(from = 0, to = 25, by = 1))
# set up fuzzy variables
variables <-
set(service = fuzzy_partition(varnames = c(poor = 0, good = 5, excellent = 10), sd = 1.5),
food = fuzzy_variable(rancid = fuzzy_trapezoid(corners = c(-2, 0, 2, 4)),
delicious = fuzzy_trapezoid(corners = c(7, 9, 11, 13))),
tip = fuzzy_partition(varnames = c(cheap = 5, average = 12.5, generous = 20),
FUN = fuzzy_cone, radius = 5)
)
# set up rules
rules <-
set(
fuzzy_rule(service %is% poor || food %is% rancid, tip %is% cheap),
fuzzy_rule(service %is% good, tip %is% average),
fuzzy_rule(service %is% excellent || food %is% delicious, tip %is% generous)
)
# combine to a system
system <- fuzzy_system(variables, rules)
print(system)
plot(system) ## plots variables
# do inference
fi <- fuzzy_inference(system, list(service = 3, food = 8.123))
# plot resulting fuzzy set
plot(fi)
# defuzzify
print(gset_defuzzify(fi, "centroid"))
# reset universe
sets_options("universe", NULL)