Warrior_EA/Expert/OnlineLearning/AIBaseOnlineLearningView.mqh
AnimateDread 1baa13c5b4 refactor(meta): remove meta-labeling entirely - RETRAIN-NEUTRAL
~2,300 lines. META had real, repeatedly measured ranking skill and ZERO
operating points that ever cleared break-even (0/350 H1 eras, 1/999 H4
pre-2-sigma, 0/8 pooled fitted points). The clinching arithmetic was edge x
width = 0.095 ATR/trade against spread 0.099 ATR/trade, and the
dose-response showed the high-conviction tail is temporally unstable -
the precision-vs-threshold slope flips sign between calib and test on 3 of
4 symbols, so no ex-ante threshold rule exists. It shipped default-off and
never gated a live entry. The self-measured tier weights are what actually
rank the vote, and all six H4 instruments converged on them alone.

RETRAIN-NEUTRAL, and that is the property that made this safe:

  - The weights fingerprint emitted "|TGT:META2" or "|TGT:SWG1" from an
    if/else. Every direction model already took the SWG1 arm, so
    collapsing it to an unconditional append is byte-identical. No .nnw or
    .cfg is orphaned or re-keyed.
  - NetInputWidth() lost its "+ MetaDescWidth()" term. MetaDescWidth()
    returned 0 for every direction model, so the input layer is unchanged.
  - DbLegacyAiSlot()'s slot 5 was reachable only with all four Use_* NNs
    off AND meta on - a config that never shipped. Every existing .db keeps
    its filename.

Deleted outright: Signals/SignalMETA.mqh, Expert/Trading/MetaGate.mqh (the
directory is now empty), Expert/Training/{MetaCorpus,MetaCandidateStore,
MetaFamilies}.mqh, Tests/Test_MetaFamilies.mq5, Meta_Labeling_Design.md.

Unwound in place, the delicate part: Training.mqh carried four
IsMetaTarget() branches whose else-arm WRAPPED the direction body (pass 1
queueing, pass 2 backprop, pass 2.5 calibration, pass 3 OOS scoring). Each
wrapper is removed and the direction body promoted back to its original
nesting - the bodies were never re-indented when the wrappers were added,
so the promoted code is byte-identical to what ran before META existed.
Also gone: the ensemble verdict's meta-veto replay and its
approved/vetoed/unscored counters, the per-family/per-side OOS
decomposition arrays, the m_isTrainQueueCand parallel queue and its
lockstep shuffle, and the S2 era report.

Also removed: the CMetaGate abstraction and the live CheckOpenPosition
veto; m_gates plus AddFilter's non-voter routing and IsVotingSignal()
(META was the only non-voting child, so m_gates was always empty);
m_parentSignal/SetParentSignal (existed only to reach the root's gate);
SweepPrepare/SweepPrepareIndicator (only caller was the corpus sweep);
IsMetaTarget() from all four view interfaces and their adapters;
Use_MetaLabeling, EnableMETA, Meta_ExportDataset, m_trainTarget.

EvalShift is KEPT - HistoricalNetVote() uses it for the filtered overlay,
not just the corpus sweep; only its comment changed. The 2-output softmax
arm in NetForward.mqh is kept too: it costs nothing and is the reusable
binary-head path, now commented as unclaimed rather than as META's.

Compile-verified in _claude_stage: 0 errors, 0 warnings, matching the
pre-edit baseline.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-25 09:44:52 -04:00

78 lines
4.3 KiB
MQL5

//+------------------------------------------------------------------+
//| Warrior_EA |
//| AnimateDread |
//| |
//| CAIBaseOnlineLearningView - declarations only, bodies in |
//| AIBaseOnlineLearningViewImpl.mqh (needs the full signal declared).|
//| Same shape as Persistence\AIBasePersistenceView.mqh. |
//+------------------------------------------------------------------+
#ifndef WARRIOR_ONLINELEARNING_AIBASEONLINELEARNINGVIEW_MQH
#define WARRIOR_ONLINELEARNING_AIBASEONLINELEARNINGVIEW_MQH
#include "IOnlineLearningView.mqh"
class CExpertSignalAIBase;
class CAIBaseOnlineLearningView : public COnlineLearningView
{
private:
CExpertSignalAIBase *m_owner;
public:
CAIBaseOnlineLearningView(void) : m_owner(NULL) { }
void Bind(CExpertSignalAIBase *owner) { m_owner = owner; }
virtual string Id(void) override;
virtual string ActiveFileName(void) override;
virtual bool ActiveFileCommon(void) override;
virtual long EraCount(void) override;
virtual bool TrainingComplete(void) override;
virtual bool IsEnsembleMember(void) override;
virtual double ErrorPct(void) override;
virtual double UndefinePct(void) override;
virtual double Forecast(void) override;
virtual datetime StudiedTime(void) override;
virtual CNet *NetPtr(void) override;
virtual CArrayDouble *TempData(void) override;
virtual int OutputNeurons(void) override;
virtual bool BuildFeatureWindow(const int bar) override;
virtual double ApplyClassificationSoftmax(void) override;
virtual double AdjustedSignalFromSoftmax(void) override;
virtual ENUM_SIGNAL SignalFromValue(const double v) override;
virtual ENUM_SIGNAL BarLabel(const int bar) override;
virtual int LabelResolveAge(const int bar) override;
virtual bool HasLabel(const int bar) override;
virtual bool IsBuyLabel(const int bar) override;
virtual bool IsSellLabel(const int bar) override;
virtual int HistoryBars(void) override;
virtual int CalibPurgeBars(void) override;
virtual int CalibLoIndex(const int oosCutoff) override;
virtual int CalibHiIndex(const int totalIter, const int oosCutoff) override;
virtual int CalibBandBars(const int totalIter, const int oosCutoff) override;
virtual double PriorBuy(void) override;
virtual double PriorSell(void) override;
virtual double PriorNeutral(void) override;
virtual bool InferenceOnly(void) override;
virtual bool TrainRunActive(void) override;
virtual bool TrainingStopRequested(void) override;
virtual bool TrainingPaused(void) override;
virtual int AvailableBars(void) override;
virtual int ServableBars(const int want, const string context) override;
virtual bool ResizeBuffers(const int barIndex) override;
virtual bool RefreshData(void) override;
virtual bool EnsureBarCachesCapacity(const int bars) override;
virtual datetime BarTime(const int idx) override;
virtual double CloseAt(const int idx) override;
virtual double AtrAt(const int idx) override;
virtual double SpreadPrice(void) override;
virtual string FilterId(void) override;
virtual int ConfidenceTierNow(void) override;
virtual double PatternWeightForTier(const int tier) override;
virtual string PatternTableName(const string filterId, const string pattern, const string direction) override;
virtual void RegisterSignalRow(int year, int month, int day, int DOW, int hour, int minutes,
string tableName, string pattern, string direction,
double entryPrice, double exitPrice, string result, double netVote) override;
virtual double PrevSignal(void) override;
virtual void SetPrevSignal(const double v) override;
virtual bool SaveModelStatsNow(void) override;
virtual void FlattenIndicatorParams(double &ip[]) override;
virtual double ModelEta(void) override;
};
#endif // WARRIOR_ONLINELEARNING_AIBASEONLINELEARNINGVIEW_MQH
//+------------------------------------------------------------------+