public void InDependent()
        {
            IDictionary <string, Stats> actual = target.Select(new Dictionary <string, Stats> {
                { "test", new Stats {
                      N00 = 25, N10 = 14, N11 = 36, N01 = 30, N = 105
                  } }
            });

            Assert.IsFalse(actual.Any());
        }
Beispiel #2
0
        /// <summary>
        /// Primary generation method. Summary:
        ///
        /// 1. Gather feature list (stubbed for now)
        /// 2. Generate starting room
        /// 3. If ending condition is met, goto 10. Else continue.
        /// 4. Select next Feature.
        /// 5. Select next position.
        /// 6. Compute all valid configurations.
        /// 7. Select next configuration.
        /// 8. Add all the Sections of the configured Feature.
        /// 9. Goto 3.
        /// 10. Done.
        /// </summary>
        private void Generate()
        {
            // Temporary: feature list
            Feature basicFeature = new Feature();

            // TODO I don't think this works properly with connections specified.
            basicFeature.Add(new Vector2Int(0, 0), Connection.All, externalConnections: Connection.All);

            Feature[] featureList = { basicFeature };

            // Initialize with a single starting room
            // Later, this can be e.g. a specific starting chamber.
            grid[0, 0] = Section.Default();

            // Pick some ending condition. For now it's just "try 100 times".
            int count = 0;

            while (count++ < 100)
            {
                Feature nextFeature = featureSelector.Select(featureList);
                if (nextFeature == null)
                {
                    Debug.Log("Failed to get valid Feature.");
                    continue;
                }

                Vector2Int nextPosition = positionSelector.Select(new ReadOnlyGrid(grid));

                // Get all valid placements
                List <Feature.Configuration> configurations = nextFeature.CanConnect(new ReadOnlyGrid(grid), nextPosition);

                if (configurations.Count == 0)
                {
                    Debug.Log("Failed to find valid configuration at position: " + nextPosition);
                    continue;
                }

                // Choose one of those placements
                Feature.Configuration configuration = configurationSelector.Select(configurations.ToArray());

                // Add that Feature in
                Dictionary <Vector2Int, Section> toAdd = nextFeature.GetConfiguration(configuration);
                foreach (KeyValuePair <Vector2Int, Section> pair in toAdd)
                {
                    grid[pair.Key] = pair.Value;
                }
            }
        }
Beispiel #3
0
        // Extract data with the given generic criteria
        public void Extract( 
            ISampleSelector sampleSelector,
            IFeatureSelector featureSelector )
        {
            // TODO: Change to Q or Y data
            // Get the table of financial data
            Table<QLSample> qlSamples = dc.GetTable<QLSample>( );

            // copy the data to the list of training cases
            data = new ClassificationData( );
            foreach (QLSample sample in qlSamples)
            {
                // Apply the sample selection criteria
                if (sampleSelector.Select( sample ))
                {
                    // Apply the feature selection criteria
                    data.Samples.Add( featureSelector.Select( sample ) );
                }
            }
        }
Beispiel #4
0
        // Extract data with the given generic criteria
        public void Extract(
            ISampleSelector sampleSelector,
            IFeatureSelector featureSelector)
        {
            // TODO: Change to Q or Y data
            // Get the table of financial data
            Table <QLSample> qlSamples = dc.GetTable <QLSample>( );

            // copy the data to the list of training cases
            data = new ClassificationData( );
            foreach (QLSample sample in qlSamples)
            {
                // Apply the sample selection criteria
                if (sampleSelector.Select(sample))
                {
                    // Apply the feature selection criteria
                    data.Samples.Add(featureSelector.Select(sample));
                }
            }
        }