欢迎光临散文网 会员登陆 & 注册

dapp/defi智能合约LP流动性质押挖矿分红系统开发实现技术分析丨详细源码

2023-04-04 16:26 作者:bili_53879993861  | 我要投稿

  区块链(Blockchain)是指通过去中心化和去信任的方式集体维护一个可靠数据库的技术方案。该技术方案主要让参与系统中的任意多个节点,通过一串使用密码学方法相关联产生的数据块(block),每个数据块中包含了一定时间内的系统全部信息交流数据,并且生成数据指纹用于验证其信息的有效性和链接(chain)下一个数据库块。


  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.


  从技术角度分析,开发技术详细威:yy625019,区块链让数字资产价值流转的每一个节点都公开透明、有迹可循且不可篡改,这将会让Web3.0时代的一切交易变得更加真实可信。


  同时,数据通过区块链技术可以确定权属,实现数据的资产化,这也将使得区块链成为Web3.0时代的基础设施。


  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


  大致是从测试集中找到其中的训练部分和预测部分,repeat部分也都去掉了


  然后


  dtotal={“cq”:cq,“cc”:cc,“cr”:cr,“ct”:ct}是全部长度


  cur前缀的则只包括已知的部分:curcin,currin,curqin


  先来看累计预测的predict_each_group


  从预测部分的index开始循环.


  如果前缀部分超过Max_len,则都取后半部分


  dkt:


  y=model(cin.long(),rin.long())


  #print(y)


  pred=y[0][-1][cout.item()]


  同时,通过t进行迭代。为啥有两层循环呢?原文这里写的有点晦涩难懂了。


  第二层循环很短,t~end


  循环主要是预测的response会作为下一个的输入


  def get_cur_teststart(is_repeat,train_ratio):


  curl=len(is_repeat)


  #print(is_repeat)


  qlen=is_repeat.count(0)#其中不重复的长度


  qtrainlen=int(qlen*train_ratio)#已知的长度


  qtrainlen=1 if qtrainlen==0 else qtrainlen#保证已知长度至少大于0,否则输入为空


  qtrainlen=qtrainlen-1 if qtrainlen==qlen else qtrainlen#保证测试长度大于0,否则测试输入为空


  #get real concept len


  ctrainlen,qidx=0,0


  i=0


  while i<curl:


  if is_repeat<i>==0:


  qidx+=1#qidx是不重复的长度


  #print(f"i:{i},curl:{curl},qidx:{qidx},qtrainlen:{qtrainlen}")


  #qtrainlen=7 if qlen>7 else qtrainlen


  if qidx==qtrainlen:#如果已经到了设定的已知,那么退出


  break


  i+=1


  for j in range(i+1,curl):


  if is_repeat[j]==0:


  ctrainlen=j#找到response未知的部分,第一个不重复的作为预测起点?


  break


  return qlen,qtrainlen,ctrainlen


dapp/defi智能合约LP流动性质押挖矿分红系统开发实现技术分析丨详细源码的评论 (共 条)

分享到微博请遵守国家法律