如何为股票市场数据编写模糊逻辑

how can I write fuzzy logic for a stock market data

提问人:Segun Abiola 提问时间:7/16/2023 更新时间:7/16/2023 访问量:15

问:

“目的是使用模糊决策树来预测未来的股票市场价格和股票的相关信息检索。步骤是 i. 模糊化 ii. 树木建造 iii. 去模糊化

这是我的一些代码。feature_names 中的 fuzzy_sets = {}: feature_values = X[feature].values fuzzy_sets[feature] = {} fuzzy_sets[feature]['low'] = fuzz.trimf(feature_values, [np.min(feature_values), np.min(feature_values), np.mean(feature_values)]) fuzzy_sets[feature]['medium'] = fuzz.trimf(feature_values, [np.min(feature_values), np.mean(feature_values), np.max(feature_values)]) fuzzy_sets[feature]['high'] = fuzz.trimf(feature_values, [np.mean(feature_values), np.max(feature_values), np.max(feature_values)]) # 为目标变量创建模糊隶属函数your textyour textyour textyour textyour textyour textyour textyour textyour textyour textyour textyour text

your texttarget_values = y.values fuzzy_sets[target_name] = {} fuzzy_sets[target_name]['low'] = fuzz.trimf(target_values, [np.min(target_values), np.min(target_values), np.mean(target_values)]) fuzzy_sets[target_name]['medium'] = fuzz.trimf(target_values, [np.min(target_values), np.mean(target_values), np.max(target_values)]) fuzzy_sets[target_name]['high'] = fuzz.trimf(target_values, [np.mean(target_values), np.max(target_values), np.max(target_values)])your textyour textyour textyour textyour textyour textyour text

text# 为目标变量创建模糊隶属函数 target_values = y.values fuzzy_sets[target_name] = {} fuzzy_sets[target_name]['low'] = fuzz.trimf(target_values, [np.min(target_values), np.min(target_values), np.mean(target_values)]) fuzzy_sets[target_name]['medium'] = fuzz.trimf(target_values, [np.min(target_values), np.mean(target_values), np.max(target_values)]) fuzzy_sets[target_name]['high'] = fuzz.trimf(target_values, [np.mean(target_values), np.max(target_values), np.max(target_values)])your textyour textyour textyour textyour textyour textyour textyour text

your text# 为feature_names中的特征创建模糊决策树 fuzzy_tree = {}: fuzzy_tree[feature] = ctrl。Antecedent(np.arange(np.min(X[feature]), np.max(X[feature]), np.mean(X[feature])), feature) for fuzzy_set in fuzzy_sets[feature]: fuzzy_tree[feature][fuzzy_set] = fuzz.trimf(fuzzy_tree[feature].universe, fuzzy_sets[feature][fuzzy_set])your textyour textyour textyour textyour textyour textyour textyour text

your texttarget_variable = ctrl。Consequent(np.arange(np.min(y), np.max(y), np.mean(y)), target_name) for fuzzy_set in fuzzy_sets[target_name]: target_variable[fuzzy_set] = fuzz.trimf(target_variable.universe, fuzzy_sets[target_name][fuzzy_set])your textyour textyour textyour text

your text# 打印模糊决策树 print(“Fuzzy Decision Tree:”) print(fuzzy_tree) print(target_variable)your textyour textyour text

your text但是我在创建树的过程中不断收到错误消息'

模糊 比较

评论


答: 暂无答案