sampleattribute.cs

来自「It s the Naive Bayes algorithm with impo」· CS 代码 · 共 57 行

CS
57
字号
using System;
using System.Collections;
using System.Text;

namespace NaiveBayes
{
    class SampleAttribute
    {
        protected ArrayList values = new ArrayList();
        protected ArrayList digitizedValues = new ArrayList();
        
        protected ArrayList digitizedTypes = new ArrayList();
        protected ArrayList valueTypes = new ArrayList();

        protected enum Type { real_, char_, bool_ };
        protected Type type;

        public SampleAttribute(ArrayList values)
        {
            this.values = values;
            initializeValueTypes();
            foreach (string value in this.values)
            {
                if (!this.valueTypes.Contains(value))
                    this.valueTypes.Add(value);
            }
        }

        public void initializeValueTypes()
        {
            foreach (string value in this.values)
            {
                if (!this.valueTypes.Contains(value))
                    this.valueTypes.Add(value);
            }
        }

        //----------------------------------------------------------------------------------------------------------------
        public ArrayList getValues()
        {
            return this.values;
        }
        public ArrayList getValueTypes()
        {
            return this.valueTypes;
        }
        public ArrayList getDigitizedValues()
        {
            return this.digitizedValues;
        }
        public ArrayList getDigitizedTypes()
        {
            return this.digitizedTypes;
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?