Linear regression

Now that that's all done, let's do some linear regression! But first, let's clean up our code. We'll move our exploratory work so far into a function called exploration(). Then we will reread the file, split the dataset into training and testing dataset, and perform all the transformations before finally running the regression. For that, we will use github.com/sajari/regression and apply the regression.

The first part looks like this:

func main() {  // exploratory() // commented out because we're done with exploratory work.  f, err := os.Open("train.csv")  mHandleErr(err)  defer f.Close()  hdr, data, indices, err := ingest(f)  rows, cols, XsBack, YsBack, newHdr, newHints := clean(hdr, data, indices, datahints, ignored) Xs := tensor.New(tensor.WithShape(rows, ...

Get Go Machine Learning Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.