protected override bool MoveNextCore() { if (!_input.MoveNext()) { return(false); } if (!_newGroupInInputCursorDel()) { return(true); } // If this is the first step, we need to move next on _groupCursor. Otherwise, the position of _groupCursor is // at the start of the next group. if (_groupCursor.State == CursorState.NotStarted) { // The two cursors should have the same number of elements, so if _input.MoveNext() returned true, // then it must return true here too. var good = _groupCursor.MoveNext() && _newGroupInGroupCursorDel(); Ch.Assert(good); } // Read the whole group from the auxiliary cursor. while (_groupCursor.State != CursorState.Done && !_newGroupInGroupCursorDel()) { TLabel label = default(TLabel); TScore score = default(TScore); _labelGetter(ref label); _scoreGetter(ref score); _parent.ProcessExample(_state, label, score); _groupCursor.MoveNext(); } _parent.UpdateState(_state); return(true); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Hole1,Hole2,Hole3,Hole4,Hole5,Hole6,Hole7,Hole8,Hole9,Hole10,Hole11,Hole12,Hole13,Hole14,Hole15,Hole16,Hole17,Hole18,Score,Created")] TScore tScore) { if (id != tScore.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(tScore); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TScoreExists(tScore.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(tScore)); }
public void Update(ref TScore score, float label, float weight, ref TMetrics loss) { SumWeights += weight; TotalLabelW += label * weight; TotalLabelSquaredW += label * label * weight; UpdateCore(label, in score, in loss, weight); }
public async Task <IActionResult> Create([Bind("Id,Hole1,Hole2,Hole3,Hole4,Hole5,Hole6,Hole7,Hole8,Hole9,Hole10,Hole11,Hole12,Hole13,Hole14,Hole15,Hole16,Hole17,Hole18,Score,Created")] TScore tScore) { if (ModelState.IsValid) { _context.Add(tScore); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(tScore)); }
public CacheItem(TScore value) { CachedValue = value; LastAccess = DateTime.Now; }
protected abstract bool IsNaN(ref TScore score);
protected abstract void ApplyLossFunction(ref TScore score, float label, ref TMetrics loss);
protected abstract void UpdateCore(float label, ref TScore score, ref TMetrics loss, float weight);