使用GitHub项目 学习双层优化

时间:2024年4月2日-4月6日, 4月11日-4月12日

前一个文件见boml项目学习

前言:由于现在对原boml项目有一定的了解,发现当前的BDA项目在原来的项目基础上有一定程度的精简。对于数据的获取问题上有了更加明确的用于处理数据清晰问题的代码,进而进一步分析该代码。

以下内容是基于 vis-opt-group/BDA

数据超清洗问题上,BDA中提供了一个交互函数来添加参数,相比于原项目中使用json数据文档的方式要更方便一点。这一点可以在后期自己写代码时利用上,以增加代码使用的便捷性。

基于运行情况,该项目也可以在之前搭建的环境下使用GPU进行运算。

脚本Data_hyper_cleaning.py

一些使用例子

 

脚本Few_shot.py

 

 

 

其他

安装jupyter notebook

 

 

忽略部分警告

参考1:https://blog.csdn.net/time_forgotten/article/details/104792200

参考2:https://cloud.tencent.com/developer/news/1307462

参考3(似乎无效):https://zhuanlan.zhihu.com/p/116733375

参考4(似乎无效):https://blog.csdn.net/weixin_45459911/article/details/108796503

参考5:https://blog.csdn.net/a1456123a/article/details/115498412

参考6:https://github.com/tensorflow/tensorflow/issues/30308#issuecomment-513467525


F1的含义

F1的使用来自于python包 scikit

维基百科地址:https://en.wikipedia.org/wiki/F-score


Compute the F1 score, also known as balanced F-score or F-measure.

The F1 score can be interpreted as a harmonic mean of the precision and recall, where an F1 score reaches its best value at 1 and worst score at 0. The relative contribution of precision and recall to the F1 score are equal. The formula for the F1 score is:

F1=2TP2TP+FP+FN

Where TP is the number of true positives, FN is the number of false negatives, and FP is the number of false positives. F1 is by default calculated as 0.0 when there are no true positives, false negatives, or false positives.

关于真假,正反例问题看下表:

真实\预测正例反例
正例TP(真正例)FN(假反例)
反例FP(假正例)TN(真反例)

真假取决于 预测和真实是否相同;正反取决于预测值的正反。

使用matplotlib可视化结果

参考页面1:https://matplotlib.org/stable/users/getting_started/

参考页面2:https://blog.csdn.net/LOVEmy134611/article/details/117572333

保存为pickle格式

关于保存文件格式为pickle的相关内容:https://blog.csdn.net/m0_38132177/article/details/122196583

一段将pickle文件转换为 json文件的代码(chatGPT生成):

关于json管理包jq的使用

参考页面1:https://zhuanlan.zhihu.com/p/606945462

pickle包的使用

参考页面1:https://blog.csdn.net/weixin_43625577/article/details/86699789

一个tools文件

BDA项目中无法使用GPU的问题

提高GPU使用效率

参考链接1:https://blog.csdn.net/u012856866/article/details/104921811