上一页 1 2 3 4 5 6 7 8 9 ··· 12 下一页
摘要: 在 Python 3.6 及更高版本中,在字符串前加上一个 f,表示这是一个 f-string(格式化字符串字面量)。 f-string 的主要作用是让你在字符串中嵌入 Python 表达式,使得格式化字符串变得非常简洁和直观。 f-string 的基本用法 你只需要在字符串开头加上 f,然后在字符 阅读全文
posted @ 2025-09-15 18:02 李大嘟嘟 阅读(27) 评论(0) 推荐(0)
摘要: np.zeros 是 NumPy 库中的一个非常常用的函数,它的作用是创建一个指定形状和数据类型的新数组,并用 0 来填充所有元素。 np.zeros 的基本用法 函数的完整签名是 numpy.zeros(shape, dtype=float, order='C')。 shape:你想要创建的数组的 阅读全文
posted @ 2025-09-14 23:08 李大嘟嘟 阅读(18) 评论(0) 推荐(0)
摘要: .shape 不是一个函数,而是numpy的一个属性(attribute),用于获取数组维度信息。它返回一个元组(tuple),元组中的每个元素代表对应维度的大小。 import numpy as np # 1D 数组 (向量) arr1d = np.array([1, 2, 3, 4, 5]) p 阅读全文
posted @ 2025-09-14 22:13 李大嘟嘟 阅读(22) 评论(0) 推荐(0)
摘要: ##手写数字识别 # 对分类任务而言,标签不可以用数值表示,而应该用向量表示(向量有相似度)。因此,我们需要将标签转换为独热编码形式(onehot )。 # 导入必要的库 import numpy as np # numpy库 import os # 操作系统库 import struct # 数据 阅读全文
posted @ 2025-08-29 17:33 李大嘟嘟 阅读(6) 评论(0) 推荐(0)
摘要: 由计算结果可见,softmax和交叉熵结合之后求导,就是softmax之后的结果减去对应的y值,由此进行反向传播。 https://blog.csdn.net/weixin_44750512/article/details/129185574 阅读全文
posted @ 2025-08-29 17:27 李大嘟嘟 阅读(4) 评论(0) 推荐(0)
摘要: https://zhuanlan.zhihu.com/p/56638625 阅读全文
posted @ 2025-08-29 17:18 李大嘟嘟 阅读(25) 评论(0) 推荐(0)
摘要: enumerate() 是 Python 中一个非常实用的内置函数,它用于在遍历一个可迭代对象(如列表、元组、字符串等)的同时,获取每个元素的索引和值。 为什么需要 enumerate()? 在没有 enumerate() 之前,如果你想同时获取索引和值,通常需要手动维护一个计数器: fruits 阅读全文
posted @ 2025-08-29 16:42 李大嘟嘟 阅读(6) 评论(0) 推荐(0)
摘要: https://zhuanlan.zhihu.com/p/168562182 这个更清楚些 https://blog.csdn.net/bitcarmanlee/article/details/82320853 def softmax(x): max_x = np.max(x, axis=-1, k 阅读全文
posted @ 2025-08-29 16:25 李大嘟嘟 阅读(6) 评论(0) 推荐(0)
摘要: 参考 https://zhuanlan.zhihu.com/p/155748813 https://www.birdpython.com/posts/5/22/ https://blog.csdn.net/bwqiang/article/details/110203835 阅读全文
posted @ 2025-08-28 15:57 李大嘟嘟 阅读(9) 评论(0) 推荐(0)
摘要: pip install matplotlib 阅读全文
posted @ 2025-08-28 15:54 李大嘟嘟 阅读(8) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 9 ··· 12 下一页