September 2017
Beginner to intermediate
304 pages
7h 2m
English
To train our neural network on this iris data, we need to read in the training data and create two matrices. The first matrix will hold all of the attributes (matrix inputs), and the second matrix will hold all the labels (matrix labels). We are going to construct these matrices as follows:
// Open the training dataset file.f, err := os.Open("train.csv")if err != nil { log.Fatal(err)}defer f.Close()// Create a new CSV reader reading from the opened file.reader := csv.NewReader(f)reader.FieldsPerRecord = 7// Read in all of the CSV recordsrawCSVData, err := reader.ReadAll()if err != nil { log.Fatal(err)}// inputsData and labelsData will hold all the// float values that will eventually be// used to form ...Read now
Unlock full access