dapp/defi智能合約LP流動(dòng)性質(zhì)押挖礦分紅系統(tǒng)開發(fā)實(shí)現(xiàn)技術(shù)分析丨詳細(xì)源碼
區(qū)塊鏈(Blockchain)是指通過去中心化和去信任的方式集體維護(hù)一個(gè)可靠數(shù)據(jù)庫的技術(shù)方案。該技術(shù)方案主要讓參與系統(tǒng)中的任意多個(gè)節(jié)點(diǎn),通過一串使用密碼學(xué)方法相關(guān)聯(lián)產(chǎn)生的數(shù)據(jù)塊(block),每個(gè)數(shù)據(jù)塊中包含了一定時(shí)間內(nèi)的系統(tǒng)全部信息交流數(shù)據(jù),并且生成數(shù)據(jù)指紋用于驗(yàn)證其信息的有效性和鏈接(chain)下一個(gè)數(shù)據(jù)庫塊。
The blockchain+model is a subversion of the Internet plus model.Blockchain will greatly improve the quality,speed,and scale of human socio-economic activities,accelerating the evolution of civilization.If the result of the"Internet plus+traditional industry"model is a monopoly and centralized management industry giant,then the"blockchain+traditional industry"model is to build a new industry ecosystem.Compared with the Internet plus model,the decentralized blockchain+model will greatly improve the quality,speed and scale of human social life and accelerate the evolution of civilization.
從技術(shù)角度分析,開發(fā)技術(shù)詳細(xì)威:yy625019,區(qū)塊鏈讓數(shù)字資產(chǎn)價(jià)值流轉(zhuǎn)的每一個(gè)節(jié)點(diǎn)都公開透明、有跡可循且不可篡改,這將會(huì)讓W(xué)eb3.0時(shí)代的一切交易變得更加真實(shí)可信。
同時(shí),數(shù)據(jù)通過區(qū)塊鏈技術(shù)可以確定權(quán)屬,實(shí)現(xiàn)數(shù)據(jù)的資產(chǎn)化,這也將使得區(qū)塊鏈成為Web3.0時(shí)代的基礎(chǔ)設(shè)施。
python wandb_eval.py--use_wandb=0--train_ratio=0.5--test_filename=pykt_test.csv--save_dir="{save_dir}"
def load_model(model_name,model_config,data_config,emb_type,ckpt_path):
model=init_model(model_name,model_config,data_config,emb_type)
net=torch.load(os.path.join(ckpt_path,emb_type+"_model.ckpt"))
model.load_state_dict(net)
return model
testf=os.path.join(data_config["dpath"],params["test_filename"])
其中的get_cur_teststart
大致是從測(cè)試集中找到其中的訓(xùn)練部分和預(yù)測(cè)部分,repeat部分也都去掉了
然后
dtotal={“cq”:cq,“cc”:cc,“cr”:cr,“ct”:ct}是全部長度
cur前綴的則只包括已知的部分:curcin,currin,curqin
先來看累計(jì)預(yù)測(cè)的predict_each_group
從預(yù)測(cè)部分的index開始循環(huán).
如果前綴部分超過Max_len,則都取后半部分
dkt:
y=model(cin.long(),rin.long())
#print(y)
pred=y[0][-1][cout.item()]
同時(shí),通過t進(jìn)行迭代。為啥有兩層循環(huán)呢?原文這里寫的有點(diǎn)晦澀難懂了。
第二層循環(huán)很短,t~end
循環(huán)主要是預(yù)測(cè)的response會(huì)作為下一個(gè)的輸入
def get_cur_teststart(is_repeat,train_ratio):
curl=len(is_repeat)
#print(is_repeat)
qlen=is_repeat.count(0)#其中不重復(fù)的長度
qtrainlen=int(qlen*train_ratio)#已知的長度
qtrainlen=1 if qtrainlen==0 else qtrainlen#保證已知長度至少大于0,否則輸入為空
qtrainlen=qtrainlen-1 if qtrainlen==qlen else qtrainlen#保證測(cè)試長度大于0,否則測(cè)試輸入為空
#get real concept len
ctrainlen,qidx=0,0
i=0
while i<curl:
if is_repeat<i>==0:
qidx+=1#qidx是不重復(fù)的長度
#print(f"i:{i},curl:{curl},qidx:{qidx},qtrainlen:{qtrainlen}")
#qtrainlen=7 if qlen>7 else qtrainlen
if qidx==qtrainlen:#如果已經(jīng)到了設(shè)定的已知,那么退出
break
i+=1
for j in range(i+1,curl):
if is_repeat[j]==0:
ctrainlen=j#找到response未知的部分,第一個(gè)不重復(fù)的作為預(yù)測(cè)起點(diǎn)?
break
return qlen,qtrainlen,ctrainlen