Trie
本博客为哈佛大学的CS50 Introduction to Computer Science中数据结构 【Tries】这一节的笔记,我按照自己的理解排布了结构,进行了翻译并加上了自己的理解作为补充。致谢为这门课付出并公开的所有人
What is TrieTrie以一种有趣的方式尝试将结构和指针组合在一起来存储数据。
• 要在Trie中搜索的数据是路线图。• 如果您可以从头到尾遵循地图,则数据存在于Trie。• 如果你不能,那就不存在。• 与哈希表不同,Trie不存在冲突,也不存在两个数据块(除非它们相同)具有相同的路径
Tries combine structures and pointers together to store data in an interesting way.• The data to be searched for in the trie is now a roadmap.• If you can follow the map from beginning to end, the data exists in the trie.• If you can’t, ...
Hash Table
本博客为哈佛大学的CS50 Introduction to Computer Science中数据结构哈希表这一节的笔记,我按照自己的理解排布了结构,进行了翻译并加上了自己的理解作为补充。致谢为这门课付出并公开的所有人
What is Hash Table?哈希表是两种我们非常熟悉的东西的结合体。
第一个是哈希函数,它能把输入的内容经过处理后,返回一个特定的称为哈希码的非负整数值。
第二个是一个能够存储我们希望放入数据结构中的数据类型的数组。(例如普通的数组或者是一个Vector,总之是一个能够存放“值”的容器。哈希表中的数组可以是普通的数组、向量、链表、链表数组等不同数据结构,具体取决于哈希表的实现方式。)
在哈希表中,数组的每个位置都可以存储一个键值对(key-value pair),其中“键”是用来查找值的标识符,而“值”则是我们实际想要存储的数据。通过哈希函数,我们可以将键映射到数组的索引位置上,然后将值存储在对应的位置,以便能够高效地检索和操作数据。所以,这句话的意思是在哈希表中,我们使用数组来存储键值对中的值部分。*
A hash table amounts to ...
一些零散的知识点
本文内容和封面均由AI生成(GPT4-bing、DALL-E)
端边云端边云是一种终端-边缘-云协同的架构,可以将云计算和边缘计算有机融合,实现数据的就近处理、智能分析和高效传输。端边云的计算架构主要分为三个部分:
端(End):指的是终端设备,如手机、智能家电、各类传感器、摄像头等,是数据的产生者和消费者,也可以执行一些简单的数据处理任务。
边(Edge):指的是靠近终端设备的边缘服务器或网关,是数据的中转站和加速器,可以执行一些复杂的数据处理任务,如数据清洗、过滤、聚合、缓存、模型推理等,减少对云端的依赖和负担。
云(Cloud):指的是传统的云计算平台,是数据的汇聚点和管理者,可以执行一些全局性和高级别的数据处理任务,如数据存储、分析、挖掘、模型训练等,提供统一的服务和接口。端边云的优势主要有以下几点:
降低时延:通过在边缘侧进行数据处理,可以减少数据在网络中的传输时间,提高响应速度,满足实时性要求。
节省带宽:通过在边缘侧进行数据过滤和压缩,可以减少数据在网络中的传输量,节省网络资源,降低成本。
增强安全:通过在边缘侧进行数据加密和隐私保护,可以减少数据在网络中的泄露风险 ...
关于芯片与深度学习框架
以下内容由配备GPT4的new-bing生成
关于Ascend(昇腾)Ascend芯片是华为自主研发的一系列人工智能处理器,采用了达芬奇架构,支持全栈全场景的AI应用。Ascend芯片有以下几个特点:
Ascend芯片采用了3D Cube矩阵乘法单元,能够显著提升数据利用率,缩短运算周期,实现更快更强的AI运算。
Ascend芯片集成了scalar、vector和cube三类运算单元,分别支持不同的AI算法场景,在专用加速的同时保证了架构的通用性和灵活性。
Ascend芯片具有很强的平台整合能力,充分利用华为作为系统供应商软硬件结合设计的能力,提供端、边、云的全场景AI基础设施方案。其他AI芯片,如英伟达的GPU和谷歌的TPU,也有各自的优势和特点。例如:
GPU是一种基于SIMT结构的通用并行计算设备,具有高度可编程性和灵活性,可以支持多种AI算法和应用。
TPU是一种基于Systolic Array结构的专用AI加速器,具有高效能效比和低延迟,可以支持大规模的深度学习训练和推理。
MindSpore(昇思)MindSpore是一个全场景深度学习框架,旨在实现易开发、高效执行、全 ...
Machine_Learning_Algorithms
规划求解启发式算法遗传算法模拟退火蚁群算法机器学习分类基于树的算法决策树决策树是一种树形结构的模型,可以用来进行分类或回归问题。它的基本思想是,根据一些特征和划分准则,将数据集分成不同的子集,直到达到某种停止条件。决策树的优点是易于理解和解释,可以处理离散或连续的特征,可以处理缺失值和异常值等。决策树的缺点是容易过拟合,对噪声敏感,可能不稳定等。
Gini(基尼系数)
Gini
There are many ways to split the samples, we use the >GINI method in this tutorial.
The Gini method uses this formula:
$Gini = 1 - (x/n)^2 - (y/n)^2$
Where $x$ is the number of positive answers(“GO”), $n$ is the number of samples, and $y$ is the number of negative answers (“NO”), which gives us this calc ...
SHAP
SHAP(Shapley Additive exPlanation)一种模型事后解释方法,可以对复杂机器学习模型进行解释。起源:合作博弈论,一个简单的例子是ABC三个人测量叶片面积,分配酬劳。这个例子中的体现是边际贡献加权平均的方法来规划酬劳的分配。
SHAP的核心是计算每个特征变量的shapley valueShapley Additive exPlanation,代表对每个样本中的每一个特征变量都计算出SV,而且SV是可加的,目的是解释每个特征变量是如何影响模型的预测值的。
SHAP三个重要性质:
局部保真性local accuracy
缺失性missingness
连续性consistencySHAP最大的优势反映出每一个样本的特征的影响力,并且表现出贡献的正负性SHAP的两个不足
计算量庞大,计算非常耗时
有可能会造成误导,这是由于
特征值的shapley值不是从模型训练中删除特征后的预测值之差。而是给定当前的一组特征值,特征值对于实际预测值和平均预测值之差的贡献就是估计的shapley值。一个样本中各个特征的SHAP值加上基线值等于该样本的预测值。
针对这两种问题,有了 ...
数学建模模型笔记
总体/样本皮尔逊Pearson相关系数皮尔逊相关系数也可以看成是剔除了两个变量量纲影响,即将X和Y标准化后的协方差。n,n-1这里的相关系数只是用来衡量两个变量线性相关程度的指标;也就是说,你必须先确认这两个变量是线性相关的,然后这个相关系数才能告诉你他俩相关程度如何。
容易忽视和犯错的点(1)非线性相关也会导致线性相关系数很大,例如图2。(2)离群点对相关系数的影响很大,例如图3,去掉离群点后,相关系数为0.98。(3)如果两个变量的相关系数很大也不能说明两者相关,例如图4,可能是受到了异常值的影响。(4)相关系数计算结果为0,只能说不是线性相关,但说不定会有更复杂的相关关系(非线性相关),例如图5。
(1)如果两个变量本身就是线性的关系,那么皮尔逊相关系数绝对值大的就是相关性强,小的就是相关性弱;(2)在不确定两个变量是什么关系的情况下,即使算出皮尔逊相关系数,发现很大,也不能说明那两个变量线性相关,甚至不能说他们相关,我们一定要画出散点图来看才行。
事实上,比起相关系数的大小,我们往往更关注的是显著性。(假设检验)
优化算法遗传算法粒子群算法蚁群算法模拟退火算法分类/回归算法逻辑 ...
9天Singapore之旅
我把9天的新加坡之旅剪成了20分钟!
在坡生活常识
左行右舵
新加坡的插座是英标的,去之前必须买转接头
办地铁卡(ezLink)要10新币不退(其中工本费5新币,初始余额5新币)
地铁服务站大概率在A口附件
不建议打车,太贵了
进寺庙衣着得体(T恤长裤)
要进印度庙得脱鞋子,所以前去参访的本地人都是穿拖鞋去的,拖鞋会在路边聚集
新加坡是移民国家,大体分为四个人种:华人、印度人、马来人、欧亚后裔(混血)
新加坡差不多八九成的居民是住在政府的组屋里的,不用花太多钱,住房压力很小。特别有钱的人就得去买私人住房了,那就很贵趣闻
出发时在飞机上跟两个母亲换了座位,因为他们想和他们的儿子一起坐
在鱼尾狮公园、克拉码头和滨海湾公园触发了随机事件——帮助外国友人拍照、为外国小哥指路
在酒店的被子每天都会被清洁人员像被单一样塞进床垫底下,每次睡觉盖被子都要扯出来
酒店房间窗外的天主教教堂每天会在7:15左右和17:54左右敲钟
在新加坡河边遇到了正在拍摄的剧组,拍了一张照被工作人员友好说明不要拍照,哈哈哈
跟会说中文的人交流全程用蹩脚的英文
在地铁上扶了一位华人老奶奶去空余的座位上坐着 ...
摄影知识小记
测光模式
矩阵测光适合逆光
中央测光适合风景和人像
点测光适合舞台和个人艺术照
DXO(DxOMark)DxOMark是一个知名的图像质量评价和测量平台,其主要关注摄影和图像设备的性能评估,特别是智能手机摄像头。
DxOMark评估各种摄影设备,包括智能手机、相机和镜头,以及其他图像相关的技术。对于智能手机,DxOMark主要关注以下几个方面:
照片质量: DxOMark评估相机的照片质量,包括细节、色彩准确性、动态范围和噪音控制等。
视频质量: 评估相机的视频拍摄质量,包括稳定性、色彩、曝光等方面。
低光环境表现: 测量在低光条件下的摄影和视频性能,评估设备在暗光中的表现能力。
自动对焦和对焦追踪: 评估设备的对焦速度、准确性和对移动主题的跟踪能力。
变焦性能: 评估光学变焦和数字变焦的质量和性能。
效果和滤镜: 评估设备提供的特效、滤镜和图像处理功能。
DxOMark将评估结果以分数形式公开发布,为消费者提供了参考,帮助他们在购买手机时更好地了解摄像头性能。这在手机销售和市场竞争中具有一定的影响力,因为消费者通常会考虑摄像头性能作为购买决策的一个因素。然而,请注意,DxOMark ...
初识Pytorch以及其配置安装
初识Pytorch以及配置安装什么是pytorch?为什么是pytorch?
PyTorch 是一种用于构建深度学习模型的功能完备框架,是一种通常用于图像识别和语言处理等应用程序的机器学习。使用 Python 编写,因此对于大多数机器学习开发者而言,学习和使用起来相对简单。PyTorch 的独特之处在于,它完全支持 GPU,并且使用反向模式自动微分技术,因此可以动态修改计算图形。这使其成为快速实验和原型设计的常用选择。
PyTorch 在 Python 开发者中特别受欢迎,因为它使用 Python 编写,并使用该语言的命令式、运行时定义即时执行模式,在这种模式下,从 Python 调用运算时执行运算。随着 Python 编程语言的广泛采用,一项调查显示,AI 和机器学习任务受到越来越多的关注,并且相关 PyTorch 的采用也随之提升。这使得 PyTorch 对于刚接触深度学习的 Python 开发者来说是一个很好的选择,而且越来越多的深度学习课程基于 PyTorch。从早期版本开始,API 一直保持一致,这意味着代码对于经验丰富的 Python 开发者来说相对容易理解。
确定安装的 ...