Esempio n. 1
0
        public BayesDecider( string fname, string outcomeName )
        {
            dataPath = Application.dataPath + "/Data/" + fname;

            outcomeAction = new BayesAction( outcomeName );

            ReadObsTab();
        }
Esempio n. 2
0
        public BayesDecider(string fname, string outcomeName)
        {
            dataPath = Application.dataPath + "/Data/" + fname;

            outcomeAction = new BayesAction(outcomeName);

            ReadObsTab();
        }
Esempio n. 3
0
        /*public BayesContinuousCondition( int[] sum, int[] sumSq )
         * {
         *      m_sum = sum;
         *      m_sumSq = sumSq;
         * }*/

        public void Init(BayesAction outcome)
        {
            int length = m_sum.Length;

            for (int i = 0; i < length; i++)
            {
                m_mean[i]   = Mean(m_sum[i], outcome.GetCounts()[i]);
                m_stdDev[i] = StdDev(m_sumSq[i], m_sum[i], outcome.GetCount(i));
            }
        }
Esempio n. 4
0
        /*public BayesContinuousCondition( int[] sum, int[] sumSq )
        {
            m_sum = sum;
            m_sumSq = sumSq;
        }*/
        public void Init( BayesAction outcome )
        {
            int length = m_sum.Length;

            for( int i = 0; i < length; i++ )
            {
                m_mean[ i ] = Mean( m_sum[ i ], outcome.GetCounts()[ i ] );
                m_stdDev[ i ] = StdDev( m_sumSq[ i ], m_sum[ i ], outcome.GetCount( i ) );
            }
        }
Esempio n. 5
0
        public void CalcProps(BayesAction outcome)
        {
            int[] n = outcome.GetCounts();

            for (int i = 0; i < m_counts.GetLength(0); i++)
            {
                for (int j = 0; j < m_counts.GetLength(1); j++)
                {
                    // Detects and corrects a 0 count by assigning a proportion
                    // that is 1/10 the size of a proportion for a count of 1
                    if (m_counts[i, j] == 0)
                    {
                        m_proportions[i, j] = 0.1d / n[j];                              // Can't have 0
                    }
                    else
                    {
                        m_proportions[i, j] = (double)m_counts[i, j] / n[j];
                    }
                }
            }
        }
Esempio n. 6
0
        public void CalcProps( BayesAction outcome )
        {
            int[] n = outcome.GetCounts();

            for (int i = 0; i < m_counts.GetLength( 0 ); i++ )
            {
                for( int j = 0; j < m_counts.GetLength( 1 ); j++ )
                {
                    // Detects and corrects a 0 count by assigning a proportion
                    // that is 1/10 the size of a proportion for a count of 1
                    if ( m_counts[ i, j ] == 0 )
                    {
                        m_proportions[ i, j ] = 0.1d / n[ j ];	// Can't have 0
                    }
                    else
                    {
                        m_proportions[ i, j ] = (double)m_counts[ i, j ] / n[ j ];
                    }
                }
            }
        }