当前位置: 首页>>代码示例>>C#>>正文


C# Set.addAll方法代码示例

本文整理汇总了C#中Set.addAll方法的典型用法代码示例。如果您正苦于以下问题:C# Set.addAll方法的具体用法?C# Set.addAll怎么用?C# Set.addAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Set的用法示例。


在下文中一共展示了Set.addAll方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: getMarkovBlanket

        public Set<Node> getMarkovBlanket()
        {
            Set<Node> mb = new Set<Node>();
            // Given its parents,
            mb.addAll(getParents());
            // children,
            mb.addAll(getChildren());
            // and children's parents
            foreach (Node cn in getChildren())
            {
                mb.addAll(cn.getParents());
            }

            return mb;
        }
开发者ID:PaulMineau,项目名称:AIMA.Net,代码行数:15,代码来源:AbstractNode.cs

示例2: DynamicBayesNet

        public DynamicBayesNet(BayesianNetwork priorNetwork,
                               Map<RandomVariable, RandomVariable> X_0_to_X_1,
                               Set<RandomVariable> E_1, params Node[] rootNodes)
            : base(rootNodes)
        {


            foreach (RandomVariable rv in X_0_to_X_1.keySet()
                )
            {
                RandomVariable x0 = rv;
                RandomVariable x1 = X_0_to_X_1[rv];
                this.X_0.add(x0);
                this.X_1.add(x1);
                this.X_0_to_X_1.put(x0, x1);
                this.X_1_to_X_0.put(x1, x0);
            }
            this.E_1.addAll(new List<RandomVariable>(E_1));

            // Assert the X_0, X_1, and E_1 sets are of expected sizes
            Set<RandomVariable> combined = new Set<RandomVariable>();
            combined.addAll(new List<RandomVariable>(X_0));
            combined.addAll(new List<RandomVariable>(X_1));
            combined.addAll(new List<RandomVariable>(E_1));
            if (
                SetOps.difference(new List<RandomVariable>(varToNodeMap.keySet()), new List<RandomVariable>(combined)).
                    Count != 0)
            {
                throw new IllegalArgumentException(
                    "X_0, X_1, and E_1 do not map correctly to the Nodes describing this Dynamic Bayesian Network.");
            }
            this.priorNetwork = priorNetwork;

            X_1_VariablesInTopologicalOrder
                .AddRange(getVariablesInTopologicalOrder());
            X_1_VariablesInTopologicalOrder.RemoveAll(X_0);
            X_1_VariablesInTopologicalOrder.RemoveAll(E_1);
        }
开发者ID:PaulMineau,项目名称:AIMA.Net,代码行数:38,代码来源:DynamicBayesNet.cs

示例3: calculateVariables

        // END-BayesInference
        //

        //
        // PROTECTED METHODS
        //
        /**
         * <b>Note:</b>Override this method for a more efficient implementation as
         * outlined in AIMA3e pgs. 527-28. Calculate the hidden variables from the
         * Bayesian Network. The default implementation does not perform any of
         * these.<br>
         * <br>
         * Two calcuations to be performed here in order to optimize iteration over
         * the Bayesian Network:<br>
         * 1. Calculate the hidden variables to be enumerated over. An optimization
         * (AIMA3e pg. 528) is to remove 'every variable that is not an ancestor of
         * a query variable or evidence variable as it is irrelevant to the query'
         * (i.e. sums to 1). 2. The subset of variables from the Bayesian Network to
         * be retained after irrelevant hidden variables have been removed.
         * 
         * @param X
         *            the query variables.
         * @param e
         *            observed values for variables E.
         * @param bn
         *            a Bayes net with variables {X} &cup; E &cup; Y /* Y = hidden
         *            variables //
         * @param hidden
         *            to be populated with the relevant hidden variables Y.
         * @param bnVARS
         *            to be populated with the subset of the random variables
         *            comprising the Bayesian Network with any irrelevant hidden
         *            variables removed.
         */

        protected void calculateVariables(RandomVariable[] X,
                                          AssignmentProposition[] e, BayesianNetwork bn,
                                          Set<RandomVariable> hidden, List<RandomVariable> bnVARS)
        {

            bnVARS.AddRange(bn.getVariablesInTopologicalOrder());
            hidden.addAll(bnVARS);

            foreach (RandomVariable x in X)
            {
                hidden.remove(x);
            }
            foreach (AssignmentProposition ap in e)
            {
                hidden.removeAll(ap.getScope());
            }

            return;
        }
开发者ID:PaulMineau,项目名称:AIMA.Net,代码行数:54,代码来源:EliminationAsk.cs


注:本文中的Set.addAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。