Test 4001

本文提供了解决如何通过访问特定链接并下载js.txt文件以获取其中包含的密钥的方法。关键步骤包括点击超链接下载文件,并在文件中查找名为key的变量,其值为SWUN_CTF{jsISsoco0l}

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

%% 清空环境变量 warning off % 关闭报警信息 close all % 关闭开启的图窗 clear % 清空变量 clc % 清空命令行 %% 导入数据 res = xlsread('数据集.xlsx');%数据为132×4002 %% 划分训练集和测试集 temp = randperm(132); P_train = res(temp(1: 100), 1: 4001)'; T_train = res(temp(1: 100), 4002)'; M = size(P_train, 2); P_test = res(temp(101: end), 1: 4001)'; T_test = res(temp(101: end), 4002)'; N = size(P_test, 2); %% 数据归一化 [p_train, ps_input] = mapminmax(P_train, 0, 1); p_test = mapminmax('apply', P_test, ps_input); [t_train, ps_output] = mapminmax(T_train, 0, 1); t_test = mapminmax('apply', T_test, ps_output); %% 转置以适应模型 p_train = p_train'; p_test = p_test'; t_train = t_train'; t_test = t_test'; %% 创建模型 k = 5; % 保留主成分个数 [Xloadings, Yloadings, Xscores, Yscores, betaPLS, PLSPctVar, MSE, stats] = plsregress(p_train, t_train, k); % https://blog.youkuaiyun.com/linping_/article/details/110193946 %% 预测拟合 t_sim1 = [ones(M, 1), p_train] * betaPLS; t_sim2 = [ones(N, 1), p_test ] * betaPLS; %% 数据反归一化 T_sim1 = mapminmax('reverse', t_sim1, ps_output); T_sim2 = mapminmax('reverse', t_sim2, ps_output); %% 均方根误差 error1 = sqrt(sum((T_sim1' - T_train).^2) ./ M); error2 = sqrt(sum((T_sim2' - T_test ).^2) ./ N); %% 绘图 figure plot(1: M, T_train, 'r-*', 1: M, T_sim1, 'b-o', 'LineWidth', 1) legend('真实值', '预测值') xlabel('预测样本') ylabel('预测结果') string = {'训练集预测结果对比'; ['RMSE=' num2str(error1)]}; title(string) xlim([1, M]) grid figure plot(1: N, T_test, 'r-*', 1: N, T_sim2, 'b-o', 'LineWidth', 1) legend('真实值', '预测值') xlabel('预测样本') ylabel('预测结果') string = {'测试集预测结果对比'; ['RMSE=' num2str(error2)]}; title(string) xlim([1, N]) grid %% 相关指标计算 % R2 R1 = 1 - norm(T_train - T_sim1')^2 / norm(T_train - mean(T_train))^2; R2 = 1 - norm(T_test - T_sim2')^2 / norm(T_test - mean(T_test ))^2; disp(['训练集数据的R2为:', num2str(R1)]) disp(['测试集数据的R2为:', num2str(R2)]) % MAE mae1 = sum(abs(T_sim1' - T_train)) ./ M ; mae2 = sum(abs(T_sim2' - T_test )) ./ N ; disp(['训练集数据的MAE为:', num2str(mae1)
03-11
%% 数据输入模块(保持不变) historical_emission = [9682.74,9989.63,10773.99,11117.61,11137.42,11128.88,11495.02,11951.23,12049.60,12355.79,12925.21,13234.42]; historical_factors = [ 59720000 27303 0.6046 0.6491 59780000 30697 0.5596 0.6192 59880000 34404 0.5211 0.5682 59970000 37580 0.5044 0.5334 60110000 39692 0.4985 0.5162 60330000 43682 0.4780 0.4813 60570000 49092 0.4385 0.4387 60760000 56063 0.4001 0.3909 60920000 60561 0.3876 0.3764 61047617 62411 0.3976 0.3862 61130000 69676 0.3745 0.3605 61270000 72888 0.3477 0.3526 ]; future_factors = [ 61496981 50549 0.3340 0.3112 61660973 55287 0.3189 0.2929 61825402 60469 0.3044 0.2756 61990270 66137 0.2906 0.2594 62155577 72336 0.2774 0.2441 62321325 79116 0.2648 0.2297 ]; %% 数据预处理(关键修改) % 分割数据为训练集(前9年)和测试集(后3年) train_idx = 1:9; % 训练数据索引 test_idx = 10:12; % 测试数据索引 % 仅用训练集计算归一化参数 [input_norm_train, input_ps] = mapminmax(historical_factors(train_idx, :)‘, 0, 1); [target_norm_train, target_ps] = mapminmax(historical_emission(train_idx)’, 0, 1); % 测试集应用训练集的归一化参数 input_norm_test = mapminmax(‘apply’, historical_factors(test_idx, :)‘, input_ps); target_norm_test = mapminmax(‘apply’, historical_emission(test_idx)’, target_ps); %% BP神经网络构建(改进训练算法) net = feedforwardnet(10, ‘trainbr’); % 贝叶斯正则化算法 net.trainParam.epochs = 1000; net.trainParam.goal = 1e-5; net.trainParam.max_fail = 20; % 早停:连续20次验证误差不下降则停止 %% 模型训练(使用训练集) net = train(net, input_norm_train, target_norm_train); %% 模型验证(使用独立测试集) test_pred_norm = net(input_norm_test); test_pred = mapminmax(‘reverse’, test_pred_norm, target_ps)'; %% 未来预测(保持不变) future_norm = mapminmax(‘apply’, future_factors’, input_ps); pred_norm = net(future_norm); pred_emission = mapminmax(‘reverse’, pred_norm, target_ps)'; %% 增强可视化 years_hist = 2011:2022; years_pred = 2023:2028; % 主趋势图 figure; plot(years_hist, historical_emission, ‘b-o’, ‘LineWidth’, 2, ‘MarkerSize’, 8); hold on; plot(years_pred, pred_emission, ‘r–*’, ‘LineWidth’, 2, ‘MarkerSize’, 10); plot(years_hist(test_idx), test_pred, ‘g-s’, ‘LineWidth’, 2, ‘MarkerSize’, 8); % 测试集预测 xlabel(‘年份’); ylabel(‘碳排放量(万吨)’); legend(‘历史数据’, ‘未来预测’, ‘测试集预测’, ‘Location’, ‘northwest’); title(‘碳排放量预测结果’); grid on; % 添加数值标签 text(years_hist, historical_emission, num2str(historical_emission’, ‘%.1f’),… ‘VerticalAlignment’,‘bottom’, ‘HorizontalAlignment’,‘right’, ‘FontSize’,8); text(years_pred, pred_emission, num2str(pred_emission’, ‘%.1f’),… ‘VerticalAlignment’,‘bottom’, ‘HorizontalAlignment’,‘left’, ‘FontSize’,8); % 预测误差分析图 figure; scatter(historical_emission(test_idx), test_pred, 100, ‘filled’); hold on; plot([min(historical_emission), max(historical_emission)],… [min(historical_emission), max(historical_emission)], ‘k–’); xlabel(‘实际值’); ylabel(‘预测值’); title(‘测试集预测精度散点图’); grid on; %% 综合评估指标(新增R²和MAE) % 计算误差 errors = test_pred - historical_emission(test_idx); % MSE mse = mean(errors.^2); % MAE mae = mean(abs(errors)); % RMSE rmse = sqrt(mse); % R² SS_res = sum(errors.^2); SS_tot = sum((historical_emission(test_idx) - mean(historical_emission(test_idx))).^2); R2 = 1 - (SS_res / SS_tot); % 输出结果 fprintf(‘----- 模型评估结果 -----\n’); fprintf(‘均方误差 (MSE) : %.2f 万吨²\n’, mse); fprintf(‘平均绝对误差 (MAE) : %.2f 万吨\n’, mae); fprintf(‘均方根误差 (RMSE) : %.2f 万吨\n’, rmse); fprintf(‘决定系数 (R²) : %.4f\n’, R2); 修改代码,使数据一开始就在代码中,不需要用户输入,并生成完整代码
03-24
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值