MATLAB模糊数学函数:F_tj, Max_Min与F_JlSjBzh应用示例

下载需积分: 3 | TXT格式 | 6KB | 更新于2024-09-11 | 159 浏览量 | 0 下载量 举报
收藏
"MATLAB是一种广泛使用的高级编程语言和环境,主要用于数值计算、数据可视化和算法开发。本资源包含了MATLAB中的一些核心函数和命令,它们在处理矩阵操作和数据分析方面具有重要作用。 1. F_tj.m 函数:这是一个用于计算模糊集合(fuzzy set)的函数,名为Fuzzy T-jump (F_tj)。它接收一个二维矩阵A和一个参数m0作为输入,首先计算矩阵A的最小值(Amin)和最大值(Amax),然后根据m0生成一个等差数组x。接着,通过遍历矩阵A,统计x落在A每个元素区间内的次数,最后将这些频率除以总行数n,得到一个概率分布,用Bar函数绘制模糊集的图形。 2. Max_Min.m 函数:此函数用于求解两个矩阵A和B的最大最小值对应位置,即找到每个行i中的最小值对应的列j和最大值对应的列j。如果矩阵A和B的维度不匹配,则返回错误。这个功能适用于需要快速找出两个矩阵相似度或比较的应用场景。 3. F_JlSjBzh.m 函数:这个函数名为Fuzzy Joint Least Squares Bounding (F_JlSjBzh),针对的是模糊决策问题。它接受一个矩阵X和一个整数cs作为输入,cs表示决策类型。当cs为0时,函数不做处理并返回;cs为1时,进行中心化处理,使得每一列向量的均值为0,方差为1,常用于模糊数据预处理;cs为2时,函数可能执行某种形式的模糊决策逻辑,具体实现取决于上下文。 除了上述三个函数,资源还提到了一些基础命令,如`addpath`和`rmpath`用于增加或删除MATLAB的搜索路径,`demo`用于运行MATLAB的演示程序,`type`显示.M文件内容,`doc`查看文档,`version`获取MATLAB版本,`help`启动在线帮助,`what`列出文件列表,`lasterr`查看最近的错误信息,`whatsnew`显示新特性,`which`查找函数或文件所在路径,以及`path`设置或查询路径。 这些代码片段展示了MATLAB在处理数值计算、数据分析、决策分析等方面的基本操作和技巧,对于学习和使用MATLAB进行数据分析工作的人来说,这些都是十分实用且重要的工具。"
身份认证 购VIP最低享 7 折!
30元优惠券

相关推荐

filetype

修改和补充下列代码得到十折交叉验证的平均auc值和平均aoc曲线,平均分类报告以及平均混淆矩阵 min_max_scaler = MinMaxScaler() X_train1, X_test1 = x[train_id], x[test_id] y_train1, y_test1 = y[train_id], y[test_id] # apply the same scaler to both sets of data X_train1 = min_max_scaler.fit_transform(X_train1) X_test1 = min_max_scaler.transform(X_test1) X_train1 = np.array(X_train1) X_test1 = np.array(X_test1) config = get_config() tree = gcForest(config) tree.fit(X_train1, y_train1) y_pred11 = tree.predict(X_test1) y_pred1.append(y_pred11 X_train.append(X_train1) X_test.append(X_test1) y_test.append(y_test1) y_train.append(y_train1) X_train_fuzzy1, X_test_fuzzy1 = X_fuzzy[train_id], X_fuzzy[test_id] y_train_fuzzy1, y_test_fuzzy1 = y_sampled[train_id], y_sampled[test_id] X_train_fuzzy1 = min_max_scaler.fit_transform(X_train_fuzzy1) X_test_fuzzy1 = min_max_scaler.transform(X_test_fuzzy1) X_train_fuzzy1 = np.array(X_train_fuzzy1) X_test_fuzzy1 = np.array(X_test_fuzzy1) config = get_config() tree = gcForest(config) tree.fit(X_train_fuzzy1, y_train_fuzzy1) y_predd = tree.predict(X_test_fuzzy1) y_pred.append(y_predd) X_test_fuzzy.append(X_test_fuzzy1) y_test_fuzzy.append(y_test_fuzzy1)y_pred = to_categorical(np.concatenate(y_pred), num_classes=3) y_pred1 = to_categorical(np.concatenate(y_pred1), num_classes=3) y_test = to_categorical(np.concatenate(y_test), num_classes=3) y_test_fuzzy = to_categorical(np.concatenate(y_test_fuzzy), num_classes=3) print(y_pred.shape) print(y_pred1.shape) print(y_test.shape) print(y_test_fuzzy.shape) # 深度森林 report1 = classification_report(y_test, y_prprint("DF",report1) report = classification_report(y_test_fuzzy, y_pred) print("DF-F",report) mse = mean_squared_error(y_test, y_pred1) rmse = math.sqrt(mse) print('深度森林RMSE:', rmse) print('深度森林Accuracy:', accuracy_score(y_test, y_pred1)) mse = mean_squared_error(y_test_fuzzy, y_pred) rmse = math.sqrt(mse) print('F深度森林RMSE:', rmse) print('F深度森林Accuracy:', accuracy_score(y_test_fuzzy, y_pred)) mse = mean_squared_error(y_test, y_pred) rmse = math.sqrt(mse) print('F?深度森林RMSE:', rmse) print('F?深度森林Accuracy:', accuracy_score(y_test, y_pred))

