<commit_before>package io.prediction.examples.friendrecommendation


import io.prediction.controller.Evaluator
case class Actual(
  val acceptance : Int
)extends Serializable{
  override def toString = s"[${acceptance}]"
}

class EvaluatorUnit (
  val q: FriendRecommendationQuery,
  val p: FriendRecommendationPrediction,
  val a: Actual,
  val score: Double
) extends Serializable

class FriendRecEvaluator extends Evaluator[EmptyParam,FriendRecommendationQuery,FriendRecommendationPrediction,Actual, EvaluatorUnit, Double, Double]{
  override def evaluateUnit(query: FriendRecommendationQuery, prediction: FriendRecommendationPrediction,actual:Actual):EvaluatorUnit = {
    val score: Double = {
      if(actual.acceptance == 0)
        -prediction.confidenceScore
      else
        prediction.confidenceScore
    }
    new EvaluatorUnit(
      q = query,
      p = prediction,
      a = actual,
      score = score
    )
  }


  override def evaluateSet(s: Seq[EvaluatorUnit]):Double = {
    val sum_value : Double = s.map(x => x.score).sum
    sum_value / s.size
  }

  override def evaluateAll(d: Double): Double = {
    d
  }
}<commit_msg>fixed, still need to fix conform params error<commit_after>package io.prediction.examples.friendrecommendation


import io.prediction.controller._
case class Actual(
  val acceptance : Int
)extends Serializable{
  override def toString = s"[${acceptance}]"
}

class EvaluatorUnit (
  val q: FriendRecommendationQuery,
  val p: FriendRecommendationPrediction,
  val a: Actual,
  val score: Double
) extends Serializable

class FriendRecommendationEvaluator extends Evaluator[EmptyParams,EmptyParams, FriendRecommendationQuery,FriendRecommendationPrediction,Actual, EvaluatorUnit, Double, Double]{
  override def evaluateUnit(query: FriendRecommendationQuery, prediction: FriendRecommendationPrediction,actual:Actual):EvaluatorUnit = {
    val score: Double = {
      if(actual.acceptance == 0)
        -prediction.confidence
      else
        prediction.confidence
    }
    new EvaluatorUnit(
      q = query,
      p = prediction,
      a = actual,
      score = score
    )
  }

  def evaluateAll(input: Seq[(EmptyParams, Double)]): Double = {
    input.head._2
  }
  def evaluateSet(dataParams: EmptyParams,evaluationUnits: Seq[EvaluatorUnit]): Double = 
  {
    val sum_value : Double = evaluationUnits.map(x => x.score).sum
    sum_value / evaluationUnits.size
  }

}
{'fraction_non_alphanumeric': 0.0871900826446281, 'fraction_numerical': 0.0012396694214876034, 'mean_word_length': 4.04375, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1469180', 'n_tokens_mistral': 752, 'n_tokens_neox': 722, 'n_words': 169}