Example #1
0
        public static ValueType[] CropValuesEnd <ValueType>(ValueType[] array, ValueType crop_value)
        {
            int index_last_non_value = -1;

            for (int index = 0; index < array.Length; index++)
            {
                if (!array[index].Equals(crop_value))
                {
                    index_last_non_value = index;
                }
            }
            return(ToolsCollection.Select(array, 0, index_last_non_value + 1));
        }
Example #2
0
        public static int[] CropZerosEnd(int[] array)
        {
            int index_last_non_zero = -1;

            for (int index = 0; index < array.Length; index++)
            {
                if (array[index] != 0)
                {
                    index_last_non_zero = index;
                }
            }
            return(ToolsCollection.Select(array, 0, index_last_non_zero + 1));
        }
Example #3
0
        public float[] back_propagate(float[] out_error)
        {
            //only use after forward signal has been processed
            //store local copy of the output error
            d_output_error = ToolsCollection.Select(out_error, 0, d_output_size);     //will remove bias of next layer

            //calculate and store activation error
            for (int o = 0; o < d_output_size; o++)
            {
                activation_error[o] = d_output_function_derivative.Compute((float)d_activation[o]) * d_output_error[o];
            }

            //calculate and store the input error
            ToolsCollection.SetValue(input_error, 0);
            for (int i = 0; i < d_input_size; i++)
            {
                for (int o = 0; o < d_output_size; o++)
                {
                    input_error[i] += activation_error[o] * d_weights[o, i];
                }
            }
            //and return signal to be processed by previous layers
            return(input_error);
        }
        public void TestCreateMedium()
        {
            PriceSet          price_set           = new PriceSet(ToolsPrice.DefaultSymbolGBPUSD, ToolsCollection.Select(ToolsPrice.GetPriceList(ToolsPrice.DefaultSymbolGBPUSD), 0, 40));
            List <IIndicator> indicators_features = new List <IIndicator>();

            indicators_features.Add(new IndicatorRunningAverage(0));
            indicators_features.Add(new IndicatorRunningAverage(1));
            List <IIndicator> indicators_labels = new List <IIndicator>();

            indicators_labels.Add(new IndicatorMagicProfit(0));
            indicators_labels.Add(new IndicatorMagicProfit(1));
            MarketModelSimulation     market  = new MarketModelSimulation(1000, price_set);
            IDataSet <double, double> dataset = ToolsTradingDataSet.CreateDataSet(market, new IndicatorFusion(indicators_features), new IndicatorFusion(indicators_labels));

            Assert.AreEqual(39, dataset.InstanceCount);
            Assert.AreEqual(2, dataset.FeatureCount);
            Assert.AreEqual(4, dataset.LabelCount);
        }
 public override LabelType GetLabel(DomainType[] instance_features)
 {
     return(model.GetLabel(ToolsCollection.Select(instance_features, selected_feature_indexes)));
 }