160 浏览量
filetype

修改和补充下列代码得到十折交叉验证的平均每一折auc值和平均每一折aoc曲线,平均每一折分类报告以及平均每一折混淆矩阵 min_max_scaler = MinMaxScaler() X_train1, X_test1 = x[train_id], x[test_id] y_train1, y_test1 = y[train_id], y[test_id] # apply the same scaler to both sets of data X_train1 = min_max_scaler.fit_transform(X_train1) X_test1 = min_max_scaler.transform(X_test1) X_train1 = np.array(X_train1) X_test1 = np.array(X_test1) config = get_config() tree = gcForest(config) tree.fit(X_train1, y_train1) y_pred11 = tree.predict(X_test1) y_pred1.append(y_pred11 X_train.append(X_train1) X_test.append(X_test1) y_test.append(y_test1) y_train.append(y_train1) X_train_fuzzy1, X_test_fuzzy1 = X_fuzzy[train_id], X_fuzzy[test_id] y_train_fuzzy1, y_test_fuzzy1 = y_sampled[train_id], y_sampled[test_id] X_train_fuzzy1 = min_max_scaler.fit_transform(X_train_fuzzy1) X_test_fuzzy1 = min_max_scaler.transform(X_test_fuzzy1) X_train_fuzzy1 = np.array(X_train_fuzzy1) X_test_fuzzy1 = np.array(X_test_fuzzy1) config = get_config() tree = gcForest(config) tree.fit(X_train_fuzzy1, y_train_fuzzy1) y_predd = tree.predict(X_test_fuzzy1) y_pred.append(y_predd) X_test_fuzzy.append(X_test_fuzzy1) y_test_fuzzy.append(y_test_fuzzy1)y_pred = to_categorical(np.concatenate(y_pred), num_classes=3) y_pred1 = to_categorical(np.concatenate(y_pred1), num_classes=3) y_test = to_categorical(np.concatenate(y_test), num_classes=3) y_test_fuzzy = to_categorical(np.concatenate(y_test_fuzzy), num_classes=3) print(y_pred.shape) print(y_pred1.shape) print(y_test.shape) print(y_test_fuzzy.shape) # 深度森林 report1 = classification_report(y_test, y_prprint("DF",report1) report = classification_report(y_test_fuzzy, y_pred) print("DF-F",report) mse = mean_squared_error(y_test, y_pred1) rmse = math.sqrt(mse) print('深度森林RMSE:', rmse) print('深度森林Accuracy:', accuracy_score(y_test, y_pred1)) mse = mean_squared_error(y_test_fuzzy, y_pred) rmse = math.sqrt(mse) print('F深度森林RMSE:', rmse) print('F深度森林Accuracy:', accuracy_score(y_test_fuzzy, y_pred)) mse = mean_squared_error(y_test, y_pred) rmse = math.sqrt(mse)

193 浏览量