Exemplo n.º 1
0
 private void Init()
 {
     this.fType            = EOptimizerType.Optimizer;
     this.fNParamSubset    = 0;
     this.fNObjectiveCalls = 0;
     this.fVerboseMode     = EVerboseMode.Quiet;
     this.fLastObjective   = 0.0;
 }
Exemplo n.º 2
0
        public void InitNetwork(ECostType costType, CostSettings costSettings, EOptimizerType optimizerType, OptimizerSettings optimizerSettings)
        {
            Utility.Dims InShape;
            Utility.Dims OutShape;
            Utility.Dims WShape;

            for (int i = 1; i < Layers.Count; i++)
            {
                Data.Data["a" + i.ToString()] = new Matrix(Layers[i].NCount, 1);
                InShape = new Utility.Dims(Layers[i].NCount, 1);

                Data.Data["b" + i.ToString()] = Matrix.RandomMatrix(Layers[i].NCount, 1, 1, EDistrubution.Gaussian);

                OutShape = new Utility.Dims(Layers[i].NCount, 1);

                Data.Data["W" + i.ToString()] = Matrix.RandomMatrix(Layers[i - 1].NCount, Layers[i].NCount, 1, EDistrubution.Gaussian);
                WShape = new Utility.Dims(Layers[i - 1].NCount, Layers[i].NCount);

                Layers[i].SetSettings(new LayerSettings(InShape, OutShape, WShape));
            }

            Data.Data["a0"] = new Matrix(Layers[0].NCount, 1);
            InShape         = new Utility.Dims(Layers[0].NCount, 1);

            Data.Data["b0"] = new Matrix(Layers[0].NCount, 1);
            OutShape        = new Utility.Dims(Layers[0].NCount, 1);

            Data.Data["W0"] = new Matrix(Layers[0].NCount * Layers[1].NCount, Layers[1].NCount);
            WShape          = new Utility.Dims(Layers[0].NCount * Layers[1].NCount, Layers[1].NCount);

            Layers[0].SetSettings(new LayerSettings(InShape, OutShape, WShape));

            switch (costType)
            {
            case ECostType.Invalid:
                throw new ArgumentException("Invalid Cost Function Selected!");

            case ECostType.CrossEntropyCost:
                CostFunction = new CrossEntropyCost((CrossEntropyCostSettings)costSettings);
                break;

            case ECostType.ExponentionalCost:
                CostFunction = new ExponentionalCost((ExponentionalCostSettings)costSettings);
                break;

            case ECostType.GeneralizedKullbackLeiblerDivergence:
                CostFunction = new GeneralizedKullbackLeiblerDivergence((GeneralizedKullbackLeiblerDivergenceSettings)costSettings);
                break;

            case ECostType.HellingerDistance:
                CostFunction = new HellingerDistance((HellingerDistanceSettings)costSettings);
                break;

            case ECostType.ItakuraSaitoDistance:
                CostFunction = new ItakuraSaitoDistance((ItakuraSaitoDistanceSettings)costSettings);
                break;

            case ECostType.KullbackLeiblerDivergence:
                CostFunction = new KullbackLeiblerDivergence((KullbackLeiblerDivergenceSettings)costSettings);
                break;

            case ECostType.QuadraticCost:
                CostFunction = new QuadraticCost((QuadraticCostSettings)costSettings);
                break;

            default:
                throw new ArgumentException("Invalid Cost Function Selected!");
            }

            switch (optimizerType)
            {
            case EOptimizerType.Invalid:
                throw new ArgumentException("Invalid Optimizer Function Selected!");

            case EOptimizerType.AdaDelta:
                OptimizerFunction = new AdaDelta((AdaDeltaSettings)optimizerSettings);
                break;

            case EOptimizerType.AdaGrad:
                OptimizerFunction = new AdaGrad((AdaGradSettings)optimizerSettings);
                break;

            case EOptimizerType.Adam:
                OptimizerFunction = new Adam((AdamSettings)optimizerSettings);
                break;

            case EOptimizerType.Adamax:
                OptimizerFunction = new Adamax((AdamaxSettings)optimizerSettings);
                break;

            case EOptimizerType.GradientDescent:
                OptimizerFunction = new GradientDescent((GradientDescentSettings)optimizerSettings);
                break;

            case EOptimizerType.Momentum:
                OptimizerFunction = new Momentum((MomentumSettings)optimizerSettings);
                break;

            case EOptimizerType.Nadam:
                OptimizerFunction = new Nadam((NadamSettings)optimizerSettings);
                break;

            case EOptimizerType.NesterovMomentum:
                OptimizerFunction = new NesterovMomentum((NesterovMomentumSettings)optimizerSettings);
                break;

            case EOptimizerType.RMSProp:
                OptimizerFunction = new RMSProp((RMSPropSettings)optimizerSettings);
                break;

            default:
                throw new ArgumentException("Invalid Optimizer Function Selected!");
            }
        }
