targetattribute.cs

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

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

namespace NaiveBayes
{
    class TargetAttribute : SampleAttribute
    {
        public TargetAttribute(ArrayList values):
            base(values)
        {
            initializedigitizedValues();
            initializedigitizedTypes();
        }

        private void initializedigitizedValues()
        {
            this.digitizedValues = this.values.Clone() as ArrayList;
            for (int i = 0; i < this.values.Count; i++)
            {
                for (int j = 0; j < this.valueTypes.Count; j++)
                {
                    if (this.values[i].Equals(this.valueTypes[j]))
                        this.digitizedValues[i] = j;
                }
            }
        }

        private void initializedigitizedTypes()
        {
            foreach (int value in this.digitizedValues)
            {
                if (!this.digitizedTypes.Contains(value))
                    this.digitizedTypes.Add(value);
            }
        }
    }
}

⌨️ 快捷键说明

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