Demo entry 6352791

1

   

Submitted by anonymous on Mar 25, 2017 at 07:30
Language: Scala. Code size: 657 Bytes.

 def getCurrentActionReward(
      action:Int, center:VectorWithNorm ,data: Array[VectorWithNorm],
      thisActiveCenters:Array[VectorWithNorm], rDist:Double, e:Double) :Double = {
   // var datas = data.collect()// Array[VectorWithNorm]   //牵涉到了RDD的嵌套
    var reward1 = 0.0; 
    var reward0 = 0.0
   
    if(dataECountArray(currentState) < e* getCenterECount(center, data, rDist)) {//稀疏 个数是越大越好
      reward1 = -1.0
      reward0 = 1.0
    } else {
      reward1 = 1.0
      reward0 = -1.0
    }
    
    if(action == 1) {
      currentReward = reward1
      reward1 
    } else {
      currentReward = reward0
      reward0
    }
}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).