November 2018
Beginner to intermediate
348 pages
8h 32m
English
Before we continue to build our classifier, let's imagine what the main function will look as follows. It will look something similar to this:
unc main() { examples, err := ingest("bare") log.Printf("Examples loaded: %d, Errors: %v", len(examples), err) shuffle(examples) if len(examples) == 0 { log.Fatal("Cannot proceed: no training examples") } // create new classifier c := New() // train new classifier c.Train(examples) // predict predicted := c.Predict(aDocument) fmt.Printf("Predicted %v", predicted)}
The use of Train and Predict as exported methods are useful in guiding us on what to build next. From the sketch in the preceding code block, we need a Classifier type, that has Train and Predict at the very least. So we'll ...
Read now
Unlock full access