예제 #1
0
        private IAggregate GetMatrixStatsAggregate(JsonReader reader, JsonSerializer serializer)
        {
            reader.Read();
            var matrixStats = new MatrixStatsAggregate();
            var array       = JArray.Load(reader);

            matrixStats.Fields = array.ToObject <List <MatrixStatsField> >();
            return(matrixStats);
        }
예제 #2
0
        private IAggregate GetMatrixStatsAggregate(ref JsonReader reader, IJsonFormatterResolver formatterResolver, long?docCount = null)
        {
            var matrixStats = new MatrixStatsAggregate {
                DocCount = docCount
            };
            var matrixStatsListFormatter = formatterResolver.GetFormatter <List <MatrixStatsField> >();

            matrixStats.Fields = matrixStatsListFormatter.Deserialize(ref reader, formatterResolver);
            return(matrixStats);
        }
예제 #3
0
        private IAggregate GetMatrixStatsAggregate(ref JsonReader reader, IJsonFormatterResolver formatterResolver, IReadOnlyDictionary <string, object> meta,
                                                   long?docCount = null
                                                   )
        {
            var matrixStats = new MatrixStatsAggregate {
                DocCount = docCount.GetValueOrDefault(), Meta = meta
            };
            var matrixStatsListFormatter = formatterResolver.GetFormatter <List <MatrixStatsField> >();

            matrixStats.Fields = matrixStatsListFormatter.Deserialize(ref reader, formatterResolver);
            return(matrixStats);
        }
		private IAggregate GetMatrixStatsAggregate(JsonReader reader, JsonSerializer serializer)
		{
			reader.Read();
			var matrixStats = new MatrixStatsAggregate();
			var array = JArray.Load(reader);
			matrixStats.Fields = array.ToObject<List<MatrixStatsField>>();
			return matrixStats;
		}
		// hide
		private void AssertField(MatrixStatsAggregate aggregate, string name)
		{
			var stats = aggregate.Fields.FirstOrDefault(f => f.Name == name);
			stats.Should().NotBeNull();
			stats.Count.Should().NotBe(0);
			stats.Mean.Should().NotBe(0);
			stats.Variance.Should().NotBe(0);
			stats.Skewness.Should().NotBe(0);
			stats.Kurtosis.Should().NotBe(0);
			stats.Covariance.Should().NotBeNull().And.HaveCount(2);
			stats.Correlation.Should().NotBeNull().And.HaveCount(2);
		}