August 2018
Beginner
334 pages
10h 19m
English
The classifier we'll build won't take long, just five steps:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class NaiveBayesClassifier : MonoBehaviour
{
public int numAttributes;
public int numExamplesPositive;
public int numExamplesNegative;
public List<bool> attrCountPositive;
public List<bool> attrCountNegative;
}
void Awake()
{
attrCountPositive = new List<bool>();
attrCountNegative = new List<bool>();
}
public void UpdateClassifier(bool[] attributes, NBCLabel label) { if (label == NBCLabel.POSITIVE) { numExamplesPositive++; attrCountPositive.AddRange(attributes); ...Read now
Unlock full access