Exemplo n.º 3
0
		protected MetaStrategyBase(string name)
		{
			this.name = name;
			this.strategies = new StrategyList();
			this.SimulationManager = StrategyComponentManager.GetComponent("GetComponent", (object)this) as SimulationManager;
			this.OptimizationManager = StrategyComponentManager.GetComponent("GetComponent", (object)this) as OptimizationManager;
			this.ReportManager = StrategyComponentManager.GetComponent("GetComponent", (object)this) as ReportManager;
			this.MetaMoneyManager = StrategyComponentManager.GetComponent("GetComponent", (object)this) as MetaMoneyManager;
			this.portfolio = PortfolioManager.Portfolios[name];
			if (this.portfolio == null)
				this.portfolio = new Portfolio(name);
			this.resetPortfolio = true;
			this.tester = new LiveTester(this.portfolio);
			this.tester.FollowChanges = true;
			this.optimizer = (Optimizer)new BruteForce((IOptimizable)this);
			this.optimizer.BestObjectiveReceived += new EventHandler(this.OnBestObjectiveReceived);
			this.optimizerType = EOptimizerType.BruteForce;
//      this.wufWtLkISI = new J8EmIiFmOtaja37OfO(this);
//      this.ftRWdJyyOv = new cLHjLO4PpuI7TxofSw(this);
//      this.XY4Ww3QE51 = new TGZcynM7UfxwdxKdmx(this);
//      this.J37WmrcrSi = new FZ0WAbPUwn6OHn5Upr(this);
//      this.zVLWf0C4Mc = new ALxag60bMZlMBTZjqL(this);
			this.wH2We9sYJA = new Dictionary<IProvider, List<StrategyBase>>();
			this.vXRWgwkIPm = new Dictionary<IMarketDataProvider, Dictionary<Instrument, List<StrategyBase>>>();
			this.DKMWNa8OX5 = new Dictionary<SingleOrder, StrategyBase>();
			this.sbiWzb0PxN = new Dictionary<IService, List<StrategyBase>>();
			this.EdxRkK8EdT = new Dictionary<IExecutionService, List<StrategyBase>>();
			this.maxConnectionTime = 10;
			this.simulator = (ProviderManager.MarketDataSimulator as SimulationDataProvider).Simulator;
			this.simulator.StateChanged += new EventHandler(this.md8Wiw2OiW);
			this.isRunning = false;
			this.isOptimizing = false;
			this.optimizationParemeters = new ArrayList();
			this.drawingPrimitives = new Hashtable();
			this.portfolioStopList = new StopList();
			this.portfolios = new Dictionary<Instrument, Portfolio>();
			this.testers = new Dictionary<Instrument, LiveTester>();
			this.executionServicesEnabled = false;
			this.componentTypeList = new List<ComponentType>();
			this.componentTypeList.Add(ComponentType.SimulationManager);
			this.componentTypeList.Add(ComponentType.MetaMoneyManager);
			this.componentTypeList.Add(ComponentType.OptimizationManager);
			this.componentTypeList.Add(ComponentType.ReportManager);
		}
Exemplo n.º 4
0
		private void Init()
		{
			this.fType = EOptimizerType.Optimizer;
			this.fNParamSubset = 0;
			this.fNObjectiveCalls = 0;
			this.fVerboseMode = EVerboseMode.Quiet;
			this.fLastObjective = 0.0;
		}