原创 函數分類大PK:Sigmoid和Softmax,分別怎麼用?

https://baijiahao.baidu.com/s?id=1636737136973859154&wfr=spider&for=pc

原创 python 緩存 lru_cache

感受一下 import time from functools import lru_cache @lru_cache(maxsize=None) def fib(n): if n <2: return n

原创 go-多態和接口

package polymorphic import ( "fmt" "testing" ) type Code string // type定義新的類型, 別名 type Programmer interface { /

原创 跳臺階 & 變態跳臺階

跳臺階: 一隻青蛙一次可以跳上1級臺階,也可以跳上2級。求該青蛙跳上一個n級的臺階總共有多少種跳法(先後次序不同算不同的結果)。 import time class Solution: def jumpFloor(self,

原创 progressbar python

看起來還行

原创 go-錯誤機制

package error import ( "errors" "fmt" "testing" ) var LessThanTwoError = errors.New("n should be not less than

原创 鏈表中倒數第k個節點 & 反轉鏈表 & 合併兩個排序鏈表 & 兩個鏈表的第一個公共節點 & 鏈表中環的入口節點 & 刪除鏈表中的重複元素 & 複雜鏈表的複製

逐漸成爲靈魂畫手[doge]。。 複習鏈表: 鏈表中倒數第k個節點 class Solution: def FindKthToTail(self, head, k): # write code here,

原创 [轉]argparse --- 命令行選項、參數和子命令解析器

argparse --- 命令行選項、參數和子命令解析器 Python-argparse-命令行與參數解析 https://wiki.jikexueyuan.com/project/explore-python/Standard-Modu

原创 維特比 decode 算法 - 矩陣計算

def viterbi_decode(self, text): """ :param text: 一段文本string :return: 最可能的隱狀態路徑 """

原创 np.sum() 用法 & np.log() 用法 & np.expand_dims() 用法

import numpy as np # axis = 0表示對最外層[]裏的最大單位塊做塊與塊之間的運算,同時移除最外層[]: a = np.array([1, 2, 3]) print(a.sum(axis=0)) """ 6

原创 基本用法 *args和**kwargs

# https://blog.csdn.net/seasermy/article/details/102696096 python中運算符*和**的作用-參數傳遞 def pack(a, *b): print(type(a)

原创 go-擴展與複用

package extension import ( "fmt" "testing" ) type Pet struct{ } func (p *Pet) Speak() { fmt.Print("...") } fu

原创 go-行爲定義和實現

package obj import ( "fmt" "testing" "unsafe" ) // 數據的定義 type Employee struct{ Id string Name string Age int }

原创 go-panic和recover

package panic_revocer import ( "errors" "fmt" "testing" ) func TestPanicVxExit(t *testing.T){ defer func(){